Re: Figuring out devnodes from a usb device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 01, 2010 at 10:58:07PM +0300, Felipe Balbi wrote:
> Hi all,
> 
> I'm trying to figure out how I could find all devnodes related to a USB
> device.

That's hard, as there are lots of different types of USB devices.

It's like saying, "I want to find all devnodes for a PCI device" :)

> For example, if I attach a usb mass storage device I want to
> figure out which /dev/sdXX I'm supposed to use when trying to read/write
> to that particular device. Similarly for ACM, Network and all other devices.

For each type of device, you are going to have to do it differently.
And note that network devices don't have device nodes, so that makes it
harder to make a "general" case here.

> Is there any way to achieve that with libudev ?

Yes, but it's going to have to be type (i.e. class) specific.

> I tried using
> udev_device_get_devlinks_list_entry() but that didn't help.

You might not be looking at the "right" device.  You will have to go up
and down the device tree to find the correct one, depending on the type.
And what about devices with multiple interfaces, with different device
nodes (like the famous disk drive with a button on it, mass-storage and
a HID device).

good luck,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux