]> err.no Git - yubikey-personalization.old/commitdiff
Make the yubikey module consistent
authorlevitte <levitte@b62f149e-849f-11dd-9899-c7ba65f7c4c7>
Thu, 18 Sep 2008 15:11:40 +0000 (15:11 +0000)
committerlevitte <levitte@b62f149e-849f-11dd-9899-c7ba65f7c4c7>
Thu, 18 Sep 2008 15:11:40 +0000 (15:11 +0000)
git-svn-id: https://yubikey-personalization.googlecode.com/svn/trunk@10 b62f149e-849f-11dd-9899-c7ba65f7c4c7

common/yubikey.c
common/yubikey.h

index 8977038ea06044026ed723239a97cb0307543a79..4dc5456c9d86e2651b7cc721d9d8f44a5cfa0fbd 100644 (file)
@@ -27,8 +27,8 @@
 **  function hidSetReport                                              **
 **  Set HID report                                                     **
 **                                                                      **
-**  int hidSetReport(YUBIKEY yk, int reportType, int reportNumber,     **
-**                                      char *buffer, int size)        **
+**  int hidSetReport(YUBIKEY *yk, int reportType, int reportNumber,    **
+**                  char *buffer, int size)                            **
 **                                                                      **
 **  Where:                                                              **
 **  "yk" is handle to open Yubikey                                     **
 **                                                                      **
 *************************************************************************/
 
-static int hidSetReport(YUBIKEY yk, int reportType, int reportNumber, char *buffer, int size)
+static int hidSetReport(YUBIKEY *yk, int reportType, int reportNumber, char *buffer, int size)
 {
     return usb_control_msg(yk, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_ENDPOINT_OUT, HID_SET_REPORT,
-                               reportType << 8 | reportNumber, 0, buffer, size, 1000) > 0;
+                          reportType << 8 | reportNumber, 0, buffer, size, 1000) > 0;
 }
 
 /*************************************************************************
 **  function hidGetReport                                              **
 **  Get HID report                                                     **
 **                                                                      **
-**  int hidGetReport(YUBIKEY yk, int reportType, int reportNumber,     **
-**                                      char *buffer, int size)        **
+**  int hidGetReport(YUBIKEY *yk, int reportType, int reportNumber,    **
+**                  char *buffer, int size)                            **
 **                                                                      **
 **  Where:                                                              **
 **  "yk" is handle to open Yubikey                                     **
@@ -65,7 +65,7 @@ static int hidSetReport(YUBIKEY yk, int reportType, int reportNumber, char *buff
 **                                                                      **
 *************************************************************************/
 
-static int hidGetReport(YUBIKEY yk, int reportType, int reportNumber, char *buffer, int size)
+static int hidGetReport(YUBIKEY *yk, int reportType, int reportNumber, char *buffer, int size)
 {
   int m = usb_claim_interface(yk, 0);
   printf ("m %d: %s\n", m, usb_strerror ());
@@ -101,7 +101,7 @@ int ykInit(void)
 **                                                                      **
 *************************************************************************/
 
-YUBIKEY ykOpen(void)
+YUBIKEY *ykOpen(void)
 {
        struct usb_bus *bus;
        struct usb_device *dev;
@@ -110,9 +110,10 @@ YUBIKEY ykOpen(void)
 
        for (bus = usb_get_busses(); bus; bus = bus->next)
                for (dev = bus->devices; dev; dev = dev->next)
-                       if (dev->descriptor.idVendor == YUBICO_VID && dev->descriptor.idProduct == YUBIKEY_PID) return usb_open(dev);
+                       if (dev->descriptor.idVendor == YUBICO_VID && dev->descriptor.idProduct == YUBIKEY_PID)
+                               return (YUBIKEY *) usb_open(dev);
 
-       return (YUBIKEY) 0;
+       return (YUBIKEY *) 0;
 }
 
 /*************************************************************************
@@ -143,7 +144,7 @@ void ykClose(YUBIKEY *yk)
 **                                                                      **
 *************************************************************************/
 
-int ykGetStatus(YUBIKEY yk, STATUS *status, int forceUpdate)
+int ykGetStatus(YUBIKEY *yk, STATUS *status, int forceUpdate)
 {
        unsigned char buf[FEATURE_RPT_SIZE];
 
index 26318855a4d8364c8603cc95a5ef054be5f03a0b..63c066001af9772bacde6669003e47ba99cf515a 100644 (file)
@@ -34,7 +34,7 @@
 typedef void YUBIKEY;\r
 \r
 extern int ykInit(void);\r
-extern YUBIKEY * ykOpen(void);\r
+extern YUBIKEY *ykOpen(void);\r
 extern void ykClose(YUBIKEY *);\r
 extern int ykGetStatus(YUBIKEY *, STATUS *, int);\r
 extern int ykWriteConfig(YUBIKEY *, CONFIG *, unsigned char *);\r