Minor fixes for usb-ccid.c.
authorNIIBE Yutaka <gniibe@fsij.org>
Fri, 9 Nov 2018 06:23:33 +0000 (15:23 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Fri, 9 Nov 2018 06:23:33 +0000 (15:23 +0900)
ChangeLog
src/usb-ccid.c

index e390b57..553002a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-11-09  NIIBE Yutaka  <gniibe@fsij.org>
 
+       * src/usb-ccid.c (ccid_handle_data): Set c->state for pinpad input.
+       (ccid_send_data_block_internal): Fix the case of len == 0.
+
        * src/main.c (display_status_code): There is
        no case where ccid_state == CCID_STATE_RECEIVE.
        * src/gnuk.h (CCID_STATE_RECEIVE): Remove.
index 3f947e6..2fdbeb9 100644 (file)
@@ -986,6 +986,9 @@ ccid_send_data_block_internal (struct ccid *c, uint8_t status, uint8_t error)
 #endif
   if (len == 0)
     {
+      c->epi->buf = NULL;
+      c->epi->tx_done = 1;
+
 #ifdef GNU_LINUX_EMULATION
       usb_lld_tx_enable_buf (c->epi->ep_num, endp1_tx_buf,
                             CCID_MSG_HEADER_SIZE);
@@ -1418,6 +1421,7 @@ ccid_handle_data (struct ccid *c)
              c->a->res_apdu_data_len = 0;
              c->a->res_apdu_data = &c->p[5];
 
+             c->state = APDU_STATE_COMMAND_RECEIVED;
              eventflag_signal (&c->openpgp_comm, EV_VERIFY_CMD_AVAILABLE);
              next_state = CCID_STATE_EXECUTE;
            }
@@ -1452,6 +1456,7 @@ ccid_handle_data (struct ccid *c)
              c->a->res_apdu_data_len = 0;
              c->a->res_apdu_data = &ccid_buffer[5];
 
+             c->state = APDU_STATE_COMMAND_RECEIVED;
              eventflag_signal (&c->openpgp_comm, EV_MODIFY_CMD_AVAILABLE);
              next_state = CCID_STATE_EXECUTE;
            }