-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Process USB vendor requests in system thread #1323
Process USB vendor requests in system thread #1323
Conversation
… system thread. USB_REQUEST_MODULE_INFO added
system/src/system_control.cpp
Outdated
@@ -181,10 +170,13 @@ uint8_t SystemControlInterface::handleVendorRequest(HAL_USB_SetupRequest* req) { | |||
} else { | |||
// Return as string | |||
String id = System.deviceID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable
system/inc/system_control.h
Outdated
@@ -66,6 +67,7 @@ typedef enum USBRequestResult { | |||
typedef struct USBRequest { | |||
size_t size; // Structure size | |||
int type; // Request type (as defined by USBRequestType enum) | |||
uint16_t value; // wValue field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change breaks ABI (new fields should be added at the end of the structure)
@@ -279,6 +279,7 @@ class ManagedNetworkInterface : public NetworkInterface | |||
console.loop(); | |||
} | |||
#if PLATFORM_THREADING | |||
SystemISRTaskQueue.process(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
system/src/system_control.cpp
Outdated
} | ||
|
||
case USB_REQUEST_LISTENING_MODE: { | ||
setRequestResult(req, result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any problem with setting a result after calling WiFi.listen()
? I just would like to see error handling unified in this function (if possible), i.e. make all case blocks to either call setRequestResult()
and return, or assign to result
variable.
system/src/system_control.cpp
Outdated
default: | ||
if (usbReqAppHandler) { | ||
processAppRequest(data); // Forward request to the application thread | ||
} else { | ||
setRequestResult(req, USB_REQUEST_RESULT_ERROR); | ||
} | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here:
if (usbReqAppHandler) {
processAppRequest(data);
return;
} else {
result = USB_REQUEST_RESULT_ERROR;
}
Thanks for the comments! Updated PR. |
…sb vendor requests
…quest-sync Process USB vendor requests in system thread
Problem
Most of the currently supported vendor requests should be executed on system thread instead of being processed in ISR.
Solution
Utilize
SystemISRTaskQueue
for vendor requests.Steps to Test
N/A
Example App
N/A
References
Completeness
Internal
[PR #1323]
USB vendor requests should be executed on system thread instead of being processed in ISR.