Project

General

Profile

Actions

AKM8976A » History » Revision 9

« Previous | Revision 9/14 (diff) | Next »
Paul Kocialkowski, 07/03/2011 10:23 AM


= AKM8976A =

The goal here is to add support for AKM8976A to akmd-free (a free rewrite of akmd, the daemon that deals with the accelerometer/magnetometer data for a few chips, including AKM ones).
This page is to coordinate the work around this goal.

Current status

=== Global tasks achievement ===

Task Achievement
Modifying the kernel driver to print the requests akmd makes (ioctl, etc) [[span(Done , style=background: green; color: white; display: inline-block; width: 100%;)]]
Get an idea of how it works (what akmd does after what) [[span(Done , style=background: green; color: white; display: inline-block; width: 100%;)]]
Define the exact steps that akmd follows [[span(Done , style=background: green; color: white; display: inline-block; width: 100%;)]]
Implement AKM8976A in akmd-free without any data treatment yet [[span(Done , style=background: green; color: white; display: inline-block; width: 100%;)]]
Understand how the data is treated (algorithms, etc) [[span(Work in progress , style=background: orange; color: white; display: inline-block; width: 100%;)]]
Reproduce the data treatment with standard C code [[span(Work in progress , style=background: orange; color: white; display: inline-block; width: 100%;)]]
Include the data treatment code in akmd-free [[span(TODO , style=background: red; color: white; display: inline-block; width: 100%;)]]
Check that everything is OK on different devices [[span(TODO , style=background: red; color: white; display: inline-block; width: 100%;)]]

=== Specific tasks achievement ===

==== Initialization/calibration sequence ====

|| Task || Global achievement || Understood || Reproduced || Implemented || || Before the first ECS_IOCTL_GETDATA || [[span(Mostly done , style=background: orange; color: white; display: inline-block; width: 100%;)]] || [[span(Done , style=background: green; color: white; display: inline-block; width: 100%;)]] || [[span(Done , style=background: green; color: white; display: inline-block; width: 100%;)]] || [[span(TODO , style=background: red; color: white; display: inline-block; width: 100%;)]]

Getting started

Note that before everything, coming on our IRC channel [https://www.jappix.com/?r=replicant%25irc.freenode.net@irc.jappix.com #replicant on irc.freenode.net] and introducing yourself is essential: you'll be able to get help there and, of course, if you want to join the effort, communication is fundamental.

If you plan to join the effort to achieve this goal, here are the steps:

  • Downloading and setting up the akm8976a-dev branch for kernel-msm (which contains a modified version of ''drivers/misc/akm8976.c'')
  • Downloading some scripts that are useful to debug fast
  • Download and build the re_set_data tool (to inject some data to the kernel)
  • Generate the file containing the "phone" button pressed sequence.
  • Get the non-free akmd.
Using the scripts/tools

First of all, you need to know that the kernel-side driver that is used for AKM8976A is located at ''drivers/misc/akm8976.c''.
This file has been modified in order to: * make it trace (print) all the ioctl * make it possible to inject data

Note that before you run any of the scripts, you need to start adb server as root: {{{ # adb start-server }}}

Here is a list of the scripts, what they do and how to use them: * '''replicant_kern_debug.sh''': this one is to get the debug messages from the kernel. It requires no special parameter, nor any specific location to be lunched in. * '''replicant_calib_kern.sh''': this script should be used while working on the calibration part. The 2 remaining initialisation sequences we miss start with { 4, 235 } and { 4, 241 } and this script is to print the calibration values for these sequences (when the kernel printk the values, so when akmd sends them). To use it, pass 235 or 241 as first argument to the script, for the first or 2nd initialisation sequence we miss. * '''replicant_calib_adb.sh''': this script should be used while working on the calibration part. This script has to be ran in the directory containing ''akmd_set_dev.txt'' and ''re_set_data.txt''. You can also pass the directory containing these files as first argument to the script. In the correct order, this script: * copies the ''akmd_set_dev.txt'' file to ''/data/misc/akmd_set.txt'' (akmd calibration file) * copies the ''re_set_data.txt'' file to ''/data/re_set_data.txt'' (retro engineering file, which contains the values to force as ECS_IOCTL_GETDATA returning values) * lunches ''/data/re_set_data load'' to inject the values from ''/data/re_set_data.txt'' to the kernel * lunches ''akmd'', which won't do anything if the phone is in sleep mode (black screen). * inject ''/data/suspend_wake'' to ''/dev/input/event4'' (the buttons event node) to wakeup the phone * wait for akmd to perform the initialisation sequence, that you should see with '''replicant_calib_kern.sh'''. * kill akmd * inject ''/data/suspend_wake'' to ''/dev/input/event4'' (the buttons event node) to put the phone in sleep mode

You can also avoid the use of the scripts and directly run the needed commands: * '''adb push akmd_set_dev.txt /data/misc/akmd_set.txt''': this is to copy ''akmd_set_dev.txt'' (akmd calibration file) to its correct location on the device. You need to run that in the directory where ''akmd_set_dev.txt'' is. * '''adb push re_set_data.txt /data/re_set_data.txt''': this is to copy ''re_set_data.txt'' (retro engineering file, which contains the values to force as ECS_IOCTL_GETDATA returning values)to its correct location on the device. You need to run that in the directory where ''re_set_data.txt'' is. * '''adb shell "/data/re_set_data load"''': this is to inject the values from ''/data/re_set_data.txt'' to the kernel driver. * '''adb shell /data/akmd''': this is to start the non-free akmd daemon. * '''adb shell "cat /data/suspend_wake > /dev/input/event4"''': this is to inject the "phone" button pressed event, so it will either wakeup the phone or set it in sleep mode. * '''adb shell "killall akmd"''': this is to kill the non-free akmd daemon. * '''adb shell "echo 8 > /proc/sys/kernel/printk && cat /proc/kmsg"''': this is to set the verbosity level of the kernel messages to high and print the messages.

Updated by Paul Kocialkowski over 13 years ago · 9 revisions

Also available in: PDF HTML TXT