Skip to content

Commit 147023e

Browse files
committed
pbio/drv/usb: Callback on cable unplugged.
This lets the UI know about connection changes when physically unplugged, not just when we cleanly unsubscribe.
1 parent 5f3d124 commit 147023e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/pbio/drv/usb/usb.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ static pbio_error_t pbdrv_usb_process_thread(pbio_os_state_t *state, void *conte
280280

281281
for (;;) {
282282

283+
if (pbdrv_usb_host_connection_changed_callback) {
284+
pbdrv_usb_host_connection_changed_callback();
285+
}
286+
283287
// Run charger detection: wait for USB to become physically plugged in.
284288
PBIO_OS_AWAIT(state, &sub, err = pbdrv_usb_wait_until_configured(&sub));
285289

0 commit comments

Comments
 (0)