From: Richard Levitte Date: Thu, 18 Sep 2008 15:11:40 +0000 (+0000) Subject: Make the yubikey module consistent X-Git-Tag: yubikey-personalisation_1.3.5-1~4^2~216 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d119bed70b5a69914438519bec7c75db2f95a21;p=yubikey-personalization Make the yubikey module consistent --- diff --git a/common/yubikey.c b/common/yubikey.c index 8977038..4dc5456 100644 --- a/common/yubikey.c +++ b/common/yubikey.c @@ -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 ** @@ -41,18 +41,18 @@ ** ** *************************************************************************/ -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]; diff --git a/common/yubikey.h b/common/yubikey.h index 2631885..63c0660 100644 --- a/common/yubikey.h +++ b/common/yubikey.h @@ -34,7 +34,7 @@ typedef void YUBIKEY; extern int ykInit(void); -extern YUBIKEY * ykOpen(void); +extern YUBIKEY *ykOpen(void); extern void ykClose(YUBIKEY *); extern int ykGetStatus(YUBIKEY *, STATUS *, int); extern int ykWriteConfig(YUBIKEY *, CONFIG *, unsigned char *);