This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Second Top Level Collection in HIDEmuKbd to send feature report

Hi,

I am using HIDEmuKbd project to test BLE capabilities for a new device. I tested all of the functionalities of emulated hid keyboard with succes on SmartRF06 + CC2650EM-7ID.

Now I need to send feature reports to the device in order to control SmartRF06 LED outputs according to my needs, maintaining the HID emulated keyboard functionalities linked to the four board buttons (I associated a different key to each button and it is working well).

I added a second Top Level Collection to avoid windows exclusive access to HID device with usage page 0x01 and usage 0x06 (keyboard). So my new report descriptor is the following:

static CONST uint8 hidReportMap[] =
{
	0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
	0x09, 0x06,                    // USAGE (Keyboard)
	0xa1, 0x01,                    // COLLECTION (Application)
	0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
	0x85, 0x01,                    //   REPORT_ID (1)
	0x19, 0xe0,                    //   USAGE_MINIMUM (Keyboard LeftControl)
	0x29, 0xe7,                    //   USAGE_MAXIMUM (Keyboard Right GUI)
	0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
	0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
	0x75, 0x01,                    //   REPORT_SIZE (1)
	0x95, 0x08,                    //   REPORT_COUNT (8)
	0x81, 0x02,                    //   INPUT (Data,Var,Abs)
	0x95, 0x01,                    //   REPORT_COUNT (1)
	0x75, 0x08,                    //   REPORT_SIZE (8)
	0x81, 0x01,                    //   INPUT (Cnst,Ary,Abs)
	0x95, 0x05,                    //   REPORT_COUNT (5)
	0x75, 0x01,                    //   REPORT_SIZE (1)
	0x05, 0x08,                    //   USAGE_PAGE (LEDs)
	0x85, 0x01,                    //   REPORT_ID (1)
	0x19, 0x01,                    //   USAGE_MINIMUM (Num Lock)
	0x29, 0x05,                    //   USAGE_MAXIMUM (Kana)
	0x91, 0x02,                    //   OUTPUT (Data,Var,Abs)
	0x95, 0x01,                    //   REPORT_COUNT (1)
	0x75, 0x03,                    //   REPORT_SIZE (3)
	0x91, 0x03,                    //   OUTPUT (Cnst,Var,Abs)
	0x95, 0x06,                    //   REPORT_COUNT (6)
	0x75, 0x08,                    //   REPORT_SIZE (8)
	0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
	0x25, 0x65,                    //   LOGICAL_MAXIMUM (101)
	0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
	0x19, 0x00,                    //   USAGE_MINIMUM (Reserved (no event indicated))
	0x29, 0x65,                    //   USAGE_MAXIMUM (Keyboard Application)
	0x81, 0x00,                    //   INPUT (Data,Ary,Abs)
	0xc0,                          // END_COLLECTION
	0x06, 0x00, 0xff,              // USAGE_PAGE (Vendor Defined Page 1)
	0x09, 0x01,                    // USAGE (Vendor Usage 1)
	0xa1, 0x01,                    // COLLECTION (Application)
	0x85, 0x02,                    //   REPORT_ID (2)
	0x09, 0x01,                    //   USAGE (Vendor Usage 1)
	0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
	0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
	0x75, 0x01,                    //   REPORT_SIZE (1)
	0x95, 0x08,                    //   REPORT_COUNT (8)
	0xb1, 0x02,                    //   FEATURE (Data,Var,Abs)
	0xc0                           // END_COLLECTION
};

The report descriptor has been defined and tested with HID Descriptor Tool 2.4 from usb.org.

My system is the following:

  • Windows 7 Professional SP1
  • BT receiver: ASUS USB-BT400 with most recent driver installed
  • SmartRF06 + CC2650EM-7ID with original HIDEmuKbdStack (loaded without modifications) and HIDEmuKbd on which I am working
  • ble_cc26xx_2_00_00_42893
  • CCS 6.1.0.00104

Windows correctly detects the keyboard and another HID device in Device Manager.

Then I checked the HID devices with HClient and both top level collections are listed as follow:

Now using hid.dll funcions I found device #13 and I opened the handle with CreateFile.

When I use HidD_SetFeature to send feature report with id = 2, it results in a fail with last error code ERROR_BUSY (0xAA).

