summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-03-21 18:13:25 +0700
committerhathach <[email protected]>2023-03-21 18:13:25 +0700
commitd34508a316a2b97db749651452b8e1650e854f37 (patch)
tree528f303d16f124158f152859fff5af37c714c1bd /src
parent878f2b54fe208f717677cabda57180ef8a4bc3cd (diff)
add note for blocking tuh_configuration_set(), tuh_interface_set()
Diffstat (limited to 'src')
-rw-r--r--src/host/usbh.c20
-rw-r--r--src/host/usbh.h2
2 files changed, 20 insertions, 2 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c
index 5a14aea5f..a3335102f 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -1030,7 +1030,15 @@ bool tuh_configuration_set(uint8_t daddr, uint8_t config_num,
.user_data = user_data
};
- return tuh_control_xfer(&xfer);
+ bool ret = tuh_control_xfer(&xfer);
+
+ // if blocking, user_data could be pointed to xfer_result
+ if ( !complete_cb && user_data )
+ {
+ *((xfer_result_t*) user_data) = xfer.result;
+ }
+
+ return ret;
}
bool tuh_interface_set(uint8_t daddr, uint8_t itf_num, uint8_t itf_alt,
@@ -1062,7 +1070,15 @@ bool tuh_interface_set(uint8_t daddr, uint8_t itf_num, uint8_t itf_alt,
.user_data = user_data
};
- return tuh_control_xfer(&xfer);
+ bool ret = tuh_control_xfer(&xfer);
+
+ // if blocking, user_data could be pointed to xfer_result
+ if ( !complete_cb && user_data )
+ {
+ *((xfer_result_t*) user_data) = xfer.result;
+ }
+
+ return ret;
}
//--------------------------------------------------------------------+
diff --git a/src/host/usbh.h b/src/host/usbh.h
index 45e6356bc..125d8f4c9 100644
--- a/src/host/usbh.h
+++ b/src/host/usbh.h
@@ -168,11 +168,13 @@ bool tuh_edpt_open(uint8_t dev_addr, tusb_desc_endpoint_t const * desc_ep);
// Set Configuration (control transfer)
// config_num = 0 will un-configure device. Note: config_num = config_descriptor_index + 1
// true on success, false if there is on-going control transfer or incorrect parameters
+// if complete_cb == NULL i.e blocking, user_data should be pointed to xfer_reuslt_t*
bool tuh_configuration_set(uint8_t daddr, uint8_t config_num,
tuh_xfer_cb_t complete_cb, uintptr_t user_data);
// Set Interface (control transfer)
// true on success, false if there is on-going control transfer or incorrect parameters
+// if complete_cb == NULL i.e blocking, user_data should be pointed to xfer_reuslt_t*
bool tuh_interface_set(uint8_t daddr, uint8_t itf_num, uint8_t itf_alt,
tuh_xfer_cb_t complete_cb, uintptr_t user_data);