chegewara / EspTinyUSB

ESP32S2 native USB library. Implemented few common classes, like MIDI, CDC, HID or DFU (update).
MIT License
473 stars 70 forks source link

msc flashdisk compile error on Platformio with ESP32-S2 #135

Open PaffAngryDragon opened 1 year ago

PaffAngryDragon commented 1 year ago

When compiling on VSC+Platformio with ArduinoEspressif 4.1.0 I get errors for missing FS.h and SD.h, which could be fixed by simply adding #include <...> lines. Next error is trickier: Compiling .pio\build\esp32-s2-saola-1\liba36\ESP32TinyUSB\host\msc\vfs\diskio_rawmsc.cpp.o .pio/libdeps/esp32-s2-saola-1/ESP32TinyUSB/src/host/common/usb_host.cpp: In member function 'bool USBhost::init(bool)': .pio/libdeps/esp32-s2-saola-1/ESP32TinyUSB/src/host/common/usb_host.cpp:72:5: error: 'const usb_host_client_config_t' has no non-static data member named 'is_synchronous' }; ^ *** [.pio\build\esp32-s2-saola-1\liba36\ESP32TinyUSB\host\common\usb_host.cpp.o] Error 1

It is because the struct declared is: const usb_host_client_config_t client_config = { .is_synchronous = false, .max_num_event_msg = 5, .async = { .client_event_callback = _client_event_callback, .callback_arg = this } }; but the defined usb_host_client_config_t declared in in esp32-s2 tools/sdk looks like this: ` /**

I am trying to write a program ewhere the esp32-s2 would have HIDUSB capability (done..) + become an USB MSC device with one FAT partition toward a PC and at the same time to have FATFS open on that partition (done, but separatelly of HIDUSB). When I try all three together I hit the wall for 2 dys now. All available USB librarys seems to have some issues with MSC +FAT on the internal flash of ESP32. `

chegewara commented 1 year ago

This library is working pretty good with MSC + FATFS, tested and confirmed by many users.

It is possible that API has been changed in arduino-esp32 (esp-idf) you are trying to build with. What you can do is to edit host code, or even to delete it, because you dont need it. You can also try to use my v2 library, but its still a bit messy, because ive been trying to write code compatible with arduino and esp-idf, which is not easy, because they are using different tinyusb ports (kind of sucks).