2002-10-13 10:12:56

by Jochen Friedrich

[permalink] [raw]
Subject: Re: Cleware Linux Info

Hi,

i assume you try to search for a particular HID device by its serial
number.

> 1. The struct hiddev_devinfo lacks the serial number. In the usb
> structure, the
> index of the string is available, but not the number itself.

I don't think it's the right way to scan through all devices and query for
the serial number (even if it were available). This would be a very
expensive operation on systems with devfs as modprobe would be called on
each try to open an unavailable device (I know some ALSA utils
occasionally do the same, but it's still a bad thing).

IMHO, the right way would be to scan /proc/bus/usb/devices for the device
with the desired serial number and then open the corresponding
hiddev device.

However, it looks like the information about the corresponding
hiddev device is not included in /proc/bus/usb/devices (at least on
2.4.19). Is there a way to get the device name without scanning through
all hiddev devices and scan for the USB dev num instead (would be as bad
as scanning for the serial number in the first place).

--jochen