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

Sending Hid Messages gives strange result #148

Open K372470 opened 9 months ago

K372470 commented 9 months ago

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

chegewara commented 9 months ago

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

K372470 commented 9 months ago

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(

chegewara commented 9 months ago

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