In hid_generic.c, around line 197, appear the following three (3) lines.
USB_DeviceHidSend(g_UsbDeviceHidGeneric.hidHandle, USB_HID_GENERIC_ENDPOINT_IN,
(uint8_t *)&g_UsbDeviceHidGeneric.buffer[g_UsbDeviceHidGeneric.bufferIndex][0],
USB_HID_GENERIC_OUT_BUFFER_LENGTH);
g_UsbDeviceHidGeneric.bufferIndex ^= 1U;
return USB_DeviceHidRecv(g_UsbDeviceHidGeneric.hidHandle, USB_HID_GENERIC_ENDPOINT_OUT,
(uint8_t *)&g_UsbDeviceHidGeneric.buffer[g_UsbDeviceHidGeneric.bufferIndex][0],
USB_HID_GENERIC_OUT_BUFFER_LENGTH);
Using a USB tester on a PC, I am able to <send> a 64 byte packet to the example and
then when I <read> the response, I get the buffer I sent in. Perfect!
However, I want to send something else besides the incoming data, I can't get it to
echo anything else.
I tried to manually overwrite both buffers, but no dice.
memcpy((uint8_t *)&g_UsbDeviceHidGeneric.buffer[0][0],
(uint8_t *)&arg[0], 4);
memcpy((uint8_t *)&g_UsbDeviceHidGeneric.buffer[1][0],
(uint8_t *)&arg[0], 4);
return USB_DeviceHidRecv(g_UsbDeviceHidGeneric.hidHandle, USB_HID_GENERIC_ENDPOINT_OUT,
(uint8_t *)&g_UsbDeviceHidGeneric.buffer[g_UsbDeviceHidGeneric.bufferIndex][0],
USB_HID_GENERIC_OUT_BUFFER_LENGTH);
Any thoughts would be appreciated.
Hi, @JohnKay
You mentioned "I want to send something else besides the incoming data", can you tell me what something else is?
Best regards, Alex