Re: How to determine link of umass/da devices

2005-10-20 Thread Bernd Walter
On Wed, Oct 19, 2005 at 09:38:08AM -0600, M. Warner Losh wrote:
 In message: [EMAIL PROTECTED]
 Tom Alsberg [EMAIL PROTECTED] writes:
 : With tools like usbdevs and sysctl, I can find out what USB devices
 : are connected, and also what USB drivers handle them (so I can see,
 : for example, that there is a SanDisk Cruzer Micro connected to port 2
 : in bus 3 and the umass driver under it).
 
 You can find this out best via the devinfo interface.
 
 : I can also find out what da devices there are using camcontrol.
 
 Right.  cam doesn't hook the da devices into the device tree.
 
 : However, how can I find out which da device was assigned to which
 : umass/usb device?
 
 Generally, you can't.  There's not really an interface to get this
 information.  devinfo assumes that things like disk drives would be in
 the device tree and except for cam, all other drivers conform to this
 world view.  There's some efforts to update and lock cam which I think
 will rectify this.

Not absolutely technicaly correct, but currently one can savely assume
that the umass-sim number from camcontrol devlist -v is identic with the
umass number from devinfo.
This assumption likely won't hold forever.

-- 
B.Walter   BWCThttp://www.bwct.de
[EMAIL PROTECTED]  [EMAIL PROTECTED]

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to determine link of umass/da devices

2005-10-19 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Tom Alsberg [EMAIL PROTECTED] writes:
: With tools like usbdevs and sysctl, I can find out what USB devices
: are connected, and also what USB drivers handle them (so I can see,
: for example, that there is a SanDisk Cruzer Micro connected to port 2
: in bus 3 and the umass driver under it).

You can find this out best via the devinfo interface.

: I can also find out what da devices there are using camcontrol.

Right.  cam doesn't hook the da devices into the device tree.

: However, how can I find out which da device was assigned to which
: umass/usb device?

Generally, you can't.  There's not really an interface to get this
information.  devinfo assumes that things like disk drives would be in
the device tree and except for cam, all other drivers conform to this
world view.  There's some efforts to update and lock cam which I think
will rectify this.

: I see this info in some inconvenient form in
: dmesg.  But I need something easier to handle programmatically to
: write a program that uses that data.  I prefer not to resort to some
: ugly hack like trying to parse dmesg.

Especially since dmesg can disapper quickly on some systems.

: Also, I'd be interested if it were possible to have my program
: informed when devices are connected/disconnected.  Can a process ask
: usbd to send it some signal and somehow provide the details of the
: event when a device is connected/disconnected?

devd provides a pipe of all events from the kernel in
/var/run/devd.pipe.

Warner
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


How to determine link of umass/da devices

2005-10-17 Thread Tom Alsberg
Hi.

I need to write some user interface to perform some tasks with USB
storage devices.  One of the tasks is to show a list of all USB
storage connected and all slices/partitions and filesystems in them.

With tools like usbdevs and sysctl, I can find out what USB devices
are connected, and also what USB drivers handle them (so I can see,
for example, that there is a SanDisk Cruzer Micro connected to port 2
in bus 3 and the umass driver under it).

I can also find out what da devices there are using camcontrol.

However, how can I find out which da device was assigned to which
umass/usb device?  I see this info in some inconvenient form in
dmesg.  But I need something easier to handle programmatically to
write a program that uses that data.  I prefer not to resort to some
ugly hack like trying to parse dmesg.

Also, I'd be interested if it were possible to have my program
informed when devices are connected/disconnected.  Can a process ask
usbd to send it some signal and somehow provide the details of the
event when a device is connected/disconnected?

  Thanks,
  -- Tom

-- 
  Tom Alsberg - certified insane, complete illiterate.
Homepage: http://www.cs.huji.ac.il/~alsbergt/
  * An idea is not responsible for the people who believe in it.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]