[Pcsclite-cvs-commit] Drivers/ccid/src ccid.c,1.7,1.8 ccid.h,1.7,1.8 ccid_ifdhandler.h,1.9,1.10 ccid_serial.c,1.13,1.14 ccid_serial.h,1.4,1.5 ccid_usb.c,1.26,1.27 ccid_usb.h,1.8,1.9 commands.c,1.20,1.21 commands.h,1.8,1.9 ifdhandler.c,1.34,1.35
rousseau@haydn.debian.org
rousseau@haydn.debian.org
Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv11302
Modified Files:
ccid.c ccid.h ccid_ifdhandler.h ccid_serial.c ccid_serial.h
ccid_usb.c ccid_usb.h commands.c commands.h ifdhandler.c
Log Message:
lun is (unsigned int) instead of (int)
Avoid a warning by splint in #define LunToReaderIndex(Lun) (Lun>>16)
Left operand of >> may be negative (int): lun >> 16
Index: ccid.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ccid.c 30 Jun 2004 09:43:45 -0000 1.7
+++ ccid.c 9 Jul 2004 07:10:17 -0000 1.8
@@ -37,7 +37,7 @@
* ccid_open_hack
*
****************************************************************************/
-int ccid_open_hack(int lun)
+int ccid_open_hack(unsigned int lun)
{
_ccid_descriptor *ccid_descriptor = get_ccid_descriptor(lun);
Index: ccid.h
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ccid.h 30 Jun 2004 09:43:45 -0000 1.7
+++ ccid.h 9 Jul 2004 07:10:17 -0000 1.8
@@ -96,9 +96,9 @@
#define ESC_GEMPC_SET_APDU_MODE 2
-int ccid_open_hack(int lun);
+int ccid_open_hack(unsigned int lun);
void ccid_error(int error, char *file, int line, char *function);
-_ccid_descriptor *get_ccid_descriptor(int lun);
+_ccid_descriptor *get_ccid_descriptor(unsigned int lun);
/* convert a 4 byte integer in USB format into an int */
#define dw2i(a, x) ((((((a[x+3] << 8) + a[x+2]) << 8) + a[x+1]) << 8) + a[x])
Index: ccid_ifdhandler.h
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid_ifdhandler.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ccid_ifdhandler.h 24 May 2004 10:02:48 -0000 1.9
+++ ccid_ifdhandler.h 9 Jul 2004 07:10:17 -0000 1.10
@@ -45,7 +45,7 @@
/*
* CCID driver specific functions
*/
-CcidDesc *get_ccid_slot(int lun);
+CcidDesc *get_ccid_slot(unsigned int lun);
#endif
Index: ccid_serial.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid_serial.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- ccid_serial.c 2 Jul 2004 13:58:11 -0000 1.13
+++ ccid_serial.c 9 Jul 2004 07:10:17 -0000 1.14
@@ -142,7 +142,7 @@
* WriteSerial: Send bytes to the card reader
*
*****************************************************************************/
-status_t WriteSerial(int lun, unsigned int length, unsigned char *buffer)
+status_t WriteSerial(unsigned int lun, unsigned int length, unsigned char *buffer)
{
int i;
unsigned char lrc;
@@ -151,7 +151,7 @@
#ifdef DEBUG_LEVEL_COMM
char debug_header[] = "-> 121234 ";
- sprintf(debug_header, "-> %06X ", (int)lun);
+ sprintf(debug_header, "-> %06X ", lun);
#endif
if (length > GEMPCTWIN_MAXBUF-3)
@@ -194,7 +194,7 @@
* ReadSerial: Receive bytes from the card reader
*
*****************************************************************************/
-status_t ReadSerial(int lun, unsigned int *length, unsigned char *buffer)
+status_t ReadSerial(unsigned int lun, unsigned int *length, unsigned char *buffer)
{
unsigned char c;
int rv;
@@ -316,7 +316,7 @@
* get_bytes: get n bytes
*
*****************************************************************************/
-int get_bytes(int lun, unsigned char *buffer, int length)
+int get_bytes(unsigned int lun, unsigned char *buffer, int length)
{
int offset = serialDevice[LunToReaderIndex(lun)].buffer_offset;
int offset_last = serialDevice[LunToReaderIndex(lun)].buffer_offset_last;
@@ -369,7 +369,7 @@
* ReadChunk: read a minimum number of bytes
*
*****************************************************************************/
-int ReadChunk(int lun, unsigned char *buffer, int buffer_length, int min_length)
+int ReadChunk(unsigned int lun, unsigned char *buffer, int buffer_length, int min_length)
{
int fd = serialDevice[LunToReaderIndex(lun)].fd;
fd_set fdset;
@@ -429,7 +429,7 @@
* OpenSerial: open the port
*
*****************************************************************************/
-status_t OpenSerial(int lun, int channel)
+status_t OpenSerial(unsigned int lun, int channel)
{
char dev_name[FILENAME_MAX];
@@ -466,7 +466,7 @@
* OpenSerialByName: open the port
*
*****************************************************************************/
-status_t OpenSerialByName(int lun, char *dev_name)
+status_t OpenSerialByName(unsigned int lun, char *dev_name)
{
struct termios current_termios;
int i;
@@ -576,7 +576,7 @@
* CloseSerial: close the port
*
*****************************************************************************/
-status_t CloseSerial(int lun)
+status_t CloseSerial(unsigned int lun)
{
int reader = LunToReaderIndex(lun);
@@ -595,7 +595,7 @@
* get_ccid_descriptor
*
****************************************************************************/
-_ccid_descriptor *get_ccid_descriptor(int lun)
+_ccid_descriptor *get_ccid_descriptor(unsigned int lun)
{
return &serialDevice[LunToReaderIndex(lun)].ccid;
} /* get_ccid_descriptor */
Index: ccid_serial.h
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid_serial.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ccid_serial.h 24 May 2004 12:58:43 -0000 1.4
+++ ccid_serial.h 9 Jul 2004 07:10:17 -0000 1.5
@@ -21,11 +21,20 @@
* $Id$
*/
-status_t OpenSerial(int lun, int channel);
-status_t OpenSerialByName(int lun, char *dev_name);
-status_t WriteSerial(int lun, unsigned int length, unsigned char *Buffer);
-status_t ReadSerial(int lun, unsigned int *length, unsigned char *Buffer);
-int get_bytes(int lun, unsigned char *buffer, int length);
-int ReadChunk(int lun, unsigned char *buffer, int buffer_length, int min_length);
-status_t CloseSerial(int lun);
+status_t OpenSerial(unsigned int lun, int channel);
+
+status_t OpenSerialByName(unsigned int lun, char *dev_name);
+
+status_t WriteSerial(unsigned int lun, unsigned int length, unsigned char
+ *Buffer);
+
+status_t ReadSerial(unsigned int lun, unsigned int *length, unsigned char
+ *Buffer);
+
+int get_bytes(unsigned int lun, unsigned char *buffer, int length);
+
+int ReadChunk(unsigned int lun, unsigned char *buffer, int buffer_length, int
+ min_length);
+
+status_t CloseSerial(unsigned int lun);
Index: ccid_usb.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid_usb.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- ccid_usb.c 25 May 2004 14:46:02 -0000 1.26
+++ ccid_usb.c 9 Jul 2004 07:10:17 -0000 1.27
@@ -93,7 +93,7 @@
* OpenUSB
*
****************************************************************************/
-status_t OpenUSB(int lun, int Channel)
+status_t OpenUSB(unsigned int lun, int Channel)
{
return OpenUSBByName(lun, NULL);
} /* OpenUSB */
@@ -104,7 +104,7 @@
* OpenUSBByName
*
****************************************************************************/
-status_t OpenUSBByName(int lun, char *device)
+status_t OpenUSBByName(unsigned int lun, char *device)
{
static struct usb_bus *busses = NULL;
int reader = LunToReaderIndex(lun);
@@ -366,7 +366,7 @@
* WriteUSB
*
****************************************************************************/
-status_t WriteUSB(int lun, unsigned int length, unsigned char *buffer)
+status_t WriteUSB(unsigned int lun, unsigned int length, unsigned char *buffer)
{
int rv;
int reader = LunToReaderIndex(lun);
@@ -400,7 +400,7 @@
* ReadUSB
*
****************************************************************************/
-status_t ReadUSB(int lun, unsigned int * length, unsigned char *buffer)
+status_t ReadUSB(unsigned int lun, unsigned int * length, unsigned char *buffer)
{
int rv;
int reader = LunToReaderIndex(lun);
@@ -437,7 +437,7 @@
* CloseUSB
*
****************************************************************************/
-status_t CloseUSB(int lun)
+status_t CloseUSB(unsigned int lun)
{
struct usb_interface *usb_interface;
int interface;
@@ -474,7 +474,7 @@
* get_ccid_descriptor
*
****************************************************************************/
-_ccid_descriptor *get_ccid_descriptor(int lun)
+_ccid_descriptor *get_ccid_descriptor(unsigned int lun)
{
return &usbDevice[LunToReaderIndex(lun)].ccid;
} /* get_ccid_descriptor */
Index: ccid_usb.h
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid_usb.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ccid_usb.h 24 May 2004 12:58:43 -0000 1.8
+++ ccid_usb.h 9 Jul 2004 07:10:17 -0000 1.9
@@ -21,14 +21,19 @@
* $Id$
*/
-status_t OpenUSB(int lun, int channel);
-status_t OpenUSBByName(int lun, char *device);
-status_t WriteUSB(int lun, unsigned int length, unsigned char *Buffer);
-status_t ReadUSB(int lun, unsigned int *length, unsigned char *Buffer);
-status_t CloseUSB(int lun);
+status_t OpenUSB(unsigned int lun, int channel);
+
+status_t OpenUSBByName(unsigned int lun, char *device);
+
+status_t WriteUSB(unsigned int lun, unsigned int length, unsigned char *Buffer);
+
+status_t ReadUSB(unsigned int lun, unsigned int *length, unsigned char *Buffer);
+
+status_t CloseUSB(unsigned int lun);
#ifdef __USB_H__
int get_desc(int channel, usb_dev_handle **handle, struct usb_device **dev);
+
struct usb_interface *get_ccid_usb_interface(struct usb_device *dev);
#endif
Index: commands.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/commands.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- commands.c 30 Jun 2004 13:25:03 -0000 1.20
+++ commands.c 9 Jul 2004 07:10:17 -0000 1.21
@@ -52,7 +52,8 @@
* CmdPowerOn
*
****************************************************************************/
-RESPONSECODE CmdPowerOn(int lun, unsigned int * nlength, unsigned char buffer[])
+RESPONSECODE CmdPowerOn(unsigned int lun, unsigned int * nlength,
+ unsigned char buffer[])
{
unsigned char cmd[10];
status_t res;
@@ -140,7 +141,7 @@
* SecurePIN
*
****************************************************************************/
-RESPONSECODE SecurePIN(int lun, const unsigned char TxBuffer[],
+RESPONSECODE SecurePIN(unsigned int lun, const unsigned char TxBuffer[],
unsigned int TxLength, unsigned char RxBuffer[], unsigned int *RxLength)
{
unsigned char cmd[11+14+CMD_BUF_SIZE];
@@ -206,7 +207,7 @@
* Escape
*
****************************************************************************/
-RESPONSECODE CmdEscape(int lun, const unsigned char TxBuffer[],
+RESPONSECODE CmdEscape(unsigned int lun, const unsigned char TxBuffer[],
unsigned int TxLength, unsigned char RxBuffer[], unsigned int *RxLength)
{
unsigned char *cmd_in, *cmd_out;
@@ -275,7 +276,7 @@
* CmdPowerOff
*
****************************************************************************/
-RESPONSECODE CmdPowerOff(int lun)
+RESPONSECODE CmdPowerOff(unsigned int lun)
{
unsigned char cmd[10];
status_t res;
@@ -313,7 +314,7 @@
* CmdGetSlotStatus
*
****************************************************************************/
-RESPONSECODE CmdGetSlotStatus(int lun, unsigned char buffer[])
+RESPONSECODE CmdGetSlotStatus(unsigned int lun, unsigned char buffer[])
{
unsigned char cmd[10];
status_t res;
@@ -351,7 +352,7 @@
* CmdXfrBlock
*
****************************************************************************/
-RESPONSECODE CmdXfrBlock(int lun, unsigned int tx_length,
+RESPONSECODE CmdXfrBlock(unsigned int lun, unsigned int tx_length,
unsigned char tx_buffer[], unsigned int *rx_length,
unsigned char rx_buffer[], int protocol)
{
@@ -414,7 +415,7 @@
* CCID_Transmit
*
****************************************************************************/
-RESPONSECODE CCID_Transmit(int lun, unsigned int tx_length,
+RESPONSECODE CCID_Transmit(unsigned int lun, unsigned int tx_length,
const unsigned char tx_buffer[], unsigned char bBWI)
{
unsigned char cmd[10+CMD_BUF_SIZE]; /* CCID + APDU buffer */
@@ -440,7 +441,7 @@
* CCID_Receive
*
****************************************************************************/
-RESPONSECODE CCID_Receive(int lun, unsigned int *rx_length,
+RESPONSECODE CCID_Receive(unsigned int lun, unsigned int *rx_length,
unsigned char rx_buffer[])
{
unsigned char cmd[10+CMD_BUF_SIZE]; /* CCID + APDU buffer */
@@ -486,7 +487,7 @@
* CmdXfrBlockTPDU_T0
*
****************************************************************************/
-RESPONSECODE CmdXfrBlockTPDU_T0(int lun, unsigned int tx_length,
+RESPONSECODE CmdXfrBlockTPDU_T0(unsigned int lun, unsigned int tx_length,
unsigned char tx_buffer[], unsigned int *rx_length,
unsigned char rx_buffer[])
{
@@ -507,7 +508,7 @@
* CmdXfrBlockTPDU_T1
*
****************************************************************************/
-RESPONSECODE CmdXfrBlockTPDU_T1(int lun, unsigned int tx_length,
+RESPONSECODE CmdXfrBlockTPDU_T1(unsigned int lun, unsigned int tx_length,
unsigned char tx_buffer[], unsigned int *rx_length,
unsigned char rx_buffer[])
{
@@ -532,7 +533,7 @@
* SetParameters
*
****************************************************************************/
-RESPONSECODE SetParameters(int lun, char protocol, unsigned int length,
+RESPONSECODE SetParameters(unsigned int lun, char protocol, unsigned int length,
unsigned char buffer[])
{
unsigned char cmd[10+CMD_BUF_SIZE]; /* CCID + APDU buffer */
Index: commands.h
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/commands.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- commands.h 30 Jun 2004 13:21:18 -0000 1.8
+++ commands.h 9 Jul 2004 07:10:17 -0000 1.9
@@ -25,28 +25,38 @@
#define STATUS_OFFSET 7
#define ERROR_OFFSET 8
-RESPONSECODE CmdPowerOn(int lun, unsigned int * nlength,
+RESPONSECODE CmdPowerOn(unsigned int lun, unsigned int * nlength,
unsigned char buffer[]);
-RESPONSECODE SecurePIN(int lun, const unsigned char TxBuffer[],
+
+RESPONSECODE SecurePIN(unsigned int lun, const unsigned char TxBuffer[],
unsigned int TxLength, unsigned char RxBuffer[], unsigned int *RxLength);
-RESPONSECODE CmdEscape(int lun, const unsigned char TxBuffer[],
+
+RESPONSECODE CmdEscape(unsigned int lun, const unsigned char TxBuffer[],
unsigned int TxLength, unsigned char RxBuffer[], unsigned int *RxLength);
-RESPONSECODE CmdPowerOff(int lun);
-RESPONSECODE CmdGetSlotStatus(int lun, unsigned char buffer[]);
-RESPONSECODE CmdXfrBlock(int lun, unsigned int tx_length,
+
+RESPONSECODE CmdPowerOff(unsigned int lun);
+
+RESPONSECODE CmdGetSlotStatus(unsigned int lun, unsigned char buffer[]);
+
+RESPONSECODE CmdXfrBlock(unsigned int lun, unsigned int tx_length,
unsigned char tx_buffer[], unsigned int *rx_length,
unsigned char rx_buffer[], int protoccol);
-RESPONSECODE CCID_Transmit(int lun, unsigned int tx_length,
+
+RESPONSECODE CCID_Transmit(unsigned int lun, unsigned int tx_length,
const unsigned char tx_buffer[], unsigned char bBWI);
-RESPONSECODE CCID_Receive(int lun, unsigned int *rx_length,
+
+RESPONSECODE CCID_Receive(unsigned int lun, unsigned int *rx_length,
unsigned char rx_buffer[]);
-RESPONSECODE CmdXfrBlockTPDU_T0(int lun, unsigned int tx_length,
+
+RESPONSECODE CmdXfrBlockTPDU_T0(unsigned int lun, unsigned int tx_length,
unsigned char tx_buffer[], unsigned int *rx_length,
unsigned char rx_buffer[]);
-RESPONSECODE CmdXfrBlockTPDU_T1(int lun, unsigned int tx_length,
+
+RESPONSECODE CmdXfrBlockTPDU_T1(unsigned int lun, unsigned int tx_length,
unsigned char tx_buffer[], unsigned int *rx_length,
unsigned char rx_buffer[]);
-RESPONSECODE SetParameters(int lun, char protocol, unsigned int length,
+
+RESPONSECODE SetParameters(unsigned int lun, char protocol, unsigned int length,
unsigned char buffer[]);
void i2dw(int value, unsigned char *buffer);
Index: ifdhandler.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ifdhandler.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- ifdhandler.c 30 Jun 2004 13:42:23 -0000 1.34
+++ ifdhandler.c 9 Jul 2004 07:10:17 -0000 1.35
@@ -886,7 +886,7 @@
} /* IFDHICCPresence */
-CcidDesc *get_ccid_slot(int lun)
+CcidDesc *get_ccid_slot(unsigned int lun)
{
return &CcidSlots[LunToReaderIndex(lun)];
} /* get_ccid_slot */