summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2020-11-22 19:10:09 -0500
committerDan Halbert <halbert@halwitz.org>2020-11-22 19:10:09 -0500
commita0f1ec3c4a3dd52b11752e10d0dd31202e9c705f (patch)
tree333234f72abc302da7646f87a3c18740170b6bf7 /supervisor
parent75559f35ccc946dfd292e25671919e5d5b3bd7a6 (diff)
wip
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/shared/usb/usb.c4
-rw-r--r--supervisor/shared/workflow.c8
2 files changed, 4 insertions, 8 deletions
diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c
index 3d76e7000..ff08ade18 100644
--- a/supervisor/shared/usb/usb.c
+++ b/supervisor/shared/usb/usb.c
@@ -106,25 +106,21 @@ void usb_irq_handler(void) {
// Invoked when device is mounted
void tud_mount_cb(void) {
usb_msc_mount();
- _workflow_active = true;
}
// Invoked when device is unmounted
void tud_umount_cb(void) {
usb_msc_umount();
- _workflow_active = false;
}
// Invoked when usb bus is suspended
// remote_wakeup_en : if host allows us to perform remote wakeup
// USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus
void tud_suspend_cb(bool remote_wakeup_en) {
- _workflow_active = false;
}
// Invoked when usb bus is resumed
void tud_resume_cb(void) {
- _workflow_active = true;
}
// Invoked when cdc when line state changed e.g connected/disconnected
diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c
index cd19d3aa2..41af22eb7 100644
--- a/supervisor/shared/workflow.c
+++ b/supervisor/shared/workflow.c
@@ -25,10 +25,10 @@
*/
#include <stdbool.h>
-
-// Set by the shared USB code.
-volatile bool _workflow_active;
+#include "tusb.h"
bool supervisor_workflow_active(void) {
- return _workflow_active;
+ // Eventually there might be other non-USB workflows, such as BLE.
+ // tud_ready() checks for usb mounted and not suspended.
+ return tud_ready();
}