I am new to Linux kernel programming. I wish to develop a program to read USB drive information like its manufacturer name, capacity, etc. I know about descriptors and their attributes. But I don't understand how to enumerate USB drives connected to the system. I am looking for the function which initiates connection between kernel and USB port. How is it possible?
You don't need to program the kernel as such - in fact to read the device info you don't even need a device driver.
The USB system is different in the newer 2.6 kernels so a lot of the online tutorials may be out of date - but start here http://www.linux-usb.org/
If you do want to write a USB device driver see this Linux journal tutorial
Do you really want to do a kernel programming? There is an lsusb utility, capable of reading "USB drive information like its manufacturer name", descriptors... It also can enumerate all usb devices.
Sources of lsusb
are e.g. here http://www.google.com/codesearch#VKTEFMx6wp0/lsusb.c
If you are doing a writing an USB driver, which works in kernel mode, I suggest you read some existing usb driver and USB driver programming FAQ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With