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)
7 usbrelay-cmd ON|OFF <num> -- turn the relay ON or OFF
8 usbrelay-cmd STATE -- print state of relays and the "unique ID"
10 where <num> is the relay number: 1-2 or "*" for all
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.
16 Note: In the original s/w readme, "Open" means ON, "Close" means OFF.
18 Currently tested with 1 and 2-relay devices.
19 Finds the FIRST AVAILABLE RELAY device! Does not address by the "unique ID" yet!
21 SOURCE based on a V-USB HID example.
23 Should be non-GPL; rewrite all prototype code!
26 For Windows XP and later:
27 - using the in-box hid.dll and WDK 7.1.
28 - build with VC++ 2008
31 - using the old libusb (v 0.1; usb.h)
32 - tested on Centos 5, Ubuntu 12.04
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"
37 >>> Target for 1st public release:
38 ================================
39 1. Remove GPL encumberment
40 2. Make a .so for Linux (Windows already has orig DLL)
44 TODO: support multiple devices, support other existing variants
45 usbrelay-cmd -ID=XXXXX ON|OFF <num>
46 usbrelay-cmd -ID=XXXXX STATE
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?
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)
63 Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
64 Author: Christian Starkjohann
65 Creation Date: 2008-04-11
68 The relay device ID - from HID attributes:
69 vendorName = "www.dcttech.com" -> this site does not exist (squatted)
70 productName = "USBRelayN" where N=1|2|4