Changeset 1364
- Timestamp:
- 01/23/10 19:41:50 (14 years ago)
- Location:
- branches/smartreader
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/smartreader/Makefile
r1362 r1364 88 88 OS_CULI="-lncurses" \ 89 89 OS_PTLI="-lpthread" \ 90 DS_OPTS="-O2 -DOS_LINUX -DUSE_PTHREAD -DHAVE_LIBUSB -DCS_CONFDIR=${CS_CONFDIR} -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="\"$(SVN_REV)\""' " \91 DS_CFLAGS="-c `libusb-config --cflags`" \90 DS_OPTS="-O2 -DOS_LINUX -DUSE_PTHREAD -DHAVE_LIBUSB -DCS_CONFDIR=${CS_CONFDIR} -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="\"$(SVN_REV)\""' `libusb-config --cflags`" \ 91 DS_CFLAGS="-c" \ 92 92 DS_LDFLAGS="`libusb-config --libs`" \ 93 93 DS_ARFLAGS="-rvsl" \ … … 130 130 OS_CULI="-lncurses" \ 131 131 OS_PTLI="-lpthread -lpcsclite" \ 132 DS_OPTS="-O2 -DOS_LINUX -DUSE_PTHREAD -DHAVE_LIBUSB -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -I/usr/include/PCSC -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="\"$(SVN_REV)\""' " \133 DS_CFLAGS="-c `libusb-config --cflags`" \132 DS_OPTS="-O2 -DOS_LINUX -DUSE_PTHREAD -DHAVE_LIBUSB -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -I/usr/include/PCSC -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="\"$(SVN_REV)\""' `libusb-config --cflags`" \ 133 DS_CFLAGS="-c" \ 134 134 DS_LDFLAGS="`libusb-config --libs`" \ 135 135 DS_ARFLAGS="-rvsl" \ … … 172 172 OS_CULI="-lncurses" \ 173 173 OS_PTLI="-lpthread" \ 174 DS_OPTS="-O2 -DOS_MACOSX -DNEED_DAEMON -DCS_NOSHM -DHAVE_PTHREAD_H -DUSE_PTHREAD -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -DHAVE_LIBUSB -m32 -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="\"$(SVN_REV)\""' " \175 DS_CFLAGS="-c `libusb-config --cflags`" \174 DS_OPTS="-O2 -DOS_MACOSX -DNEED_DAEMON -DCS_NOSHM -DHAVE_PTHREAD_H -DUSE_PTHREAD -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -DHAVE_LIBUSB -m32 -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="\"$(SVN_REV)\""' `libusb-config --cflags`" \ 175 DS_CFLAGS="-c" \ 176 176 DS_LDFLAGS="-framework PCSC `libusb-config --libs`" \ 177 177 DS_ARFLAGS="-rvsl" \ -
branches/smartreader/csctapi/ct_slot.c
r1352 r1364 68 68 } 69 69 70 char CT_Slot_Init ( CT_Slot * slot, int sn)70 char CT_Slot_Init () 71 71 { 72 72 #if defined(HAVE_LIBUSB) && defined(USE_PTHREAD) -
branches/smartreader/csctapi/ftdi.c
r1144 r1364 87 87 int ftdi_init(struct ftdi_context *ftdi) 88 88 { 89 #ifdef LIBFTDI_LINUX_ASYNC_MODE 89 90 unsigned int i; 91 #endif 90 92 91 93 ftdi->usb_dev = NULL; … … 443 445 { 444 446 int detach_errno = 0; 447 #ifdef __WIN32__ 445 448 int config_val = 1; 449 #endif 446 450 if (!(ftdi->usb_dev = usb_open(dev))) 447 451 ftdi_error_return(-4, "usb_open() failed"); … … 1178 1182 write_size = size-offset; 1179 1183 1180 ret = usb_bulk_write(ftdi->usb_dev, ftdi->in_ep, buf+offset, write_size, ftdi->usb_write_timeout);1184 ret = usb_bulk_write(ftdi->usb_dev, ftdi->in_ep, (char *)buf+offset, write_size, ftdi->usb_write_timeout); 1181 1185 if (ret < 0) 1182 1186 ftdi_error_return(ret, "usb bulk write failed"); … … 1456 1460 1457 1461 // everything we want is still in the readbuffer? 1458 if ( size <= ftdi->readbuffer_remaining)1462 if ((unsigned int)size <= ftdi->readbuffer_remaining) 1459 1463 { 1460 1464 memcpy (buf, ftdi->readbuffer+ftdi->readbuffer_offset, size); … … 1482 1486 ftdi->readbuffer_offset = 0; 1483 1487 /* returns how much received */ 1484 ret = usb_bulk_read (ftdi->usb_dev, ftdi->out_ep, ftdi->readbuffer, ftdi->readbuffer_chunksize, ftdi->usb_read_timeout);1488 ret = usb_bulk_read (ftdi->usb_dev, ftdi->out_ep, (char *)ftdi->readbuffer, ftdi->readbuffer_chunksize, ftdi->usb_read_timeout); 1485 1489 if (ret < 0) 1486 1490 ftdi_error_return(ret, "usb bulk read failed"); … … 2175 2179 unsigned short checksum, eeprom_checksum, value; 2176 2180 unsigned char manufacturer_size = 0, product_size = 0, serial_size = 0; 2177 int size_check;2178 2181 int eeprom_size = 128; 2179 #if 0 2180 size_check = eeprom->size; 2181 size_check -= 28; // 28 are always in use (fixed) 2182 2183 // Top half of a 256byte eeprom is used just for strings and checksum 2184 // it seems that the FTDI chip will not read these strings from the lower half 2185 // Each string starts with two bytes; offset and type (0x03 for string) 2186 // the checksum needs two bytes, so without the string data that 8 bytes from the top half 2187 if (eeprom->size>=256)size_check = 120; 2188 size_check -= manufacturer_size*2; 2189 size_check -= product_size*2; 2190 size_check -= serial_size*2; 2191 2192 // eeprom size exceeded? 2193 if (size_check < 0) 2194 return (-1); 2195 #endif 2196 2182 2183 if(!size) 2184 return -1; 2185 2197 2186 // empty eeprom struct 2198 2187 memset(eeprom, 0, sizeof(struct ftdi_eeprom)); … … 2356 2345 for (i = 0; i < ftdi->eeprom_size/2; i++) 2357 2346 { 2358 if (usb_control_msg(ftdi->usb_dev, FTDI_DEVICE_IN_REQTYPE, SIO_READ_EEPROM_REQUEST, 0, i, eeprom+(i*2), 2, ftdi->usb_read_timeout) != 2)2347 if (usb_control_msg(ftdi->usb_dev, FTDI_DEVICE_IN_REQTYPE, SIO_READ_EEPROM_REQUEST, 0, i, (char *)eeprom+(i*2), 2, ftdi->usb_read_timeout) != 2) 2359 2348 ftdi_error_return(-1, "reading eeprom failed"); 2360 2349 } … … 2431 2420 if (usb_control_msg(ftdi->usb_dev, FTDI_DEVICE_IN_REQTYPE, 2432 2421 SIO_READ_EEPROM_REQUEST, 0, i, 2433 eeprom+(i*2), 2, ftdi->usb_read_timeout) != 2)2422 (char *)eeprom+(i*2), 2, ftdi->usb_read_timeout) != 2) 2434 2423 ftdi_error_return(-1, "reading eeprom failed"); 2435 2424 i++; -
branches/smartreader/csctapi/ifd_smartreader.c
r1363 r1364 12 12 #define OK 1 13 13 #define ERROR 0 14 #define LOBYTE(w) ((BYTE)((w) & 0xff)) 15 #define HIBYTE(w) ((BYTE)((w) >> 8)) 16 static struct usb_device * find_smartreader(int index, struct ftdi_context* ftdic); 17 static void smart_flush(struct s_reader *reader); 18 static unsigned int smart_read(struct s_reader *reader, unsigned char* buff, size_t size, int timeout_sec); 19 static unsigned int smart_write(struct s_reader *reader, unsigned char* buff, size_t size, int udelay); 20 static void EnableSmartReader(struct s_reader *reader, int clock, unsigned short Fi, unsigned char Di, unsigned char Ni, unsigned char T,unsigned char inv); 21 static void ResetSmartReader(struct s_reader *reader); 22 static void* ReaderThread(void *p); 23 static bool smartreader_check_endpoint(struct usb_device *dev); 24 25 #ifdef DEBUG_IO 26 static void sr_hexdump(const unsigned char* data, size_t size, bool single); 27 #endif 28 14 29 15 30 int SR_Init (struct s_reader *reader, int device_index) … … 486 501 static void sr_hexdump(const unsigned char* data, size_t size, bool single) 487 502 { 488 int idx;489 int i;503 unsigned int idx; 504 unsigned int i; 490 505 char buffer[512]; 491 506 -
branches/smartreader/csctapi/ifd_smartreader.h
r1356 r1364 23 23 24 24 25 #define LOBYTE(w) ((BYTE)((w) & 0xff))26 #define HIBYTE(w) ((BYTE)((w) >> 8))27 28 29 25 int SR_Init (struct s_reader *reader,int device_index); 30 26 int SR_GetStatus (struct s_reader *reader,int * in); … … 34 30 int SR_SetBaudrate (struct s_reader *reader); 35 31 36 // bool find_smartreader(int index, struct ftdi_context* ftdic,struct usb_device *dev);37 static struct usb_device * find_smartreader(int index, struct ftdi_context* ftdic);38 static void smart_flush(struct s_reader *reader);39 static unsigned int smart_read(struct s_reader *reader, unsigned char* buff, size_t size, int timeout_sec);40 static unsigned int smart_write(struct s_reader *reader, unsigned char* buff, size_t size, int udelay);41 static void EnableSmartReader(struct s_reader *reader, int clock, unsigned short Fi, unsigned char Di, unsigned char Ni, unsigned char T,unsigned char inv);42 static void ResetSmartReader(struct s_reader *reader);43 static void* ReaderThread(void *p);44 static bool smartreader_check_endpoint(struct usb_device *dev);45 46 #ifdef DEBUG_IO47 static void sr_hexdump(const unsigned char* data, size_t size, bool single);48 #endif49 32 50 33 #endif // __SMARTREADER__ -
branches/smartreader/csctapi/pps.c
r1352 r1364 309 309 int ret; 310 310 #ifdef DEBUG_PROTOCOL 311 int i;311 unsigned int i; 312 312 #endif 313 313
Note:
See TracChangeset
for help on using the changeset viewer.