lpcware

Multiple HID Devices on LPC1769 (LPCXpresso board)

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by LVL on Thu Sep 13 02:25:47 MST 2012
Hi,

The nxpusblib is wonderful, however, it does has it's limitations.
I want to create a device that contains multiple HID Gamepads/Joysticks.
I don't think I am talking about composite devices, since I need 2 devices which are exactly the same.
The usb descriptor is already edit(see below). It now shows one device on the pc, but 2 controllers within that device.


USB descriptor:
<code>
HID_RI_USAGE_PAGE (8, 0x01), \
HID_RI_USAGE (8, 0x05), \
HID_RI_COLLECTION (8, 0x01), \
HID_RI_COLLECTION (8, 0x00), \
HID_RI_REPORT_ID (8, 0x01), \
HID_RI_USAGE_PAGE (8, 0x09), \
HID_RI_USAGE_MINIMUM (8, 0x01), \
HID_RI_USAGE_MAXIMUM (8, 0x08), \
HID_RI_LOGICAL_MINIMUM (8, 0x00), \
HID_RI_LOGICAL_MAXIMUM (8, 0x01), \
HID_RI_REPORT_COUNT (8, 0x08), \
HID_RI_REPORT_SIZE (8, 0x01), \
HID_RI_INPUT (8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \
HID_RI_USAGE_PAGE (8, 0x01), \
HID_RI_USAGE (8, 0x30), \
HID_RI_USAGE (8, 0x31), \
HID_RI_USAGE (8, 0x33), \
HID_RI_USAGE (8, 0x34), \
HID_RI_LOGICAL_MINIMUM (8, 0x81), \
HID_RI_LOGICAL_MAXIMUM (8, 0x7f), \
HID_RI_REPORT_SIZE (8, 0x08), \
HID_RI_REPORT_COUNT (8, 0x04), \
HID_RI_INPUT (8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \
HID_RI_END_COLLECTION(0), \
HID_RI_END_COLLECTION(0), \
HID_RI_USAGE_PAGE (8, 0x01), \
HID_RI_USAGE (8, 0x05), \
HID_RI_COLLECTION (8, 0x01), \
HID_RI_COLLECTION (8, 0x00), \
HID_RI_REPORT_ID (8, 0x02), \
HID_RI_USAGE_PAGE (8, 0x09), \
HID_RI_USAGE_MINIMUM (8, 0x01), \
HID_RI_USAGE_MAXIMUM (8, 0x08), \
HID_RI_LOGICAL_MINIMUM (8, 0x00), \
HID_RI_LOGICAL_MAXIMUM (8, 0x01), \
HID_RI_REPORT_COUNT (8, 0x08), \
HID_RI_REPORT_SIZE (8, 0x01), \
HID_RI_INPUT (8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \
HID_RI_USAGE_PAGE (8, 0x01), \
HID_RI_USAGE (8, 0x30), \
HID_RI_USAGE (8, 0x31), \
HID_RI_USAGE (8, 0x33), \
HID_RI_USAGE (8, 0x34), \
HID_RI_LOGICAL_MINIMUM (8, 0x81), \
HID_RI_LOGICAL_MAXIMUM (8, 0x7f), \
HID_RI_REPORT_SIZE (8, 0x08), \
HID_RI_REPORT_COUNT (8, 0x04), \
HID_RI_INPUT (8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \
HID_RI_END_COLLECTION(0), \
HID_RI_END_COLLECTION(0)
</code>


Data structure:
<code>
typedef struct
{
uint8_t report_id;
uint8_t buttons;
int8_t left_x;
int8_t left_y;
int8_t right_x;
int8_t right_y;
} ATTR_PACKED USB_GamepadReport_Data_t;
</code>


This is of course the easy part. Right now I am learning about endpoints, which seem to play a role in my 'multiple HID gamepads'-idea.
And of course the Report_ID, which is connected to every data pack that the device sends to the pc.
Right now, I cannot receive anything from the device.(only with one device and without the report_id in the struct)

Can anybody help me with this? It somehow seems easy, but I am just not seeing it...

Outcomes