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

[HOGP] Android auto-plays music when hogp devices disconnect

Hi all, I can control volume up/down, music play/pause with the ble_hids module.

static uint8_t report_map_data[] = { 0x05, 0x0c, // Usage Page (consumer device) 0x09, 0x01, // Usage (consumer control) 0xA1, 0x01, // Collection (application)

0x09, 0xB0,                 //     Usage (play)
0x09, 0xB1,                 //     Usage (pause)
0x09, 0xB7,                 //     Usage (stop)
0x09, 0xB5,                 //     Usage (next)
0x09, 0xB6,                 //     Usage (previous)
0x09, 0xCF,                 //     Usage (voice command)
0x15, 0x01,                 //     Logical Minimum (1)
0x25, 0x06,                 //     Logical Maximum (6)
0x75, 0x04,                 //     Report Size (4 bit)
0x95, 0x01,                 //     Report Count (1)
0x81, 0x00,                 //     INPUT (Data, Array, Absolute)

0x09, 0xE9,                 //     Usage (Volume Up)
0x09, 0xEA,                 //     Usage (Volume Down)
0x15, 0x01,                 //     Logical Minimum (1)
0x25, 0x02,                 //     Logical Maximum (2)
0x75, 0x02,                 //     Report Size (2 bit)
0x95, 0x01,                 //     Report Count (1)
0x81, 0x00,                 //     INPUT (Data, Array, Absolute)

0x05, 0x07,                 //     Usage Page (keyboard)
0x09, 0x58,                 //     Usage(return)
0x09, 0x28,                 //     Usage(enter)
0x15, 0x01,                 //     Logical Minimum (1)
0x25, 0x02,                 //     Logical Maximum (2)
0x75, 0x02,                 //     Report Size (2 bit)
0x95, 0x01,                 //     Report Count (1)
0x81, 0x00,                 //     INPUT (Data, Array, Absolute)

0xC0                        // End Collection (Application)

};

But whenever bluetooth device on Android is closed or ble connection drops, the music player auto start playing music.
Parents Reply
  • We test the descriptor with the following android device: [device]-----------[android version]--------[test result]

    • xiaomi 4 4.4.4 auto play on disconnection
    • huawei mate 7 4.4.4 auto play on disconnection
    • LG nexus5 6 play/pause usage is of no use
    • samsung s4 5.0.1 ok
    • iphone 4s/5/6/6s ok

    We confirm that after removing "play" usage, everything goes fine.

    PS. The "auto play on disconn" happens on the following situations.

    • Turn off bluetooth switch on android.
    • Remove power of ble peripheral.
    • Move peripheral out of ble connection range.
Children
No Data
Related