Answer the question
In order to leave comments, you need to log in
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
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.
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"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question