darrylb123 / usbrelay

Control usb relay - based on hidapi
GNU General Public License v2.0
315 stars 98 forks source link

New board 5131:2007 not working #103

Closed alfem closed 9 months ago

alfem commented 1 year ago

Hi!

I recently bought a similar 2 relays usb board. Vendor/product id are different (5131:2007). You can read "lcus_hid_x2" on the PCB.

I replaced the original usb ids with these new ones in RelayModuleDcttech.h, but no luck.

This is the new board: https://es.aliexpress.com/item/1005003595023772.html

A dmesg shows this info:

[17817.335415] usb 1-1: new full-speed USB device number 13 using xhci_hcd
[17817.483980] usb 1-1: New USB device found, idVendor=5131, idProduct=2007, bcdDevice= 0.00
[17817.483999] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[17817.489547] usb 1-1: language id specifier not provided by device, defaulting to English
[17817.498063] hid-generic 0003:5131:2007.0009: hiddev2,hidraw6: USB HID v1.00 Device [HID 5131:2007] on usb-0000:00:14.0-1/input0

With ids changed I only get this:

path:             /dev/hidraw6
vendor_id:        0x5131
product_id:       0x2007
serial_number:    
release_number:   0
manufacturer:     (null)
product:          (null)
interface_number: 0
module_name:

Any ideas?

darrylb123 commented 1 year ago

Oh, another one. They are very cheap. I've just bought one. Here we go again :) Thanks for drawing it to my attention.

Darryl

On Mon, 17 Apr 2023, 8:43 pm Alfonso E.M., @.***> wrote:

Hi!

I recently bought a similar 2 relays usb board. Vendor/product id are different (5131:2007). You can read "lcus_hid_x2" on the PCB.

I replaced the original usb ids with these new ones in RelayModuleDcttech.h, but no luck.

This is the new board: https://es.aliexpress.com/item/1005003595023772.html

A dmesg shows this info:

[17817.335415] usb 1-1: new full-speed USB device number 13 using xhci_hcd [17817.483980] usb 1-1: New USB device found, idVendor=5131, idProduct=2007, bcdDevice= 0.00 [17817.483999] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [17817.489547] usb 1-1: language id specifier not provided by device, defaulting to English [17817.498063] hid-generic 0003:5131:2007.0009: hiddev2,hidraw6: USB HID v1.00 Device [HID 5131:2007] on usb-0000:00:14.0-1/input0

With ids changed I only get this:

path: /dev/hidraw6 vendor_id: 0x5131 product_id: 0x2007 serial_number: release_number: 0 manufacturer: (null) product: (null) interface_number: 0 module_name:

Any ideas?

— Reply to this email directly, view it on GitHub https://github.com/darrylb123/usbrelay/issues/103, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVP5UIHETS4IMGKWWN3XBUNGLANCNFSM6AAAAAAXA76PBI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

alfem commented 1 year ago

I think this is a CFSunbird board, probably with a different protocol. In the official store I found some useful info about serial communication in the item description:

https://es.aliexpress.com/i/1005003781042941.html

Thanks for your help!

alfem commented 1 year ago

Finally I tested sending hex codes right to the hidraw device file and it worked!

Open first relay: echo -e '\xA0\x01\01\xA2' > /dev/hidraw6 Close first relay: echo -e '\xA0\x01\00\xA1' > /dev/hidraw6

Perhaps this makes an specific command unnecessary.

darrylb123 commented 1 year ago

Cool, you've done the work for me. At least you have a work around until I get mine and update usbrelay. Just reading the link you supplied, it looks like it's another one that can't be interrogated for current relay state. Way back, I ran the original relays windows software in a VM with the USB device mapped through then snooped the protocol with Wireshark. The ucreatefun relays were dumb one direction protocol and the relay could not be identified. This one implies that the A0 identifier may be able to be changed.

On Mon, 17 Apr 2023, 11:02 pm Alfonso E.M., @.***> wrote:

Finally I tested sending hex codes right to the hidraw device file and it worked!

Open first relay: echo -e '\xA0\x01\01\xA2' > /dev/hidraw6 Close first relay: echo -e '\xA0\x01\00\xA1' > /dev/hidraw6

Perhaps this makes an specific command unnecessary.

— Reply to this email directly, view it on GitHub https://github.com/darrylb123/usbrelay/issues/103#issuecomment-1511298108, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVNCEC6SP52YFYX3XJDXBU5NDANCNFSM6AAAAAAXA76PBI . You are receiving this because you commented.Message ID: @.***>

alfem commented 1 year ago

I can not see that one you can interrogate. I tested mine but I can not read anything from the device files.

'A0' could some model prefix. I don't think it is useful for anything.

darrylb123 commented 1 year ago

Indeed, more rubbish. I'm inclined to just document what you have done and leave it at that. The documentation about using udev to apply unique device files for each USB port for ucreatefun relays applies with these relays,

I asked the vendor about querying the state and changing the A0. We'll see what they have to say.

On Tue, 18 Apr 2023, 9:19 pm Alfonso E.M., @.***> wrote:

I can not see that one you can interrogate. I tested mine but I can not read anything from the device files.

'A0' could some model prefix. I don't think it is useful for anything.

— Reply to this email directly, view it on GitHub https://github.com/darrylb123/usbrelay/issues/103#issuecomment-1512901719, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSUVKPWER2V3L3VXW4Z4TXBZ2C7ANCNFSM6AAAAAAXA76PBI . You are receiving this because you commented.Message ID: @.***>

alfem commented 1 year ago

Meanwhile I have put together a little script for my Home Assistant server:

https://github.com/alfem/usb-relay-control/

I asked the vendor yesterday as well, but he did not give me any info.

GoolaDev commented 1 year ago

I've tried it and it works on Linux(Fedora). But I need it on Windows. Using: hidapitester --vidpid 5131:2007 --open --send-output A0,01,01,A2 did nothing. There is a page option/switch (--usagePage ), but which one to use?

GoolaDev commented 1 year ago

To ansert my own question. Here is LC HID Tester software for windows: https://onedrive.live.com/?authkey=%21AO6nMeHgMBC3Bc8&id=4A0865B22350D05C%21125&cid=4A0865B22350D05C&parId=root&parQt=sharedby&o=OneUp

AMV007 commented 9 months ago

added functionality: https://github.com/darrylb123/usbrelay/pull/109 @alfem

LupusTheCanine commented 9 months ago

A bit more info on the device Manufacturer site: http://www.chinalctech.com/index.html Manufacturer wiki: http://wiki.lctech.cc/index.php?title=Main_Page

wlan4you commented 9 months ago

I've tried it and it works on Linux(Fedora). But I need it on Windows. Using: hidapitester --vidpid 5131:2007 --open --send-output A0,01,01,A2 did nothing. There is a page option/switch (--usagePage ), but which one to use?

I have absolutly the same problem and the same module. i tryed it to switch with the same testtool and commands. I will need it under windows for example with a batch file.

You find a solution over hidapitester ?