Skip to content

Commit 7a32772

Browse files
committed
add back weak callback for tud_descriptor_bos_cb to prevent conflict issue with esp32 core
1 parent c748ad6 commit 7a32772

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/device/usbd.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ TU_ATTR_WEAK void tud_sof_cb(uint32_t frame_count) {
6060
(void) frame_count;
6161
}
6262

63-
TU_ATTR_WEAK uint8_t const* tud_descriptor_bos_cb(void) {
64-
return NULL;
65-
}
63+
// TU_ATTR_WEAK uint8_t const* tud_descriptor_bos_cb(void) {
64+
// return NULL;
65+
// }
6666

6767
TU_ATTR_WEAK uint8_t const* tud_descriptor_device_qualifier_cb(void) {
6868
return NULL;
@@ -1091,7 +1091,10 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
10911091
TU_LOG_USBD(" BOS\r\n");
10921092

10931093
// requested by host if USB > 2.0 ( i.e 2.1 or 3.x )
1094-
uintptr_t desc_bos = (uintptr_t) tud_descriptor_bos_cb();
1094+
uintptr_t desc_bos = 0;
1095+
if (tud_descriptor_bos_cb) {
1096+
desc_bos = (uintptr_t) tud_descriptor_bos_cb();
1097+
}
10951098
TU_VERIFY(desc_bos);
10961099

10971100
// Use offsetof to avoid pointer to the odd/misaligned address

src/device/usbd.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid);
126126

127127
// Invoked when received GET BOS DESCRIPTOR request
128128
// Application return pointer to descriptor
129-
uint8_t const * tud_descriptor_bos_cb(void);
129+
TU_ATTR_WEAK uint8_t const * tud_descriptor_bos_cb(void);
130130

131131
// Invoked when received GET DEVICE QUALIFIER DESCRIPTOR request
132132
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete.

0 commit comments

Comments
 (0)