Accessing USB Mass Storage Device
M. Warner Losh
imp at bsdimp.com
Tue Oct 18 21:39:46 PDT 2005
In message: <43553287.4030907 at pacbell.net>
Daniel Rudy <dr2867 at pacbell.net> writes:
: When the umass driver is compiled into the kernel, and one inserts a USB
: mass storage device, how does one access the device descriptors (serial
: number) while the device is listed as a da device? I would perfer to
: have the OS do all the work of accessing the hardware.
The serial number can be obtained with devifo. However, since cam
doesn't hook into the device tree, mapping da number to umass number
can be tricky in the arbitrary case.
devinfo -v | grep umass
umass0 pnpinfo vendor=0x054c product=0x014d devclass=0x00 devsubclass=0x00 release=0x0110 sernum="0052450548137984" intclass=0x08 intsubclass= at port=0 interface=0
: How does one read and write data to the device using /dev/ugen?
One can't. You can't have multiple drivers attach to the same
hardware. They would interfere with each other unless there was some
sort of time domain sharing of the device. Even that would be, ummm,
challanging in the arbitrary general case (but I want to get the
serial number of my disk that's mounted, why can't I do that?).
Arbitrary sharing is tough to do. Since ugen is so arbitrary in what
you can do with it, I don't imagine it would ever be implemented.
Another option would be to do what we do with pci already, and have a
small set of information that we can query the device in a
non-distruptive (mostly) way and expand that to usb. The usb bus
(well uhub, since it is the usb bus) would create device nodes that
could be querried for standard information. We've started doing this
with pccard and cardbus, so you can now get, eg, the CIS, the power
states (well, that's in my mind/tree right now), etc.
More information about the freebsd-hackers