From f4b36b7503295dae08868fca69c5e2f266f0f2a0 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 15 Nov 2017 10:59:55 +0900 Subject: [PATCH] Lower power consumption on suspend. --- ChangeLog | 6 ++++++ chopstx | 2 +- src/usb-ccid.c | 7 +++++-- src/usb_ctrl.c | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d68cbe..f677777 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-11-15 NIIBE Yutaka + + * src/usb-ccid.c (usb_event_handle): Allow sleep on suspend. + + * src/usb_ctrl.c (usb_device_reset): Fix device state. + 2017-11-14 NIIBE Yutaka * src/usb-ccid.c (ccid_usb_reset): Remove diff --git a/chopstx b/chopstx index 5ac8a1f..bbe09de 160000 --- a/chopstx +++ b/chopstx @@ -1 +1 @@ -Subproject commit 5ac8a1f251fecb24acb43953f7d4b0c38b2cc572 +Subproject commit bbe09de209d0bafd1b9a089b328e7e64ff9bbe2f diff --git a/src/usb-ccid.c b/src/usb-ccid.c index 1b05860..471cea1 100644 --- a/src/usb-ccid.c +++ b/src/usb-ccid.c @@ -1648,10 +1648,12 @@ usb_event_handle (struct usb_dev *dev) break; case USB_EVENT_DEVICE_SUSPEND: + chopstx_conf_idle (1); bDeviceState |= USB_DEVICE_STATE_SUSPEND; break; case USB_EVENT_DEVICE_WAKEUP: + chopstx_conf_idle (0); bDeviceState &= ~USB_DEVICE_STATE_SUSPEND; break; @@ -1731,8 +1733,9 @@ ccid_thread (void *arg) /* RESET handling: * (1) After DEVICE_RESET, it needs to re-start out of the loop. - * (2) After SET_INTERFACE, the endpoint is reset to RX_NAK. - * It needs to prepare receive again. + * (2) After SET_CONFIGURATION or SET_INTERFACE, the + * endpoint is reset to RX_NAK. It needs to prepare + * receive again. */ if (c->application) { diff --git a/src/usb_ctrl.c b/src/usb_ctrl.c index 3be3242..496873a 100644 --- a/src/usb_ctrl.c +++ b/src/usb_ctrl.c @@ -218,7 +218,7 @@ usb_device_reset (struct usb_dev *dev) for (i = 0; i < NUM_INTERFACES; i++) gnuk_setup_endpoints_for_interface (dev, i, 1); - bDeviceState = USB_DEVICE_STATE_ATTACHED; + bDeviceState = USB_DEVICE_STATE_DEFAULT; } #define USB_CCID_REQ_ABORT 0x01