Updated to VS2013, added x64 config
[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
28f22397 4Rev. 1.2 (22-Nov-2014)
6629800a 5
6Usage:
c2529f42 7 usbrelay-cmd [ID=XXXXX] ON|OFF <num> -- turn the relay ON or OFF
6629800a 8
28f22397 9 where <num> is the relay number: 1-2 or "ALL"
c2529f42 10
28f22397 11 usbrelay-cmd STATUS -- print state of one relay device with its "unique ID"
c2529f42 12 usbrelay-cmd ENUM -- print state of all devices and their "unique IDs"
13
28f22397 14Parameter ID=XXXXX specifies one relay device if several are connected.
15Without the ID= parameter, if several devices are connected, the program uses any one of them.
16The ID string is case sensitive.
17
18Examples:
19
c2529f42 20 usbrelay-cmd id=ABCDE on 1
28f22397 21 usbrelay-cmd id=ABCDE OFF ALL
22 usbrelay-cmd id=ABCDE STATUS
23
24 usbrelay-cmd ON ALL -- uses first found relay device
25 usbrelay-cmd STATUS -- uses first found relay device
c2529f42 26
c2529f42 27
28f22397 28REMARKS
c2529f42 29
28f22397 30The Enum command lists the IDs of all available relay devices.
31The ID strings are case sensitive and should be exactly as output by the "enum" command.
6629800a 32
33Each relay has two contact pairs: Normally Open and Normally Closed.
34The OFF state is the "normal" state, when the red LED is off, and the Normally Open contacts are disconnected.
35The ON state is when the red LED is on, and the Normally Open contacts are connected.
36
37Note: In the original s/w readme, "Open" means ON, "Close" means OFF.
6629800a 38
28f22397 39This program has been tested with 1- and 2-relay devices.
6629800a 40
28f22397 41On Linux, this program requires root access by default!
42To grant access to non-root users, define udev rule for the devices:
43Example:
44 SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE:="0666"
6629800a 45
6629800a 46
28f22397 47BUILDING
48
49For Windows XP and later:
50 - Using the in-box hid.dll
6182d73d 51 - Build with VC++ 2008 and WDK 7.1, or VC++ 2013 "community edition" with WDK 8.1
6629800a 52
28f22397 53For Linux (PC, x86):
54 - using the old libusb (v. 0.1; usb.h)
55 - tested on Centos 5, Ubuntu 12.04, Mint
56
57SOURCE based on a V-USB HID example.
58LICENSE: TBD!
59 Should be non-GPL; rewrite all prototype code!
60
6629800a 61>>> Target for 1st public release:
62================================
631. Remove GPL encumberment
642. Make a .so for Linux (Windows already has orig DLL)
65
66Other TODO's
67============
6629800a 68
69 *** Check that these devices indeed have unique IDs!
70 The orig. h file mentions function: usb_relay_device_set_serial(int hHandle, char serial[5]);
71 which may be used by mfg to burn the ID? but the orig. DLL does not export it.
72 In detection code (find by "unique ID"), check only by product name, Ignore vendor string?
73
74TODO: Make a .so callable from Java, Python etc.
75 For this, move to libusb 1.x (libusb.h)?
76TODO: provide the original API "usb_relay_device.h" API, compatible with the orig. usb_relay_device.dll
77 The orig .h file and example are in orig dir (slightly adapted and updated to VC2008)
78 In orig .h file relay state "open" means ON (the red LED is on). "Close" means OFF (the red LED is off)
79~~
80
81Uses code by:
82Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
83Author: Christian Starkjohann
84Creation Date: 2008-04-11
85
86~~
87The relay device ID - from HID attributes:
88vendorName = "www.dcttech.com" -> this site does not exist (squatted)
1c892392 89productName = "USBRelayN" where N=1|2|4
6629800a 90