Skip to content

Commit

Permalink
add back weak callback for tud_descriptor_bos_cb to prevent conflict …
Browse files Browse the repository at this point in the history
…issue with esp32 core
  • Loading branch information
hathach committed Aug 8, 2024
1 parent c748ad6 commit 7a32772
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/device/usbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ TU_ATTR_WEAK void tud_sof_cb(uint32_t frame_count) {
(void) frame_count;
}

TU_ATTR_WEAK uint8_t const* tud_descriptor_bos_cb(void) {
return NULL;
}
// TU_ATTR_WEAK uint8_t const* tud_descriptor_bos_cb(void) {
// return NULL;
// }

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

// requested by host if USB > 2.0 ( i.e 2.1 or 3.x )
uintptr_t desc_bos = (uintptr_t) tud_descriptor_bos_cb();
uintptr_t desc_bos = 0;
if (tud_descriptor_bos_cb) {
desc_bos = (uintptr_t) tud_descriptor_bos_cb();
}
TU_VERIFY(desc_bos);

// Use offsetof to avoid pointer to the odd/misaligned address
Expand Down
2 changes: 1 addition & 1 deletion src/device/usbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid);

// Invoked when received GET BOS DESCRIPTOR request
// Application return pointer to descriptor
uint8_t const * tud_descriptor_bos_cb(void);
TU_ATTR_WEAK uint8_t const * tud_descriptor_bos_cb(void);

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

0 comments on commit 7a32772

Please sign in to comment.