pavel-a/usb-relay-hid

There was a problem using two identical relays

webinteger opened this issue · 2 comments

If connect two relays. then lsusb say:

Bus 004 Device 003: ID 16c0:05df VOTI
Bus 004 Device 005: ID 16c0:05df VOTI

The ID is identical but the device is different, add the option to specify which device to control, for example:

hidusb-relay-cmd ID = ID=ABCDE: 003 ON 1
or
hidusb-relay-cmd ID = ID=ABCDE: 005 ON 1

Thank you very much!

So I found an ugly workaround for people having this problem on Windows.

  1. You need to download devcon.exe from Microsoft, see here: https://superuser.com/questions/1002950/quick-method-to-install-devcon-exe
  2. Get the device ids by issuing devcon.exe restart *HID*PID_* as an administrator
  3. It may list several devices try and identify the correct ones
  4. copy the device identifiers for the devices you need to control
  5. disable all but the device you want to conrtrol with devcon.exe disable "@THEHIDNAMEYOUFOUND"
  6. issue the commands with the HID controller which is now only connected to the controller you need
  7. disable the controller you just switched and enable a new one by issuing devcon.exe ebable "@THEHIDNAMEYOUFOUND"
  8. You can now control identical devices with identical ID and names just from the HW address!

On linux the procedure is much easier than using devcon you just have to change the permissions to the correct device in /dev/

Identical IDs should not occur. Complain to the seller/manufacturer.
If the manufacturer cannot ensure unique IDs, they must provide a way for a customer to reprogram the ID.
I could add a command to select the device by "instance path" but in Windows these are obscure and can change after reboot. Definitely not recommended.