You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have been loosing my mind for the past week or so. Basically I have a pi pico with tinyusb and I want it to work as a keyboard+consumer control but also would like to be able to communicate with it via my software, the issue is when I created and experimented a lot with node-hid I realized that there is something wrong with my setup and that for some reason the callback does not seem to be receiving the entire buffer I tried to send, for instance this is the buffer I would send:
Sent to Report ID 3, of length 64: [
3, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
]
and this is my callback:
voidtud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_tconst* buffer, uint16_t bufsize)
{
//Confirm the function is triggered
(*ledStrip).fill(WS2812::RGB(255, 255, 255));
// check report idif (buffer[0] == REPORT_ID_GENERIC_INOUT) {
if(bufsize == 64) {
for (int i = 0; i < sizeof(buffer); i++) {
if(i == 0) continue;
(*ledStrip).setPixelColor(buffer[i], WS2812::RGB(0, 255, 0)); // Red to indicate active communication
}
}
(*ledStrip).show();
tud_hid_report(report_id, buffer, bufsize);
}
}
and after the function has been triggered, only the leds of indexes 1, 2 and 3 would light up, no matter how many I would specify in the report, it would always be limited to reading the first 4 positions of the report and then never even send back the report.
From what I have tried so far:
sending the report from the device using multiple other report id's
sending buffer without the padding zeros
sending a buffer of length 65 instead of 64
Making the generic inout the first interface
the code seemed to work when I used the example descriptor, but then the issue of adding the rest of the hid interfaces arose and I am not sure what to do about it as there is minimal to no information from what I've found on how to make these 2 work together. Here is the rest of my scripts:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have been loosing my mind for the past week or so. Basically I have a pi pico with tinyusb and I want it to work as a keyboard+consumer control but also would like to be able to communicate with it via my software, the issue is when I created and experimented a lot with node-hid I realized that there is something wrong with my setup and that for some reason the callback does not seem to be receiving the entire buffer I tried to send, for instance this is the buffer I would send:
Sent to Report ID 3, of length 64: [
3, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
]
and this is my callback:
and after the function has been triggered, only the leds of indexes 1, 2 and 3 would light up, no matter how many I would specify in the report, it would always be limited to reading the first 4 positions of the report and then never even send back the report.
From what I have tried so far:
the code seemed to work when I used the example descriptor, but then the issue of adding the rest of the hid interfaces arose and I am not sure what to do about it as there is minimal to no information from what I've found on how to make these 2 work together. Here is the rest of my scripts:
usb_descriptors.c:
usb_descriptors.h:
and in case it helps here is a report I read using wireshark that describes what the hid report I send from my node script looks like:
Beta Was this translation helpful? Give feedback.
All reactions