-; Keep this consistent with .gitattributes
-; http://editorconfig.org/#supported-properties
+; Editorconfig settings: see http://editorconfig.org/#supported-properties
+; Keep this file consistent with .gitattributes ! end_of_line <-> eol=crlf
root = true ; top-most EditorConfig file
-// Command line tool for Chinese USB/HID relays
+// Command line tool for low-cost USB/HID relays
//
// pa02 20-Nov-2014 supports 1,2,4,8 - relay devices
//
static USBDEVHANDLE openDevice(void)
{
int err;
-
err = usbhidEnumDevices(USB_CFG_VENDOR_ID, USB_CFG_DEVICE_ID, &g_enumCtx, enumFunc);
if ( err || !g_enumCtx.mydev )
}
if ( strncasecmp(arg1, "id=", 3) == 0 ) {
+ /* Set the ID for following commands. else use 1st found device.*/
if (strlen(&arg1[3]) != USB_RELAY_ID_STR_LEN) {
printerr("ERROR: ID must be %d characters (%s)\n", USB_RELAY_ID_STR_LEN, arg1);
return 1;
}
- strcpy( g_enumCtx.id, &arg1[3]);
+ strcpy(g_enumCtx.id, &arg1[3]);
// shift following params
arg1 = arg2;
if ( strncasecmp(arg1, "stat", 4) == 0 ) { // stat|state|status
err = show_status(dev);
- // TODO enumerate all devices
}else if( strcasecmp(arg1, "on" ) == 0) {
err = rel_onoff(dev, 1, arg2);
}else if( strcasecmp(arg1, "off" ) == 0) {
return err;
}
-/* ------------------------------------------------------------------------- */