ads

Affichage des articles dont le libellé est detection. Afficher tous les articles
Affichage des articles dont le libellé est detection. Afficher tous les articles

vendredi 11 septembre 2015

[WIP] Headset buttons detection



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.

Code:


https://pastebin.com/raw.php?i=h9dnhmKr

To get the data I need, run from Terminal Emulator/adb the following (as root):

Code:


cat /proc/kmsg | grep TPA

(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:

Code:


<6>[  97.148228,0] TPA: value: 67

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...):

Code:


https://mega.nz/#!7A4SjQqZ!DPzO18k56e9364PciH7RC6rVCbrkuuUyqAcX9eFyd4I

Sources:

Code:


https://github.com/CyanogenMod/android_kernel_motorola_msm8226/ at acfe66c6fee + patch linked here above

If you want to test the prebuilt kernel image without flashing it, use fastboot:

Code:


fastboot boot path/to/the/boot.img

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.



jeudi 10 septembre 2015

Help about sim cards detection.



Hello, and thanks for helping me: I've used a Z7 Max since many month on 3.08 flashed on my phone without any problems. but after having flashed a new rom today (yirom's CM12), the phone cannot detect any sim, in no one slot.
I've tried to go back to 3.08, with nubia tool updater and with twrp recovery, but even after full wipes, impossible to detect sim cards. If I Check Msim settings, it says "deactivate", not "no card".
The phone never answer sim lock pin .
Is there a way to get out of there? Thank you very much and sorry for my english.