espressif / esp-iot-bridge

A smart bridge to make both ESP and the other MCU or smart device can access the Internet.
164 stars 54 forks source link

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

Open redfast00 opened 1 year ago

redfast00 commented 1 year ago

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

tswen commented 1 year ago

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.
redfast00 commented 1 year ago

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

tswen commented 1 year ago

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

chedim commented 9 months ago

how soon, tho?

tswen commented 9 months ago

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