On Tue, 18 Apr 2006, gary clark wrote:

> Hello,
> 
> Is there a system call maybe an ioctl that can be
> performed within usb storage driver to obtain the
> major and minor numbers corresponding to those found
> in /dev on a USB device.

No.

> I perform an open system call using usbfs i.e
> /proc/bus/usb/001/001 and and use CONNECT and
> DISCONNECT in the ioctl calls. This has the effect of
> connecting and disconnecting usb devices.

No it doesn't.  It binds and unbinds the driver to/from the interface.  
There's no change to the state of the device's connection.  And there's
certainly no change to the state of the USB cable that physically connects
the device.

> I then want
> to map the usb file to major and minor numbers in
> /dev.

This isn't a simple mapping.  A single USB device may correspond to 0, 1,
or more entries in /dev.  Also, it's not clear why you want to know the
major and minor numbers rather than the filename of the /dev entry.

Anyhow, the simplest way I can think of for doing this is to find the 
appropriate interface entry in /sys/bus/usb/devices (which isn't 
necessarily so easy to do).  From there go through the host, target, and 
LUN subdirectories, and in the LUN directory follow the link to block/dev.  
That file will contain the major and minor numbers.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to