summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-09-07 15:19:20 +0700
committerhathach <[email protected]>2020-09-07 15:19:20 +0700
commit66a10ec9c8042a48053b4af67a932f3cfe9470c2 (patch)
treea3f70a3ad963af7cedc9e533180a123265096811 /src/class
parentb3e81673c0582a07a764981604a560ee3d310ef9 (diff)
rework usbh control transfer
use series of complete callback instead of blocking semaphore, which is more noOS friendly. still working with hid host
Diffstat (limited to 'src/class')
-rw-r--r--src/class/hid/hid_host.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c
index 6002ead3c..5058191f4 100644
--- a/src/class/hid/hid_host.c
+++ b/src/class/hid/hid_host.c
@@ -175,14 +175,22 @@ bool hidh_open_subtask(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t c
// SET IDLE = 0 request
// Device can stall if not support this request
- tusb_control_request_t request = {
- .bmRequestType_bit = { .recipient = TUSB_REQ_RCPT_INTERFACE, .type = TUSB_REQ_TYPE_CLASS, .direction = TUSB_DIR_OUT },
- .bRequest = HID_REQ_CONTROL_SET_IDLE,
- .wValue = 0, // idle_rate = 0
- .wIndex = p_interface_desc->bInterfaceNumber,
- .wLength = 0
+ tusb_control_request_t const request =
+ {
+ .bmRequestType_bit =
+ {
+ .recipient = TUSB_REQ_RCPT_INTERFACE,
+ .type = TUSB_REQ_TYPE_CLASS,
+ .direction = TUSB_DIR_OUT
+ },
+ .bRequest = HID_REQ_CONTROL_SET_IDLE,
+ .wValue = 0, // idle_rate = 0
+ .wIndex = p_interface_desc->bInterfaceNumber,
+ .wLength = 0
};
- usbh_control_xfer( dev_addr, &request, NULL ); // TODO stall is valid
+
+ // stall is a valid response for SET_IDLE, therefore we could ignore result of this request
+ tuh_control_xfer(dev_addr, &request, NULL, NULL);
#if 0
//------------- Get Report Descriptor TODO HID parser -------------//