On Tue, Dec 04, 2007 at 04:32:44PM +0000, Phil Endecott wrote:
> Greg KH wrote:
>> On Mon, Dec 03, 2007 at 06:19:53PM +0000, Phil Endecott wrote:
>>> Dear Experts,
>>>
>>> Can anyone suggest the best way to determine the speed (low/full/high) at 
>>> which a device is operating from user-space?
>>>
>>> usbdevice_fs has 'connectinfo', which seems to return a flag for 
>>> low-speed operation.  But it doesn't seem to distinguish between full and 
>>> high-speed.  A usbdevicefs method would be ideal as I'm already using 
>>> that, but maybe there is something in /sys?
>>
>> Yes, there's a "speed" file there, try it out, I think it's exactly what
>> you are looking for :)
>
> Thanks Greg.  I should have spotted that; I must have been lost in /sys's 
> maze of twisty symlinks.
>
> Now I just need to work out how to convert from e.g. /proc/bus/usb/001/010 
> to e.g. /sys/devices/pci0000:00/0000:00:10.3/usb1/1-4/1-4.6/1-4.6.3.  Any 
> ideas?
>
> (Sometimes I already have the /sys path; my app listens for uevents on a 
> netlink socket, and these include both pathnames.  But when it starts it 
> looks for already-attached devices by iterating through /proc/bus/usb, and 
> in this case it doesn't have the /sys path conveniently available.  Maybe I 
> should instead do this initial search in some other way, e.g. through 
> /sys/bus/usb/devices?)

Well, your program already has the sysfs path, so you should be fine :)

And also remember, not all distros mount usbfs at /proc/bus/usb anymore,
it should be at /dev/bus/usb/, so you need to look in both places.

Someone posted a way to go from the usbfs device names to the sysfs ones
a while ago, I'm pretty sure it is simple to go from, but I can't
remember how to do it at the moment.

Ah, it's the "busnum" and "devnum" sysfs files, that should be all you
need to go from sysfs to the usbfs file name.

Hope this helps,

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

Reply via email to