1、externalbluetoothbluezaudiocontrol.c(1) 按键的MAPstatic struct const char *name; uint8_t avrcp; uint16_t uinput; key_map = PLAY, PLAY_OP, KEY_PLAYCD ,STOP, STOP_OP, KEY_STOPCD ,PAUSE, PAUSE_OP, KEY_PAUSECD ,FORWARD, FORWARD_OP, KEY_NEXTSONG ,BACKWARD, BACKWARD_OP, KEY_PREVIOUSSONG ,REWIND, REWIND_OP, K
2、EY_REWIND ,FAST FORWARD, FAST_FORWARD_OP, KEY_FASTFORWARD , NULL ;(2) 按键处理static void handle_panel_passthrough(struct control *control, for (i = 0; key_mapi.name != NULL; i+) uint8_t key_quirks; if (operands0 & 0x7F) != key_mapi.avrcp) continue; DBG(AVRCP: %s %s, key_mapi.name, status); key_quirks =
3、 control-key_quirkskey_mapi.avrcp; if (key_quirks & QUIRK_NO_RELEASE) if (!pressed) DBG( Ignoring release); break; DBG( treating key press as press + release send_key(control-uinput, key_mapi.uinput, 1);uinput, key_mapi.uinput, 0); break; send_key(control-uinput, key_mapi.uinput, pressed); break; HC
4、IDUMP数据分析以Sony耳机DRC-BT15为例#adb shell#hcidump X左键: ACL data: handle 12 flags 0x02 dlen 12 L2CAP(d): cid 0x0042 len 8 psm 0 0000: 30 11 0e 00 48 7c 4c 00 0.H|L.uinput = fffffffe,send_key = 201对应MEDIA_PLAY_PAUSE operands0 = c6 (= 0x46 0x80 表示按键释放了) key_quirks = 0, pressed = 0按键释放uinput = fffffffe,send_key = 201 对应MEDIA_PLAY_PAUSE再按一次”“播放/暂停键”: operands0 = 44 对应PLAY_OP key_quirks = 0, pressed = 1 按键按下uinput = fffffffe,send_key = 200 对应MEDIA_PLAY_PAUSE - handle_panel_passth