Closed stucki closed 8 years ago
From @Kra1o5 on September 28, 2015 11:5
Hi,
You refer to volume control or play/pause?
Greetings
From @magicdave1 on September 28, 2015 15:25
I've used it always with Apple headphones, volume control never worked with it on Android devices (I think because of switched pins or something like that). I refer to play/pause and track skipping (forward and backwards).
From @Kra1o5 on September 28, 2015 16:32
@magicdave1
Ok, @eloimuns reproduce the bug so we are looking into it.
Greetings
From @cmorlok on September 29, 2015 8:47
Seems like the keymap is missing. The keys are detected correctly by the kernel:
Keycode: 188. KeyEvent: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BUTTON_1, scanCode=256, metaState=0, flags=0x8, deviceId=2, source=0x101 }
Keycode: 190. KeyEvent: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BUTTON_3, scanCode=258, metaState=0, flags=0x8, deviceId=2, source=0x101 }
Keycode: 193. KeyEvent: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BUTTON_6, scanCode=261, metaState=0, flags=0x8, deviceId=2, source=0x101 }
For comparision, the values from the build-in buttons:
Keycode: 24. KeyEvent: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_VOLUME_UP, scanCode=115, metaState=0, flags=0x8, deviceId=10, source=0x101 }
Keycode: 25. KeyEvent: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_VOLUME_DOWN, scanCode=114, metaState=0, flags=0x8, deviceId=10, source=0x101 }
Data is fetched with keytest app.
From @cmorlok on September 29, 2015 10:24
Solution: I replaced the following lines in /system/usr/keylaout/Generic.kl
key 256 BUTTON_1
key 257 BUTTON_2
key 258 BUTTON_3
key 259 BUTTON_4
key 260 BUTTON_5
key 261 BUTTON_6
by these values (taken from Generic.kl
of the stock rom):
key 256 HEADSETHOOK
key 257 HEADSETHOOK
key 258 VOLUME_UP
key 259 HEADSETHOOK
key 260 HEADSETHOOK
key 261 VOLUME_DOWN
Headset buttons are working fine now (tested with Xiaomi Piston).
From @Kra1o5 on September 29, 2015 11:18
Fixed, will be in next build.
Thanks @cmorlok
From @magicdave1 on October 6, 2015 17:16
Still doesn't work...
From @cmorlok on October 10, 2015 13:4
@magicdave1: with which headset are you testing? Can you post the output of the keytest app (see link in my comment above)?
All the headsets I own work for with the latest release.
From @magicdave1 on October 10, 2015 13:22
I usually use the earphones from Apple. It worked on all my android phones i had like this:
Play/Pause 1x: Play/Pause Play/Pause 2x: Next track Play/Pause 3x: Previous track
Therefore only this one button is recognized. Volume up/down has not been recognized.
Keycode: 188. KeyEvent: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BUTTON_1, scanCode=256, metaState=0, flags=0x8, repeatCount=0, eventTime=67982111, downTime=67982111, deviceId=2, source=0x101 }
I also tried it with Huawei headphones which also didn't worked out. I don't have it currently in my possession, but I can deliver these values later today if it would be requested.
From @cmorlok on October 12, 2015 7:19
Scan code 256 is mapped to HEADSETHOOK, not to KEYCODE_BUTTON_1. Are you sure that you are running release 20151004 or later? If so, can you take a look at /system/usr/keylayout
? There should be a file named msm8939-snd-card-skuk_Button_Jack.kl
with this content:
key 256 HEADSETHOOK
key 257 HEADSETHOOK
key 258 VOLUME_UP
key 259 HEADSETHOOK
key 260 HEADSETHOOK
key 261 VOLUME_DOWN
# add by Wenke Ma for hall switch key code
key 546 HALL_OPEN
key 547 HALL_CLOSE
From @magicdave1 on October 12, 2015 16:27
Yes, it is the 20151004 release and the file has exactely the same content as you mentioned above.
From @cmorlok on October 12, 2015 20:45
@Kra1o5: the headset keys do not work with the mappings in msm8939-snd-card-skuk_Button_Jack.kl. Maybe the name of the sound device does not match?
From @Kra1o5 on October 12, 2015 20:48
@cmorlok not, the name is correct.
& I can see it is working with other people so is really weird.
Greetings
From @cmorlok on October 12, 2015 20:53
Another thing is weird: I did check immediately after flashing the 1004 release and the buttons worked. Today it doesn't work.
Is there any way to see for which key layouts Android looks for a specific key event?
From @Kra1o5 on October 12, 2015 20:57
@cmorlok , the keylayout event for this is HEADSETHOOK.
I cant test it yet (get my device back probably tomorrow).
From @cmorlok on October 12, 2015 21:10
@Kra1o5: Yes I know. According to the doc, the lookup order is
I just don't understand why the Button_Jack is ignored here (256 is being mapped to BUTTON_1 which is defined in Generic.kl)
Is there any way to see the kl lookup for a device or one single key event? I can't see anything related in logcat.
From @Kra1o5 on October 12, 2015 21:13
Yes, you can enabling: https://github.com/piccolo-dev/android_kernel_bq_piccolo/blob/cm-12.1-test/arch/arm/configs/cyanogenmod_piccolo_defconfig#L1480
From @cmorlok on October 12, 2015 21:17
Thanks, I will test tomorrow.
From @cmorlok on October 14, 2015 9:34
Pull request: https://github.com/piccolo-dev/android_device_bq_piccolo/pull/9
There are two things which have to be done to make headset buttons work again (at least on my 3/32GB model):
msm8939-snd-card-skuk_Button_Jack.kl
to Headset.kl
since there are to different input devices which send headset buttons (I still haven't found out which one is used in which situation).Documentation of my research:
Dmesg output with EVBUG enabled:
<7>[ 255.680728] evbug: Event. Dev: input11, Type: 1, Code: 256, Value: 1
<7>[ 255.680772] evbug: Event. Dev: input11, Type: 0, Code: 0, Value: 0
According to getevent -il
, input11 is
add device 1: /dev/input/event11
bus: 0000
vendor 0000
product 0000
version 0000
name: "Headset"
location: "arizona/extcon"
id: ""
version: 1.0.1
events:
KEY (0001): 0074 0100 0101 0102 0103 0104 0105
input props:
<none>
while msm8939-snd-card-skuk_Button_Jack is input9:
add device 1: /dev/input/event9
bus: 0000
vendor 0000
product 0000
version 0000
name: "msm8939-snd-card-skuk Button Jack"
location: "ALSA"
id: ""
version: 1.0.1
events:
KEY (0001): 00e2 0101 0102 0103 0104
input props:
<none>
By the way: hall-switch is input3:
add device 1: /dev/input/event3
bus: 0000
vendor 0000
product 0000
version 0000
name: "hall-switch-input"
location: ""
id: ""
version: 1.0.1
events:
KEY (0001): 0222 0223
input props:
0004
But this is not correct: Headset and Button Jack do both use Generic.kl:
# dumpsys input
INPUT MANAGER (dumpsys input)
Event Hub State:
BuiltInKeyboardId: -2
Devices:
...
2: Headset
Classes: 0x00000001
Path: /dev/input/event11
Descriptor: e9fbccb20aa36714786b4afad1fe05a9b8b78370
Location: arizona/extcon
ControllerNumber: 0
UniqueId:
Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
KeyLayoutFile: /system/usr/keylayout/Generic.kl
KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
ConfigurationFile:
HaveKeyboardLayoutOverlay: false
...
4: msm8939-snd-card-skuk Button Jack
Classes: 0x00000001
Path: /dev/input/event9
Descriptor: 5aa13dbc4939097d49a640fe7fa61e356fb701fb
Location: ALSA
ControllerNumber: 0
UniqueId:
Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
KeyLayoutFile: /system/usr/keylayout/Generic.kl
KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
ConfigurationFile:
HaveKeyboardLayoutOverlay: false
What's going wrong here? I do have non-Generic keylayouts which should be used:
# ls /system/usr/keylayout/
AVRCP.kl
Generic.kl
Headset.kl
Vendor_....kl
atmel_mxt_ts_T100_touchscreen.kl
gpio-keys.kl
msm8939-snd-card-skuk_Button_Jack.kl
qwerty.kl
Solution: keylayout file is invalid and thus ignored.
(Note: copy of the original issue failed, so I'm stopping here because the original issue was already closed. Reference: https://github.com/piccolo-dev/android_device_bq_piccolo/issues/5)
From @magicdave1 on September 25, 2015 18:8
Tested with Apple headphones and headphones which were with an Android phone, both doesn't work.
_Copied from original issue: piccolo-dev/android_device_bqpiccolo#5