EspTinyUSB icon indicating copy to clipboard operation
EspTinyUSB copied to clipboard

Sending Hid Messages gives strange result

Open K372470 opened this issue 9 months ago • 3 comments

Good day

Im trying to make a controller for my device(NUX-MG30) and I need to send {12,192,4,88} to the usb interface of this device:

#include "hidgeneric.h"
#if CFG_TUD_HID
HIDgeneric dev;
const uint8_t buffer[4]={12,192,4,88};

void setup()
{
    Serial.begin(115200);
    dev.begin();
}

void loop()
{
    delay(1000);
    dev.write(buffer, sizeof(buffer));
}

#endif

This is a bit changed version of hid_generic.ino

Problem

It works and sends data, BUT USB Analyzer by Eltima Software says im sending {1,12,192,4,88} => arduino adds '1' byte at the start of my message Is there anything I can do with it?

My settings

Plate: Esp32s3 dev module USB-MODE: USB-OTG (TinyUsb) CDC-ON-BOOT: True JTAG: Disabled

End

Thanks to everyone who took a look at my problem

K372470 avatar Sep 24 '23 15:09 K372470

Its good that the 1 is added. It is report ID. Its USB standard.

chegewara avatar Sep 26 '23 01:09 chegewara

Hmm... Sounds realistic. Could you then give me any tip for "is my idea is even realisable",please ? As i can think esp32 should programmed as usb-host, but when i tried no data was sent at all(

K372470 avatar Oct 04 '23 11:10 K372470

There is a chance it may works when report ID is 0. Please check code how to set report ID.

chegewara avatar Oct 06 '23 04:10 chegewara