This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Modify ble_app_hids_keyboard to be able to send Volumn_up/down keys

Hello, sorry if this is a stupid question.I'm using a nRF51822, SDK6.0.0 and S110 7.0.0.I want to modify ble_app_hids_keyboard to be able to send Volumn_up/down keys to android phone.I have search the question in developer zone, and find out 3 parts which need to be modified.

1.USB descriptors,that is reportmap in main.The following is the content of my code.

0x05,0x0C, //(GLOBAL) USAGE_PAGE 0x000C Consumer Device Page 
0x09,0x01, //(LOCAL) USAGE 0x000C0001 Consumer Control (CA=Application Collection) 
0xA1,0x01, //(MAIN) COLLECTION 0x01 Application (Usage=0x000C0001: Page=Consumer Device Page, Usage=Consumer Control, Type=CA)
0x85,0x01, //(GLOBAL) REPORT_ID 0x01 (1) 
0x19,0x01, //(LOCAL) USAGE_MINIMUM 0x000C0001 Consumer Control (CA=Application Collection) 
0x2A,0x9C,0x02, //(LOCAL) USAGE_MAXIMUM 0x000C029C AC Distribute Vertically (Sel=Selector) 
0x15,0x01, //(GLOBAL) LOGICAL_MINIMUM 0x01 (1) 
0x26,0x9C,0x02, //(GLOBAL) LOGICAL_MAXIMUM 0x029C (668) 
0x95,0x01, //(GLOBAL) REPORT_COUNT 0x01 (1) Number of fields 
0x75,0x10, //(GLOBAL) REPORT_SIZE 0x10 (16) Number of bits per field 
0x81,0x00, //(MAIN) INPUT 0x00000000 (1 field x 16 bits) 0=Data 0=Array 0=Absolute 0=Ignored 0=Ignored 0=PrefState 0=NoNull 
0xC0 //(MAIN) END_COLLECTION Application

2.Modify keys_send(1, p_key) to keys_send(2, p_key) or keys_send(3, p_key), according to 2 bytes or 3 bytes.

3.Modify m_sample_key_press_scan_str.The following is the tried combinations.


2 bytes 0x00, 0xE9

0x01, 0xE9

3 bytes 0x01, 0xE9, 0x00

0x00, 0xE9, 0x00

Nevertheless, the device is still recognized as a keyboard.Just can only send the letters on the keyboard to android phone.Can someone give me some tips?Thanks.

Parents
  • Dear Hakon,

    I am trying for some days now to add the consumer control to the HID, without success. That's how I found your post, unfortunately even after merging the changes, the volume up/down is not received by the Android phone.. I am using SDK10 PCA100028 (nrf51422 ev.board) with S110.

    Any sort of input is welcomed, I am loosing my mind with these TLC's..

  • Hi,

    i'm running the ble_app_hids_keyboard example in SDK9 with an Android phone, the phone is able to find it and connect, after connected, the string "hello" is sent to the phone, no problem. But when i switch off the Bluetooth in Android's setting and switch on again, although the "nordic_keyboard" will auto re-connect with the phone, but this time, none of the letters were sent. the error code of "send_key_scan_press_release" is 0x3401.

    any idea why this is happening? if i unpair the nordic_keyboard and pair with phone again, everything backs to normal. any help or suggestion is appreciated..

    thanks very much,

Reply
  • Hi,

    i'm running the ble_app_hids_keyboard example in SDK9 with an Android phone, the phone is able to find it and connect, after connected, the string "hello" is sent to the phone, no problem. But when i switch off the Bluetooth in Android's setting and switch on again, although the "nordic_keyboard" will auto re-connect with the phone, but this time, none of the letters were sent. the error code of "send_key_scan_press_release" is 0x3401.

    any idea why this is happening? if i unpair the nordic_keyboard and pair with phone again, everything backs to normal. any help or suggestion is appreciated..

    thanks very much,

Children
No Data
Related