Very-Simple-USB-Relay
Very-Simple-USB-Relay copied to clipboard
Using 2 identical modules with 2 relays (like in image) into the same Ubuntu system
There is no serial number when i run the usb linux command.
We have to add a device attribute (ATTR) like serial number or something unique for each device in to /etc/udev/rules.d/50-dct-tech-usb-relay-2.rules.
EX: SUBSYSTEM=="usb", ATTR{idVendor}=="16c0",ATTR{idProduct}=="05df", MODE="0666" KERNEL=="hidraw*", ATTRS{busnum}=="1", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE="0666"
For arduino or other usb connected devices the best options is to run a linux command "_udevadm_xxx etc to check all the attributes of a usb device" and add the attribute to the ubuntu dev rules.
How can i solve this problem with the identical modules? TX!
That's a good question.
As is, the software can't do this.
However, you may be able to use the output from the shell command udevadm info -q path -n /dev/hidraw0
. This gives you info about the USB port the device is plugged in to.
You will need to change the index of the device to match what your setup. ex: /dev/hidraw1 or /dev/hidraw2
The different paths should be constant and will allow you to differentiate between the devices.