diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-11-26 12:00:42 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-11-26 12:01:43 +0100 |
commit | ba19605333a314d8c285972d165e83f4602b1877 (patch) | |
tree | 07a8f28c63b043d26c217b3ae25b162fd95b915e /libk8055 | |
parent | 53cabad7a225b3607e6920fff50c24016ceec1f5 (diff) | |
download | k8055-ba19605333a314d8c285972d165e83f4602b1877.zip k8055-ba19605333a314d8c285972d165e83f4602b1877.tar.gz |
support PVM110 cards
Diffstat (limited to 'libk8055')
-rw-r--r-- | libk8055/libk8055.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c index cea2587..23645c9 100644 --- a/libk8055/libk8055.c +++ b/libk8055/libk8055.c @@ -122,8 +122,12 @@ void k8055_free( struct k8055_dev* dev ) { int k8055_read( struct k8055_dev* dev ) { if( dev->dev_no==0 ) return K8055_ERROR; int length; + int r, n; for( int i=0; i<READ_RETRY; i++ ) { - if( libusb_interrupt_transfer( dev->usb_handle, USB_INP_EP, dev->data_in, PACKET_LEN, &length, USB_TIMEOUT )==0 && ( length==PACKET_LEN ) && ( dev->data_in[1]==dev->dev_no ) ) return 0; + r = libusb_interrupt_transfer(dev->usb_handle, USB_INP_EP, dev->data_in, PACKET_LEN, &length, USB_TIMEOUT); + n = dev->data_in[1] & 0xf; + if (n > 4) n -= 10; + if (r==0 && ( length==PACKET_LEN ) && ( n==dev->dev_no ) ) return 0; if( dev->debug_level>0 ) fprintf( stderr, "k8055 read retry\n" ); } return K8055_ERROR; |