-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't instanciate multiple HID devices #9973
Comments
I tried your exact code, with the exception that I do not have void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
hid.begin();
USB.begin();
pinMode(0, INPUT_PULLUP);
}
void loop() {
static bool btn = digitalRead(0);
bool btn_now = digitalRead(0);
if(btn != btn_now){
btn = btn_now;
if(!btn_now){
Mouse16.click(1);
}
}
delay(10);
} Mouse works fine on my computer and I can see both devices in the USB tool I have. Main difference is that I am on a Mac and have no idea what things look like on Windows. Code looks fine and works fine, except you should not call |
Indeed, I tried on both MBP M1 and MBP M3 and it was working without any issues, with both devices showing up. Probably some windows shenanigans happening. Could you please investigate ? |
I can't. I do not have a windows machine and the colleague that does just went out on a month long leave... One suggestion for you is to set the USB mode in the board menu to TinyUSB (I saw in the logs it was the default USB/JTAG selected) |
Yeah I have done that : USB Mode to USB-OTG (TinyUSB) I dont really understand why Windows is not allowing the Arduino to work as intended |
Maybe it does not like something in the vendor descriptor? Can you try with a standard TinyUSB one? https://github.com/espressif/arduino-esp32/blob/master/libraries/USB/examples/HIDVendor/HIDVendor.ino |
On Windows I have the following output :
And I can see it being plugged in as a USB Input Device with device type HID (Human Interface Device). Should I use that standard HIDVendor in my code ? |
I added the standard HIDVendor device to my code, I still get the issue on Windows. Not on MacOS though
|
@me-no-dev Couple of updates on the matter :
|
That means that Windows does not like something in your vendor descriptor. I wonder what... what is different from the default one? |
I don't really know to be fair. Now I have the custom device showing up, but I can't communicate with it.
This is the definition of my two devices. Following is my host code :
It seems also that my device reboots when it receives too much data for too long |
Not sure if this is related, but I do have trouble using CDC and HID simultaneously. After some time, one or the other seems to stall, see #9582 (comment). BR |
Board
ESP32S3
Device Description
DevkitM1, plain board, both USB ports connected to host
Hardware Configuration
Optical sensor connected to GPIO21, GPIO38, GPIO47, GPIO48, GND and 3v3
Version
latest master (checkout manually)
IDE Name
Arduino IDE 2.3.2
Operating System
Windows 10
Flash frequency
80MHz
PSRAM enabled
no
Upload speed
921600
Description
I am implementing an optical sensor using the USBHID.h library. It works well and I am able to send movements to the host. As soon as I instantiate a Custom HID device, the host won't receive the movements (I don't know if it is the board not sending or the host not receiving).
Sketch
Debug Message
Other Steps to Reproduce
I can see the following error in USBLogView Device Description
Unknown USB Device (Device Descriptor Request Failed)
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: