FRDM-MCXN947 and SDK example frdmmcxn947_dev_hid_generic_bm

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

FRDM-MCXN947 and SDK example frdmmcxn947_dev_hid_generic_bm

969 次查看
JohnKay
Contributor II

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.

标签 (2)
0 项奖励
回复
1 回复

940 次查看
Alex_Wang
NXP Employee
NXP Employee

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

 

 

0 项奖励
回复