M
M
maaad2011-05-31 16:58:57
linux
maaad, 2011-05-31 16:58:57

How to replace USB device serial number in hiddev module (Linux)?

There are n number of devices that work through the hiddev module and have absolutely identical attributes:
idVendor 0xffaa idProduct
0xffbb
iManufacturer X Noname manufacturer
iProduct 1 Noname product
iSerial 0
pays attention only to these attributes.
/proc/bus/usb/devices
T: Bus= 01 Lev=01 Prnt=01 Port= 00 Cnt=01 Dev#= 12 Spd=1.5 MxCh= 0
T: Bus= 01 Lev=01 Prnt=01 Port= 01 Cnt =02 Dev#= 13 Spd=1.5 MxCh=
0 for the first device, it will look like this: 0100, and for the second: 0101.
Tell me, in which direction to dig into hid-core.c and is such a substitution option possible at all?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
L
lesha_penguin, 2011-05-31
@lesha_penguin

It's better to dig in the direction of udev, if I'm not mistaken, you can specify a rule for the physical location of the device in it. Then it will be easy to work with them by sane names, prescribed once and for all in the form of a udev rule.

M
maaad, 2011-06-01
@maaad

The rule won't help: the software doesn't care about udev.

M
miwa, 2011-06-01
@miwa

I once played with several identical barcode scanners on the same machine. I decided everything with something like this config in /etc/udev/rules.d/ and then accessed the scanner I needed as /dev/scanner1. If necessary, I can see the full configs. There, two scanners with different serial numbers are described by adding the line ATTRS {iSerial}, EMNIP.
KERNEL=="hidraw*", ACTION="add", \
ATTRS{idVendor}=="05e0", \
ATTRS{idProduct}=="0600", \
SYMLINK+="scaner1", MODE:="0666"

M
maaad, 2011-06-01
@maaad

The problem is that the software does not pay attention to udev's symlinks. It independently polls usb devices and filters their attributes. Therefore, the question was raised specifically about the modification of the module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question