Fixup merge...
authorPavel A <pavel_a@live.com>
Sat, 2 Apr 2016 23:07:10 +0000 (02:07 +0300)
committerPavel A <pavel_a@live.com>
Sat, 2 Apr 2016 23:07:10 +0000 (02:07 +0300)
.editorconfig
commandline/usbrelay-cmd.c

index 74102affb79bee0c9acf137f663f8426bbaf520f..ca4f60dcce308708f271bf667609b291614c586c 100644 (file)
@@ -1,5 +1,5 @@
-; 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
 
index 3d983987e0b27008a1553f98495543a31f9440db..4667f58837475ebaf2b6f12403d86205679b48d3 100644 (file)
@@ -1,4 +1,4 @@
-// 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
 //
@@ -169,7 +169,6 @@ static int enumFunc(USBDEVHANDLE dev, void *context)
 static USBDEVHANDLE openDevice(void)
 {
     int err;
-
     err = usbhidEnumDevices(USB_CFG_VENDOR_ID, USB_CFG_DEVICE_ID, &g_enumCtx, enumFunc);
 
     if ( err || !g_enumCtx.mydev )
@@ -344,12 +343,13 @@ int main(int argc, char **argv)
     }
 
     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;
@@ -362,7 +362,6 @@ int main(int argc, char **argv)
 
     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) {
@@ -379,4 +378,3 @@ int main(int argc, char **argv)
     return err;
 }
 
-/* ------------------------------------------------------------------------- */