chegewara / esp32-usb-host

ESP32 S2 USB host with examples.
MIT License
27 stars 1 forks source link

Arduino support #1

Closed dexter323i closed 2 years ago

dexter323i commented 2 years ago

Hi @chegewara,

Thanks for your work creating an USB host library for ESP32S2! This is needed so much since ESP32S2 exists! In the description you mentioned you are aiming for Arduino too. Currently, Arduino community is huge in DIY projects. If we add the word "USB" to "Arduino" we get to Pro Micro and Leonardo, and many many projects where people are building custom game controllers. (Joysticks, button boxes, simulator steering wheels, simulator pedals, etc.) But now, I am interested in the other way: Using Arduino framework to read USB game controllers (HIDs), and your repo sounds pretty much promising. It is sad it is in the early stages...

What do you think, how far is this down the line, when Arduino libraries also arrive for ESP32S2? And can it be used to read USB HID devices? (e.g. a PlayStation gamepad)

chegewara commented 2 years ago

https://github.com/chegewara/EspTinyUSB/tree/master/examples/host

chegewara commented 2 years ago

It does not support HID devices, but feel free to create PR.

dexter323i commented 2 years ago

Thank you for the examples! I am only learning USB handling, but I will do my best to create a PR. :) Anyway. Your keyboard2 example worked like a charm, but gamepad example did not. (And it would be more important to me) Even when I set manufacturer and product values, I cannot find it in Windows Device manager. (maybe it is because default vid and pid values?) The joy.cpl command brings up game controller named "TinyUSB HID", but the Properties / Test tab does not show the simulated button presses and joy movements what the code should do. Does it work for you?

chegewara commented 2 years ago

You are mixing here 2 concepts.

  1. USB host - you can connect gamepad to esp32 Sx
  2. USB device - esp32 Sx can be connected to host (PC) as a gamepad, and is not part of this report, but the other library
dexter323i commented 2 years ago

First I wanted to understand how the device code works, to get closer implementing the host concept. But the device example is bad, and I wanted to point that out. You are totally right, it is in a different repo, not here. I even found that someone had already reported this issue, so I added my comment to that. Sorry for mixing it into here.

chegewara commented 2 years ago

No problem, just wanted to clarify.