Usb host support#527
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds ESP32 USB host support: devicetree bindings and device properties, platform build manifest and CMake wiring, a USB host controller driver and class drivers for HID, MIDI, and MSC, C ABI kernel wrappers, LVGL HID input integration and statusbar USB icon/font updates, file-manager eject action invoking the MSC eject API, GUI lifecycle start/stop for HID input, and sdkconfig generation when usbHostEnabled is set. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (1)
Tactility/Source/lvgl/UsbHidInput.cpp (1)
194-194: 💤 Low valueMove CURSOR_SIZE to file or function scope.
The
constexpris defined inside a switch case (line 194), which is unusual. Consider moving this constant to file scope alongside the other constants (lines 23-29) for consistency and clarity.Suggested refactor
At the top with other constants:
constexpr uint32_t KEY_REPEAT_DELAY_MS = 500; constexpr uint32_t KEY_REPEAT_RATE_MS = 50; constexpr int32_t CURSOR_SIZE = 16;Then use it without redeclaration:
case USB_HID_EVENT_MOUSE_MOVE: { lv_display_t* disp = lv_display_get_default(); - constexpr int32_t CURSOR_SIZE = 16; if (!disp) break;
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a71f1900-117a-4b8d-be7d-9e38cd788c9e
📒 Files selected for processing (37)
Devices/btt-panda-touch/bigtreetech,panda-touch.dtsDevices/btt-panda-touch/device.propertiesDevices/m5stack-tab5/device.propertiesDevices/m5stack-tab5/m5stack,tab5.dtsFirmware/idf_component.ymlModules/lvgl-module/assets/generate-all.pyModules/lvgl-module/include/tactility/lvgl_icon_statusbar.hModules/lvgl-module/source-fonts/material_symbols_statusbar_12.cModules/lvgl-module/source-fonts/material_symbols_statusbar_16.cModules/lvgl-module/source-fonts/material_symbols_statusbar_20.cModules/lvgl-module/source-fonts/material_symbols_statusbar_30.cPlatforms/platform-esp32/CMakeLists.txtPlatforms/platform-esp32/bindings/espressif,esp32-usbhost-hid.yamlPlatforms/platform-esp32/bindings/espressif,esp32-usbhost-midi.yamlPlatforms/platform-esp32/bindings/espressif,esp32-usbhost-msc.yamlPlatforms/platform-esp32/bindings/espressif,esp32-usbhost.yamlPlatforms/platform-esp32/include/tactility/bindings/esp32_usbhost.hPlatforms/platform-esp32/include/tactility/drivers/esp32_usbhost.hPlatforms/platform-esp32/source/drivers/usb/esp32_usbhost.cppPlatforms/platform-esp32/source/drivers/usb/esp32_usbhost_hid.cppPlatforms/platform-esp32/source/drivers/usb/esp32_usbhost_midi.cppPlatforms/platform-esp32/source/drivers/usb/esp32_usbhost_msc.cppPlatforms/platform-esp32/source/module.cppTactility/Include/Tactility/lvgl/UsbHidInput.hTactility/Private/Tactility/app/files/View.hTactility/Source/app/files/View.cppTactility/Source/lvgl/UsbHidInput.cppTactility/Source/service/gui/GuiService.cppTactility/Source/service/statusbar/Statusbar.cppTactilityKernel/include/tactility/drivers/usb_host_hid.hTactilityKernel/include/tactility/drivers/usb_host_midi.hTactilityKernel/include/tactility/drivers/usb_host_msc.hTactilityKernel/source/drivers/usb_host_hid.cppTactilityKernel/source/drivers/usb_host_midi.cppTactilityKernel/source/drivers/usb_host_msc.cppTactilityKernel/source/kernel_symbols.cdevice.py
Only tested on panda touch and tab5 which works as expected with all 3 modes, HID (keyboard / mouse), MSC, Mouse.
Hubs also work with limitations (see my notes snippet below).
Good luck finding a USB 1.1 / Full-Speed hub to get around this issue.
Multiple usb flash drives connected to a hub work fine.
Things will vary wildly depending on hub and devices i guess.
My diy corne keyboard works via a hub for example but not my keychron Q1 V2 or even a cheap generic hp office keyboard and none of the mice i can find around the house work via a hub either. lol
Hub limitation: The ESP-IDF USB host stack does not implement Transaction Translator (TT) support.
This means Full-Speed (keyboards, mice, HID dongles) and Low-Speed devices connected through a USB 2.0 High-Speed hub will fail with "TT is not supported".
High-Speed devices such as USB flash drives work fine through a hub.
All HID devices must be connected directly to the host port until TT support is added upstream in ESP-IDF.
https://docs.espressif.com/projects/esp-usb/en/latest/esp32p4/usb_host.html#features-limitations
https://docs.espressif.com/projects/esp-usb/en/latest/esp32s3/usb_host.html#features-limitations
Summary by CodeRabbit