mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-22 13:21:03 +00:00
fix(core): consider device in USB suspend connected if it was configured before
[no changelog]
This commit is contained in:
parent
a20783731a
commit
77cdf4b43c
@ -153,11 +153,19 @@ void usb_start(void) { USBD_Start(&usb_dev_handle); }
|
|||||||
void usb_stop(void) { USBD_Stop(&usb_dev_handle); }
|
void usb_stop(void) { USBD_Stop(&usb_dev_handle); }
|
||||||
|
|
||||||
secbool usb_configured(void) {
|
secbool usb_configured(void) {
|
||||||
USBD_HandleTypeDef *pdev = &usb_dev_handle;
|
const USBD_HandleTypeDef *pdev = &usb_dev_handle;
|
||||||
if (pdev->dev_state == USBD_STATE_CONFIGURED) {
|
if (pdev->dev_state == USBD_STATE_CONFIGURED) {
|
||||||
return sectrue;
|
return sectrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Linux has autosuspend device after 2 seconds by default.
|
||||||
|
// So a suspended device that was seen as configured is reported as
|
||||||
|
// configured.
|
||||||
|
if (pdev->dev_state == USBD_STATE_SUSPENDED &&
|
||||||
|
pdev->dev_old_state == USBD_STATE_CONFIGURED) {
|
||||||
|
return sectrue;
|
||||||
|
}
|
||||||
|
|
||||||
return secfalse;
|
return secfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user