From da5bc86f7c0520533ac9728539828e9f07ec7c46 Mon Sep 17 00:00:00 2001 From: mucki Date: Fri, 10 Oct 2025 18:09:46 -0700 Subject: [PATCH 1/4] fix some weak symbols --- src/class/vendor/vendor_device.c | 12 ++++++------ src/class/vendor/vendor_device.h | 4 ++-- src/device/usbd.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/class/vendor/vendor_device.c b/src/class/vendor/vendor_device.c index ecf3351c..315c047b 100644 --- a/src/class/vendor/vendor_device.c +++ b/src/class/vendor/vendor_device.c @@ -259,16 +259,12 @@ bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint tu_edpt_stream_read_xfer_complete(&p_vendor->rx.stream, xferred_bytes); // Invoked callback if any - if (tud_vendor_rx_cb) { - tud_vendor_rx_cb(itf, p_epbuf->epout, (uint16_t) xferred_bytes); - } + tud_vendor_rx_cb(itf, p_epbuf->epout, (uint16_t) xferred_bytes); tu_edpt_stream_read_xfer(rhport, &p_vendor->rx.stream); } else if ( ep_addr == p_vendor->tx.stream.ep_addr ) { // Send complete - if (tud_vendor_tx_cb) { - tud_vendor_tx_cb(itf, (uint16_t) xferred_bytes); - } + tud_vendor_tx_cb(itf, (uint16_t) xferred_bytes); #if CFG_TUD_VENDOR_TX_BUFSIZE > 0 // try to send more if possible @@ -282,4 +278,8 @@ bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint return true; } +// Dummy implementatiions of weak callbacks +TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t, uint8_t const*, uint16_t) {} +TU_ATTR_WEAK void tud_vendor_tx_cb(uint8_t, uint32_t) {} + #endif diff --git a/src/class/vendor/vendor_device.h b/src/class/vendor/vendor_device.h index 7efde019..d346a0cc 100644 --- a/src/class/vendor/vendor_device.h +++ b/src/class/vendor/vendor_device.h @@ -119,9 +119,9 @@ TU_ATTR_ALWAYS_INLINE static inline uint32_t tud_vendor_write_available(void) { //--------------------------------------------------------------------+ // Invoked when received new data -TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t itf, uint8_t const* buffer, uint16_t bufsize); +void tud_vendor_rx_cb(uint8_t itf, uint8_t const* buffer, uint16_t bufsize); // Invoked when last rx transfer finished -TU_ATTR_WEAK void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes); +void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes); //--------------------------------------------------------------------+ // Inline Functions diff --git a/src/device/usbd.h b/src/device/usbd.h index 8bbfb460..af14a4e3 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -171,7 +171,7 @@ void tud_event_hook_cb(uint8_t rhport, uint32_t eventid, bool in_isr); void tud_sof_cb(uint32_t frame_count); // Invoked when received control request with VENDOR TYPE -TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); +bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); //--------------------------------------------------------------------+ // Binary Device Object Store (BOS) Descriptor Templates From 700383305ea19099f7e7d2f9d6fdffd05e41189a Mon Sep 17 00:00:00 2001 From: mucki Date: Sun, 12 Oct 2025 21:23:44 +0000 Subject: [PATCH 2/4] unnamed paramters are illegal in C --- src/class/vendor/vendor_device.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/class/vendor/vendor_device.c b/src/class/vendor/vendor_device.c index 315c047b..03b4f5d1 100644 --- a/src/class/vendor/vendor_device.c +++ b/src/class/vendor/vendor_device.c @@ -279,7 +279,16 @@ bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint } // Dummy implementatiions of weak callbacks -TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t, uint8_t const*, uint16_t) {} -TU_ATTR_WEAK void tud_vendor_tx_cb(uint8_t, uint32_t) {} +TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t itf, uint8_t const* buffer, uint16_t bufsize) +{ + (void)itf; + (void)buffer; + (void)bufsize; +} +TU_ATTR_WEAK void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes) +{ + (void)itf; + (void)sent_bytes; +} #endif From c2a908cca1ea5d1eb09f24fe1b7760e9bd3e6208 Mon Sep 17 00:00:00 2001 From: mucki Date: Sun, 12 Oct 2025 23:58:17 +0000 Subject: [PATCH 3/4] hmm --- src/device/usbd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/device/usbd.c b/src/device/usbd.c index dbb77e94..209da0af 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -79,12 +79,12 @@ TU_ATTR_WEAK void tud_suspend_cb(bool remote_wakeup_en) { TU_ATTR_WEAK void tud_resume_cb(void) { } -//TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const* request) { -// (void) rhport; -// (void) stage; -// (void) request; -// return false; -//} +TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const* request) { + (void) rhport; + (void) stage; + (void) request; + return false; +} TU_ATTR_WEAK bool dcd_deinit(uint8_t rhport) { (void) rhport; From 03f8af0e817cce1f315e7a49d2ccbf3bdd70a861 Mon Sep 17 00:00:00 2001 From: mucki Date: Mon, 13 Oct 2025 04:09:10 +0000 Subject: [PATCH 4/4] some changes conflicted with changes in master --- src/class/vendor/vendor_device.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/class/vendor/vendor_device.c b/src/class/vendor/vendor_device.c index fe59dd8e..2adb26f2 100644 --- a/src/class/vendor/vendor_device.c +++ b/src/class/vendor/vendor_device.c @@ -292,17 +292,4 @@ bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint return true; } -// Dummy implementatiions of weak callbacks -TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t itf, uint8_t const* buffer, uint16_t bufsize) -{ - (void)itf; - (void)buffer; - (void)bufsize; -} -TU_ATTR_WEAK void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes) -{ - (void)itf; - (void)sent_bytes; -} - #endif