Has anybody suggestions to solve this issue?

Thanks

Luca

  • Hi Luca,
    Could you re-post the second image again, it's missing from the post.

    Best Regards
    Joakim
  • Hi Joakim,

    The image is online now. And I have an update to my previous post.

    I tried to use a different top level collection, not the vendor defined but the consumer devices, that windows accesses in shared mode.

    It follows below:

    static CONST uint8 hidReportMap[] =
    {
    	0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
    	0x09, 0x06,                    // USAGE (Keyboard)
    	0xa1, 0x01,                    // COLLECTION (Application)
    	0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
    	0x85, 0x01,                    //   REPORT_ID (1)
    	0x19, 0xe0,                    //   USAGE_MINIMUM (Keyboard LeftControl)
    	0x29, 0xe7,                    //   USAGE_MAXIMUM (Keyboard Right GUI)
    	0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    	0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
    	0x75, 0x01,                    //   REPORT_SIZE (1)
    	0x95, 0x08,                    //   REPORT_COUNT (8)
    	0x81, 0x02,                    //   INPUT (Data,Var,Abs)
    	0x95, 0x01,                    //   REPORT_COUNT (1)
    	0x75, 0x08,                    //   REPORT_SIZE (8)
    	0x81, 0x01,                    //   INPUT (Cnst,Ary,Abs)
    	0x95, 0x05,                    //   REPORT_COUNT (5)
    	0x75, 0x01,                    //   REPORT_SIZE (1)
    	0x05, 0x08,                    //   USAGE_PAGE (LEDs)
    	0x85, 0x01,                    //   REPORT_ID (1)
    	0x19, 0x01,                    //   USAGE_MINIMUM (Num Lock)
    	0x29, 0x05,                    //   USAGE_MAXIMUM (Kana)
    	0x91, 0x02,                    //   OUTPUT (Data,Var,Abs)
    	0x95, 0x01,                    //   REPORT_COUNT (1)
    	0x75, 0x03,                    //   REPORT_SIZE (3)
    	0x85, 0x01,                    //   REPORT_ID (1)
    	0x91, 0x03,                    //   OUTPUT (Cnst,Var,Abs)
    	0x95, 0x06,                    //   REPORT_COUNT (6)
    	0x75, 0x08,                    //   REPORT_SIZE (8)
    	0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    	0x25, 0x65,                    //   LOGICAL_MAXIMUM (101)
    	0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
    	0x19, 0x00,                    //   USAGE_MINIMUM (Reserved (no event indicated))
    	0x29, 0x65,                    //   USAGE_MAXIMUM (Keyboard Application)
    	0x81, 0x00,                    //   INPUT (Data,Ary,Abs)
    	0xc0,                          // END_COLLECTION
    	0x05, 0x0c,                    // USAGE_PAGE (Consumer Devices)
    	0x09, 0x01,                    // USAGE (Consumer Control)
    	0xa1, 0x01,                    // COLLECTION (Application)
    	0x05, 0x0c,                    //   USAGE_PAGE (Consumer Devices)
    	0x85, 0x02,                    //   REPORT_ID (2)
    	0x09, 0x01,                    //   USAGE (Consumer Control)
    	0x15, 0x80,                    //   LOGICAL_MINIMUM (-128)
    	0x25, 0x7f,                    //   LOGICAL_MAXIMUM (127)
    	0x75, 0x08,                    //   REPORT_SIZE (8)
    	0x95, 0x01,                    //   REPORT_COUNT (1)
    	0x91, 0x02,                    //   OUTPUT (Data,Var,Abs)
    	0x09, 0x01,                    //   USAGE (Consumer Control)
    	0x85, 0x02,                    //   REPORT_ID (2)
    	0xb1, 0x02,                    //   FEATURE (Data,Var,Abs)
    	0xc0                           // END_COLLECTION
    };

    HClient lists the TLC as follow:

    In this case using WriteFile() and HidD_SetOutputReport() to send out report don't work and fail.

    HidD_SetFeature() works and the feature report is received by the HID emulated keyboard device, even if the procedure results in ERROR_SEM_TIMEOUT (0x79).

    Could you suggest a solution for this issue?

    Thanks

    Luca