pavel-a / usb-relay-hid

Software for USB-connected relays with HID interface. See the WIKI for more info.
http://vusb.wikidot.com/project:driver-less-usb-relays-hid-interface
247 stars 105 forks source link

Bad usbrelay ID string! #39

Open zedthirteen opened 3 years ago

zedthirteen commented 3 years ago

My PC failed to detect the USB relay. After some debugging I traced the issue to the checks on the buffer returned by usb_relay_lib.c->rel_read_status_raw

the loop(s) that checks all of the char in the array are failing on the first element (buffer[1]) as it has the value 0xFF. The buffer conntents are: 0x00, 0xFF, 0x57, 0x33, 0x34 0x31, 0x00....

Anybody knwo why this ID is now reported differently by the OS?

I've temporarilly modified all of the for loops to start at element 2

OzFalcon commented 2 years ago

Are you sure your USB relay is using the same microcontroller? See https://github.com/pavel-a/usb-relay-hid/issues/27

zedthirteen commented 2 years ago

Ahh, my 4 channel relay has an Atmel ATMEGA8. The thing is, it was working fine for over a year. I just fired up my PC one day and when I tried to use the windows form based application, it failed to detect the relay board. Perhaps the firmware ont the board has corrupted? But it is still working with my change to the library code. I have an 8 channel USB relay on order so I will run some test with that when it arrives

datadiode commented 1 year ago

My 8 channel relay board just developed the essencially same issue, the only difference being that some other character of the ID string changed its value to 0x01. The board continues to work after relaxing the ID string syntax check to accept characters outside the printable ASCII range.