]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/proxusb.c
fixed USB GPIO bug reported by gregy, and fixed 'hf 14a reader' command
[proxmark3-svn] / client / proxusb.c
index 8eedd2e67e4556937d14040de97c3f8acf3729d8..2f152ace25dfe5f2f49e48fee3e11ed4b609c3e4 100644 (file)
@@ -34,15 +34,15 @@ unsigned char return_on_error = 0;
 unsigned char error_occured = 0;
 extern unsigned int current_command;
 
-void SendCommand(UsbCommand *c)
+void SendCommand_(HidCommand *c)
 {
   int ret;
 
 #if 0
-  printf("Sending %d bytes\n", sizeof(UsbCommand));
+  printf("Sending %d bytes\n", sizeof(HidCommand));
 #endif
   current_command = c->cmd;
-  ret = usb_bulk_write(devh, 0x01, (char*)c, sizeof(UsbCommand), 1000);
+  ret = usb_bulk_write(devh, 0x01, (char*)c, sizeof(HidCommand), 1000);
   if (ret<0) {
     error_occured = 1;
     if (return_on_error)
@@ -63,12 +63,12 @@ void SendCommand(UsbCommand *c)
   }
 }
 
-bool ReceiveCommandPoll(UsbCommand *c)
+bool ReceiveCommandPoll(HidCommand *c)
 {
   int ret;
 
-  memset(c, 0, sizeof (UsbCommand));
-  ret = usb_bulk_read(devh, 0x82, (char*)c, sizeof(UsbCommand), 500);
+  memset(c, 0, sizeof (HidCommand));
+  ret = usb_bulk_read(devh, 0x82, (char*)c, sizeof(HidCommand), 500);
   if (ret<0) {
     if (ret != -ETIMEDOUT) {
       error_occured = 1;
@@ -89,16 +89,16 @@ bool ReceiveCommandPoll(UsbCommand *c)
       return false;
     }
   } else {
-    if (ret && (ret < sizeof(UsbCommand))) {
+    if (ret && (ret < sizeof(HidCommand))) {
       fprintf(stderr, "Read only %d instead of requested %d bytes!\n",
-        ret, (int)sizeof(UsbCommand));
+        ret, (int)sizeof(HidCommand));
     }
   }
 
   return ret > 0;
 }
 
-void ReceiveCommand(UsbCommand *c)
+void ReceiveCommand(HidCommand *c)
 {
 //  printf("%s()\n", __FUNCTION__);
   int retval = 0;
@@ -151,9 +151,10 @@ usb_dev_handle* findProxmark(int verbose, unsigned int *iface)
 
     fprintf(stdout, "\nConnected units:\n");
 
-    for (int i = 0; i < iUnit; i++)
-      fprintf(stdout, "\t%d. SN: %s\n", i+1, units[i].serial_number);
-
+    for (int i = 0; i < iUnit; i++) {
+      struct usb_device * dev = usb_device(units[i].handle);
+      fprintf(stdout, "\t%d. SN: %s [%s/%s]\n", i+1, units[i].serial_number, dev->bus->dirname, dev->filename);
+    }
     if (iUnit > 1) {
       while (iSelection < 1 || iSelection > iUnit) {
         fprintf(stdout, "Which unit do you want to connect to? ");
@@ -182,15 +183,6 @@ usb_dev_handle* OpenProxmark(int verbose)
   usb_dev_handle *handle = NULL;
   unsigned int iface;
 
-#ifdef __linux__
-  handle = findProxmark(verbose, &iface);
-  if (!handle)
-    return NULL;
-
-  /* Whatever... */
-  usb_reset(handle);
-#endif
-
   handle = findProxmark(verbose, &iface);
   if (!handle)
     return NULL;
Impressum, Datenschutz