esp-iot-bridge icon indicating copy to clipboard operation
esp-iot-bridge copied to clipboard

Manual patch needed to get USB bridge working (AEGHB-97)

Open redfast00 opened this issue 2 years ago • 5 comments

I've tried to compile the wifi_router example in this project, with CONFIG_BRIDGE_DATA_FORWARDING_NETIF_USB=y, but this does not build:

/home/user/esp-iot-bridge/components/iot_bridge/src/bridge_usb.c:30:10: fatal error: tinyusb.h: No such file or directory
   30 | #include "tinyusb.h"
      |          ^~~~~~~~~~~
compilation terminated.

This is with the latest master. It should be noted that this feature is commented out in CI, so it doesn't appear broken: https://github.com/espressif/esp-iot-bridge/blob/master/.gitlab-ci.yml#L69

redfast00 avatar Mar 13 '23 19:03 redfast00

You can temporarily add the following patch to the code, and we will update the example for the NIC solution later.

diff --git a/components/iot_bridge/CMakeLists.txt b/components/iot_bridge/CMakeLists.txt
index 61e8593..6a0d290 100644
--- a/components/iot_bridge/CMakeLists.txt
+++ b/components/iot_bridge/CMakeLists.txt
@@ -30,7 +30,7 @@ if (CONFIG_BRIDGE_DATA_FORWARDING_NETIF_SDIO OR CONFIG_BRIDGE_DATA_FORWARDING_NE
 endif()
 
 if ("${IDF_TARGET}" STREQUAL "esp32s2" OR "${IDF_TARGET}" STREQUAL "esp32s3")
-    list(APPEND requires "esp_modem_usb_dte")
+    list(APPEND requires "esp_modem_usb_dte" "usb_device")
 endif()
 
 idf_component_register(SRCS "${srcs}"
diff --git a/examples/wifi_router/main/idf_component.yml b/examples/wifi_router/main/idf_component.yml
index 12e8b33..8923247 100644
--- a/examples/wifi_router/main/idf_component.yml
+++ b/examples/wifi_router/main/idf_component.yml
@@ -11,6 +11,9 @@ dependencies:
   web_server:
     path: components/web_server
     git: https://github.com/espressif/esp-iot-bridge.git
+  usb_device:
+    path: components/usb/usb_device
+    git: https://github.com/espressif/esp-iot-bridge.git
   # The "esp_modem_usb_dte" component is temporarily disabled in iot_bridge yml file,
   # as idf-component-manager doesn't support uploading components with "rules" entries to the registry.
   # So temporarily place the "esp_modem_usb_dte" "esp_modem" component under examples.

tswen avatar Mar 14 '23 02:03 tswen

@tswen Would you accept a PR that includes your patch?

redfast00 avatar Jun 01 '23 18:06 redfast00

Hi @redfast00 , there is an internal MR under review and will be released soon.

tswen avatar Jun 08 '23 08:06 tswen

how soon, tho?

chedim avatar Feb 10 '24 06:02 chedim

The current example can already use USB netif normally and does not require any modification to the components.

tswen avatar Feb 17 '24 07:02 tswen