New Bluetooth HID device scancode incorrect


nAbd3Z

Members
Jan 7, 2020
7
13
Hi,
I have a cheap bluetooth media button, similar to this https://www.amazon.co.uk/Satechi-Bluetooth-Button-compatible-Samsung-Media/dp/B00RM75NL0
I've tested on another phone and it's okay, so I believe it's an OS issue.

Volume Up, Down, Next track work.
Media previous is being remapped to volume up though.

I can't see where this happens though:
$ adb logcat -e scanCode
--------- beginning of system
--------- beginning of crash
--------- beginning of main
07-20 12:17:13.557 2098 2224 I EventHub: mapKey: scanCode=165, changed to scanCode=257 .
07-20 12:17:13.588 17888 17888 D ViewRootImpl: [TouchInput][ViewRootImpl] KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_VOLUME_UP, scanCode=165, metaState=0, flags=0x8, repeatCount=0, eventTime=36238401, downTime=36238401, deviceId=10, source=0x101, displayId=-1 }
07-20 12:17:13.588 2098 2224 I EventHub: mapKey: scanCode=165, changed to scanCode=257 .
07-20 12:17:13.603 2098 9484 D MediaSessionService: dispatchVolumeKeyEvent, pkg=amirz.rootless.nexuslauncher, opPkg=amirz.rootless.nexuslauncher, pid=17888, uid=10183, asSystem=true, event=KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_VOLUME_UP, scanCode=165, metaState=0, flags=0x8, repeatCount=0, eventTime=36238401, downTime=36238401, deviceId=10, source=0x101, displayId=-1 }, stream=-2147483648, musicOnly=false
07-20 12:17:13.604 17888 17888 D ViewRootImpl: [TouchInput][ViewRootImpl] KeyEvent { action=ACTION_UP, keyCode=KEYCODE_VOLUME_UP, scanCode=165, metaState=0, flags=0x8, repeatCount=0, eventTime=36238429, downTime=36238401, deviceId=10, source=0x101, displayId=-1 }
07-20 12:17:13.613 2098 9484 D MediaSessionService: dispatchVolumeKeyEvent, pkg=amirz.rootless.nexuslauncher, opPkg=amirz.rootless.nexuslauncher, pid=17888, uid=10183, asSystem=true, event=KeyEvent { action=ACTION_UP, keyCode=KEYCODE_VOLUME_UP, scanCode=165, metaState=0, flags=0x8, repeatCount=0, eventTime=36238429, downTime=36238401, deviceId=10, source=0x101, displayId=-1 }, stream=-2147483648, musicOnly=false



It is being received correctly though
"scanCode=165" is media previous.

I've checked the files in these locations:
and it appears to be correctly setup.
I don't understand why it's being re-mapped to volume up.


perseus:/system/usr/keylayout # grep 165 *
AVRCP.kl:key 165 MEDIA_PREVIOUS
Generic.kl:key 165 MEDIA_PREVIOUS
Vendor_046d_Product_b501.kl:key 165 MEDIA_PREVIOUS
Vendor_046d_Product_c532.kl:key 165 MEDIA_PREVIOUS
Vendor_05ac_Product_0239.kl:key 165 MEDIA_PREVIOUS
Vendor_22b8_Product_093d.kl:key 165 MEDIA_PREVIOUS
qwerty.kl:key 165 MEDIA_PREVIOUS


ROM version is 20.7.16, but I also saw the issue on 20.6.11

the phone is a mi mix 3