From 357bffe243e8cd482fc45eb173681561235db9e1 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 29 Oct 2013 16:05:19 +0900 Subject: [PATCH] INTERRUPT pipe implemented --- src/usb-icc.c | 20 ++++++++++++++++---- src/usb_desc.c | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/usb-icc.c b/src/usb-icc.c index 58d061e..42c5a36 100644 --- a/src/usb-icc.c +++ b/src/usb-icc.c @@ -633,7 +633,6 @@ icc_prepare_receive (struct ccid *c) /* * Rx ready callback */ - void EP1_OUT_Callback (void) { @@ -1297,9 +1296,17 @@ icc_handle_timeout (struct ccid *c) return next_state; } -#define USB_ICC_TIMEOUT (1950*1000) +/* + * Another Tx done callback + */ +void +EP2_IN_Callback (void) +{ +} +#define USB_ICC_TIMEOUT (1950*1000) + static struct ccid ccid; #define GPG_THREAD_TERMINATED 0xffff @@ -1350,11 +1357,15 @@ ccid_thread (chopstx_t thd) { if (card_change_requested) { + uint8_t notify_slot_change[2] = { 0x50, 0x02 }; + led_blink (LED_TWOSHOTS); if (c->icc_state == ICC_STATE_NOCARD) - /* Inserted! */ - c->icc_state = ICC_STATE_START; + { /* Inserted! */ + c->icc_state = ICC_STATE_START; + notify_slot_change[1] |= 1; + } else { if (c->application) @@ -1368,6 +1379,7 @@ ccid_thread (chopstx_t thd) } card_change_requested = 0; + usb_lld_write (ENDP2, notify_slot_change, 2); } else card_change_requested = 1; diff --git a/src/usb_desc.c b/src/usb_desc.c index e0d250b..f344c1f 100644 --- a/src/usb_desc.c +++ b/src/usb_desc.c @@ -203,7 +203,7 @@ static const uint8_t gnukConfigDescriptor[] = { 0x82, /* bEndpointAddress: (IN2) */ 0x03, /* bmAttributes: Interrupt */ 4, 0x00, /* wMaxPacketSize: */ - 0x20, /* bInterval (32ms) */ + 0xFF, /* bInterval (255ms) */ /* Interface Descriptor */ 9, /* bLength: Interface Descriptor size */