next up previous contents
Next: Selection of driver Up: Operating System Aspects Previous: USBFS

Example directory structure

The usb filesystem is mounted traditionally at /proc/bus/usb. Inside this directory there is one entry for each bus. The the contents of the directory typically reads as follows
/proc/bus/usb$ ls -l
total 0
dr-xr-xr-x    1 root     root            0 Oct 18 16:30 001
dr-xr-xr-x    1 root     root            0 Oct 18 16:30 002
-r--r--r--    1 root     root            0 Oct 29 12:10 devices
-r--r--r--    1 root     root            0 Oct 29 12:10 drivers
showing that there are two busses (designated by 001 and 002). The directories corresponding to the hubs have one file per device connected directly or indirectly to the hub. The first hub has one device connected to it. So its directory contents read:
/proc/bus/usb/001$ ls -l
total 1
-rw-r--r--    1 root     root           18 Oct 29 12:11 001
-rw-r--r--    1 root     root           18 Oct 29 12:11 003
The 001 device is always present and it represents the root hub.

003 is not characterized as a hardware device file( such as a char or a block) as is the case with the serial port, for instance. Once the file is opened, VFS forwards this request to USBFS, which then refers to its list of registered drivers and picks the appropriate driver to complete the open operation.

Bhanu Nagendra P.
2003-07-28