Added support for 1, 4-relay device (still only one)
[usb-relay-hid.git] / commandline / README-hidusb-relay-cmd.txt
CommitLineData
6629800a 1Command 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 4Rev. 1.1 (18-Nov-2014)
6629800a 5
6Usage:
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
12Each relay has two contact pairs: Normally Open and Normally Closed.
13The OFF state is the "normal" state, when the red LED is off, and the Normally Open contacts are disconnected.
14The ON state is when the red LED is on, and the Normally Open contacts are connected.
15
16Note: In the original s/w readme, "Open" means ON, "Close" means OFF.
17
1c892392 18Currently tested with 1 and 2-relay devices.
6629800a 19Finds the FIRST AVAILABLE RELAY device! Does not address by the "unique ID" yet!
20
21SOURCE based on a V-USB HID example.
22LICENSE: TBD!
23 Should be non-GPL; rewrite all prototype code!
24
25
26For Windows XP and later:
27 - using the in-box hid.dll and WDK 7.1.
28 - build with VC++ 2008
29
30For 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================================
391. Remove GPL encumberment
402. Make a .so for Linux (Windows already has orig DLL)
41
42Other TODO's
43============
1c892392 44TODO: 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
55TODO: Make a .so callable from Java, Python etc.
56 For this, move to libusb 1.x (libusb.h)?
57TODO: 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
62Uses code by:
63Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
64Author: Christian Starkjohann
65Creation Date: 2008-04-11
66
67~~
68The relay device ID - from HID attributes:
69vendorName = "www.dcttech.com" -> this site does not exist (squatted)
1c892392 70productName = "USBRelayN" where N=1|2|4
6629800a 71