Hi,
I wrote a patch to make the Moto G recognize the buttons of headsets/headphones. The hardware is capable of detecting the buttons, Motorola simply didn't write the code for it because at the time Android was not able to make use of them.
I have a minor problem that I can't easily overcome without help.
The chip that takes care of the detection simply reports some value when a button is pressed and this value depends on the specific headset used. It's up to the kernel decide what to do with that value. Each headset implements the buttons in a different way, so I need to gather some data. I think there's some sort of standard in the industry, so probably it will be possible to implement a generic solution (how can other devices do that otherwise?).
At the following address, you can find a simple patch that makes the kernel print that value whenever a button is pressed. It really does nothing other than that.
To get the data I need, run from Terminal Emulator/adb the following (as root):
(the command must be stopped manually: close Terminal Emulator/Ctrl+C/Vol down+C etc...)
Now, every time you press a button, you should see a new line (maybe more), for instance:
I'm interested in those values and their corresponding button, i.e. the button you pressed to get the line.
The value is not constant, you'll get different values for the same button. It's not a problem.
EDIT: I forgot to mention that the prebuilt kernel here below is for falcon. If you are using CM made for falcon, then this image is OK.
At the following address you can find a prebuilt kernel image made for the current CyanogenMod 12.1, anything not too distant from the currently nightly should be fine (I built the kernel three days ago) (do whatever you want with this prebuilt image, mirror it, repackages it etc...):
Sources:
If you want to test the prebuilt kernel image without flashing it, use fastboot:
In this way, all you need to go back to your kernel is rebooting the phone.
PS: Most likely headsets made by Apple won't be recognized.
I wrote a patch to make the Moto G recognize the buttons of headsets/headphones. The hardware is capable of detecting the buttons, Motorola simply didn't write the code for it because at the time Android was not able to make use of them.
I have a minor problem that I can't easily overcome without help.
The chip that takes care of the detection simply reports some value when a button is pressed and this value depends on the specific headset used. It's up to the kernel decide what to do with that value. Each headset implements the buttons in a different way, so I need to gather some data. I think there's some sort of standard in the industry, so probably it will be possible to implement a generic solution (how can other devices do that otherwise?).
At the following address, you can find a simple patch that makes the kernel print that value whenever a button is pressed. It really does nothing other than that.
Code:
https://pastebin.com/raw.php?i=h9dnhmKrCode:
cat /proc/kmsg | grep TPANow, every time you press a button, you should see a new line (maybe more), for instance:
Code:
<6>[ 97.148228,0] TPA: value: 67The value is not constant, you'll get different values for the same button. It's not a problem.
EDIT: I forgot to mention that the prebuilt kernel here below is for falcon. If you are using CM made for falcon, then this image is OK.
At the following address you can find a prebuilt kernel image made for the current CyanogenMod 12.1, anything not too distant from the currently nightly should be fine (I built the kernel three days ago) (do whatever you want with this prebuilt image, mirror it, repackages it etc...):
Code:
https://mega.nz/#!7A4SjQqZ!DPzO18k56e9364PciH7RC6rVCbrkuuUyqAcX9eFyd4ICode:
https://github.com/CyanogenMod/android_kernel_motorola_msm8226/ at acfe66c6fee + patch linked here aboveCode:
fastboot boot path/to/the/boot.imgPS: Most likely headsets made by Apple won't be recognized.
Aucun commentaire:
Enregistrer un commentaire