6629800a |
1 | Command line utility for Chinese USB HID relays |
2 | (USB 1.1 HID devices, VEN=5824 (0x16c0) DEV=1503 (0x05DF), based on the V-USB project) |
3 | |
1c892392 |
4 | Rev. 1.1 (18-Nov-2014) |
6629800a |
5 | |
6 | Usage: |
7 | usbrelay-cmd ON|OFF <num> -- turn the relay ON or OFF |
8 | usbrelay-cmd STATE -- print state of relays and the "unique ID" |
9 | |
10 | where <num> is the relay number: 1-2 or "*" for all |
11 | |
12 | Each relay has two contact pairs: Normally Open and Normally Closed. |
13 | The OFF state is the "normal" state, when the red LED is off, and the Normally Open contacts are disconnected. |
14 | The ON state is when the red LED is on, and the Normally Open contacts are connected. |
15 | |
16 | Note: In the original s/w readme, "Open" means ON, "Close" means OFF. |
17 | |
1c892392 |
18 | Currently tested with 1 and 2-relay devices. |
6629800a |
19 | Finds the FIRST AVAILABLE RELAY device! Does not address by the "unique ID" yet! |
20 | |
21 | SOURCE based on a V-USB HID example. |
22 | LICENSE: TBD! |
23 | Should be non-GPL; rewrite all prototype code! |
24 | |
25 | |
26 | For Windows XP and later: |
27 | - using the in-box hid.dll and WDK 7.1. |
28 | - build with VC++ 2008 |
29 | |
30 | For Linux (PC, x86): |
31 | - using the old libusb (v 0.1; usb.h) |
32 | - tested on Centos 5, Ubuntu 12.04 |
33 | - requires root! |
34 | To grant access to users, define udev rule for this device (or all HID). Example: |
35 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE:="0666" |
36 | |
37 | >>> Target for 1st public release: |
38 | ================================ |
39 | 1. Remove GPL encumberment |
40 | 2. Make a .so for Linux (Windows already has orig DLL) |
41 | |
42 | Other TODO's |
43 | ============ |
1c892392 |
44 | TODO: support multiple devices, support other existing variants |
45 | usbrelay-cmd -ID=XXXXX ON|OFF <num> |
46 | usbrelay-cmd -ID=XXXXX STATE |
47 | or -s XXXXX or --SN |
48 | -ID=* --ANY any one? |
6629800a |
49 | |
50 | *** Check that these devices indeed have unique IDs! |
51 | The orig. h file mentions function: usb_relay_device_set_serial(int hHandle, char serial[5]); |
52 | which may be used by mfg to burn the ID? but the orig. DLL does not export it. |
53 | In detection code (find by "unique ID"), check only by product name, Ignore vendor string? |
54 | |
55 | TODO: Make a .so callable from Java, Python etc. |
56 | For this, move to libusb 1.x (libusb.h)? |
57 | TODO: provide the original API "usb_relay_device.h" API, compatible with the orig. usb_relay_device.dll |
58 | The orig .h file and example are in orig dir (slightly adapted and updated to VC2008) |
59 | In orig .h file relay state "open" means ON (the red LED is on). "Close" means OFF (the red LED is off) |
60 | ~~ |
61 | |
62 | Uses code by: |
63 | Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH |
64 | Author: Christian Starkjohann |
65 | Creation Date: 2008-04-11 |
66 | |
67 | ~~ |
68 | The relay device ID - from HID attributes: |
69 | vendorName = "www.dcttech.com" -> this site does not exist (squatted) |
1c892392 |
70 | productName = "USBRelayN" where N=1|2|4 |
6629800a |
71 | |