Fix for ack button driver and configuration.

This commit is contained in:
NIIBE Yutaka
2018-09-27 11:29:46 +09:00
parent 72647f01d0
commit ba750d153d
3 changed files with 34 additions and 2 deletions

View File

@@ -7,5 +7,6 @@
@PINPAD_MORE_DEFINE@
@CERTDO_DEFINE@
@HID_CARD_CHANGE_DEFINE@
@SERIALNO_STR_LEN_DEFINE@
@LIFE_CYCLE_MANAGEMENT_DEFINE@
@ACKBTN_DEFINE@
@SERIALNO_STR_LEN_DEFINE@

21
src/configure vendored
View File

@@ -44,6 +44,7 @@ pinpad=no
certdo=no
hid_card_change=no
factory_reset=no
ackbtn_support=no
flash_override=""
# For emulation
prefix=/usr/local
@@ -135,6 +136,7 @@ Configuration:
supported targets are:
FST_01
FST_01G
FST_01SZ
OLIMEX_STM32_H103
MAPLE_MINI
ST_DONGLE
@@ -198,9 +200,13 @@ STBEE)
if test "$with_dfu" = "default"; then
with_dfu=yes;
fi ;;
FST_01SZ|BLUE_PILL_G)
BLUE_PILL_G)
MHZ=96
;;
FST_01SZ)
MHZ=96
ackbtn_support=yes
;;
*)
;;
esac
@@ -313,6 +319,15 @@ else
echo "Life cycle management is NOT supported"
fi
# Acknowledge button support
if test "$ackbtn_support" = "yes"; then
ACKBTN_DEFINE="#define ACKBTN_SUPPORT 1"
echo "Acknowledge button is supported"
else
ACKBTN_DEFINE="#undef ACKBTN_SUPPORT"
echo "Acknowledge button is not supported"
fi
### !!! Replace following string of "FSIJ" to yours !!! ####
SERIALNO="FSIJ-$(sed -e 's%^[^/]*/%%' <../VERSION)-"
@@ -456,6 +471,9 @@ fi
echo "$PINPAD_MAKE_OPTION";
echo "ENABLE_FRAUCHEKY=$enable_fraucheky";
echo "ENABLE_OUTPUT_HEX=$enable_hexoutput"
if test "$ackbtn_support" = "yes"; then
echo "USE_ACKBTN=yes"
fi
if test "$emulation" = "yes"; then
echo "prefix=$prefix"
echo "exec_prefix=$exec_prefix"
@@ -483,6 +501,7 @@ sed -e "s/@DEBUG_DEFINE@/$DEBUG_DEFINE/" \
-e "s/@CERTDO_DEFINE@/$CERTDO_DEFINE/" \
-e "s/@HID_CARD_CHANGE_DEFINE@/$HID_CARD_CHANGE_DEFINE/" \
-e "s/@LIFE_CYCLE_MANAGEMENT_DEFINE@/$LIFE_CYCLE_MANAGEMENT_DEFINE/" \
-e "s/@ACKBTN_DEFINE@/$ACKBTN_DEFINE/" \
-e "s/@SERIALNO_STR_LEN_DEFINE@/$SERIALNO_STR_LEN_DEFINE/" \
< config.h.in > config.h
exit 0

View File

@@ -1565,7 +1565,9 @@ extern int usb_get_descriptor (struct usb_dev *dev);
extern void random_init (void);
extern void random_fini (void);
#ifdef ACKBTN_SUPPORT
static chopstx_intr_t ack_intr;
#endif
static chopstx_intr_t usb_intr;
/*
@@ -1683,7 +1685,9 @@ usb_event_handle (struct usb_dev *dev)
static chopstx_poll_cond_t ccid_event_poll_desc;
static struct chx_poll_head *const ccid_poll[] = {
#ifdef ACKBTN_SUPPORT
(struct chx_poll_head *const)&ack_intr,
#endif
(struct chx_poll_head *const)&usb_intr,
(struct chx_poll_head *const)&ccid_event_poll_desc
};
@@ -1706,7 +1710,9 @@ ccid_thread (void *arg)
chopstx_claim_irq (&usb_intr, INTR_REQ_USB);
usb_event_handle (&dev); /* For old SYS < 3.0 */
#ifdef ACKBTN_SUPPORT
ackbtn_init (&ack_intr);
#endif
eventflag_prepare_poll (&c->ccid_comm, &ccid_event_poll_desc);
reset:
@@ -1759,6 +1765,7 @@ ccid_thread (void *arg)
goto reset;
}
#ifdef ACKBTN_SUPPORT
if (ack_intr.ready)
{
ackbtn_disable ();
@@ -1767,6 +1774,7 @@ ccid_thread (void *arg)
if (c->ccid_state == CCID_STATE_CONFIRM_ACK)
goto exec_done;
}
#endif
timeout = USB_CCID_TIMEOUT;
m = eventflag_get (&c->ccid_comm);
@@ -1795,7 +1803,9 @@ ccid_thread (void *arg)
else if (m == EV_EXEC_FINISHED)
if (c->ccid_state == CCID_STATE_EXECUTE)
{
#ifdef ACKBTN_SUPPORT
exec_done:
#endif
if (c->a->sw == GPG_THREAD_TERMINATED)
{
c->sw1sw2[0] = 0x90;
@@ -1829,6 +1839,7 @@ ccid_thread (void *arg)
{
DEBUG_INFO ("ERR05\r\n");
}
#ifdef ACKBTN_SUPPORT
else if (m == EV_EXEC_FINISHED_ACK)
if (c->ccid_state == CCID_STATE_EXECUTE)
{
@@ -1839,6 +1850,7 @@ ccid_thread (void *arg)
{
DEBUG_INFO ("ERR06\r\n");
}
#endif
else if (m == EV_TX_FINISHED)
{
if (c->state == APDU_STATE_RESULT)