FRDM-MCXN947 and SDK example frdmmcxn947_dev_hid_generic_bm

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FRDM-MCXN947 and SDK example frdmmcxn947_dev_hid_generic_bm

852件の閲覧回数
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 返信

823件の閲覧回数
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 件の賞賛
返信