![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Loading accelerometer driver in 5.1.0
Hi all!
I wanted to experiment with the accelerometer built into the Kindle Touch, but the FW version 5.1.0 doesn't load necessary driver automatically when booted in main (unlike the previous versions), so there's not /dev/input/event* for the accelerometer device. I tried to load the driver manually from the diags partition: Code:
mount /dev/mmcblk0p2 /mnt/mmc/ insmod /mnt/mmc/lib/modules/2.6.31-rt11-lab126/kernel/drivers/hwmon/hwmon.ko insmod /mnt/mmc/lib/modules/2.6.31-rt11-lab126/kernel/arch/arm/mach-mx5/mx50_yoshi_mma8453.ko Code:
Module Size Used by mx50_yoshi_mma8453 8836 0 hwmon 2160 1 mx50_yoshi_mma8453 |
![]() |
![]() |
![]() |
#2 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
On the K5 5.0.0, you can use the "waitforkey" command to see accelerometer rotation events (which return key codes just like the home button press and touch events). You can also interrogate events with "evtest". Last edited by geekmaster; 06-28-2012 at 11:49 AM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
Look in /etc/udev and /etc/udev.d of a copy of both versions of the image. The missing or commented out rule(s) should be easy to find. |
|
![]() |
![]() |
![]() |
#4 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
I compared folders /etc/udev/ and /usr/libexec/rules.d/ from FW versions 5.0.0 and 5.1.0 in WinMerge. They are identical, except one irrelevant change about USB/charger. I can't figure out how it could work in 5.0.0.
|
![]() |
![]() |
![]() |
#5 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Then it wasn't automated in 5.0.0, it was scripted somewhere.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Probably scripted on 5.1.0 as well, with an upstart rule to run it on orientation activated from the settings (or app) menu, and perhaps kill it on orientation disabled from the menu. If I had my K5 with me, I would look in the upstart scripts. For now, I will have to leave it up to others to look there...
|
![]() |
![]() |
![]() |
#7 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
#8 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
I seem to recall some accelerometer init stuff in u-boot source code (but not sure). I wonder if that is different. Hmm... Not in the kernel or the scripts? I wonder if there is a lipc command for it, called from the framework menu?
Last edited by geekmaster; 06-29-2012 at 07:29 AM. |
![]() |
![]() |
![]() |
#9 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
I've found some stuff in uboot sources about accelerometer (probably checking if the accelerometer is connected to the bus), but it is not very helpful. I'm giving up. They've really screwed Kindle with this FW version.
|
![]() |
![]() |
![]() |
#10 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 405
Karma: 2330752
Join Date: May 2012
Device: kt
|
In 5.1 kernel they build it without mma8453. In arch/arm/mach-mx5/mx50_yoshi.c:
Code:
static struct i2c_board_info mxc_i2c0_board_info[] = { { .type = "MX50_Proximity", .addr = 0x0D, }, #ifdef CONFIG_MX50_YOSHI_MMA8453 { .type = "mma8453", .addr = 0x1C, }, #endif }; However I scanned i2c bus and device with address 0x1c is located on bus 0: Code:
[root@kindle test]# ./i2cdetect 0 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c/0. I will probe address range 0x03-0x77. Continue? [Y/n] 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- 1c -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- Code:
[root@kindle test]# echo mma8453 0x1c > /sys/devices/virtual/i2c-adapter/i2c-0/new_device Code:
i2c-adapter i2c-0: The new_device interface is still experimental and may change in a near future input: mma8453 as /devices/virtual/i2c-adapter/i2c-0/0-001c/input/input5 check mma8453 chip ID mma8453 0-001c: build time Nov 9 2011 15:38:29 i2c-adapter i2c-0: new_device: Instantiated device mma8453 at 0x1c |
![]() |
![]() |
![]() |
#11 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
![]() ![]() |
|
![]() |
![]() |
![]() |
#12 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Thank you all very much for the help (especially baf)! It works great.
![]() |
![]() |
![]() |
![]() |
#13 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
|
Here's small auto-rotate script I've created:
Code:
#!/bin/sh mount /dev/mmcblk0p2 /mnt/mmc insmod /mnt/mmc/lib/modules/2.6.31-rt11-lab126/kernel/drivers/hwmon/hwmon.ko insmod /mnt/mmc/lib/modules/2.6.31-rt11-lab126/kernel/arch/arm/mach-mx5/mx50_yoshi_mma8453.ko umount /dev/mmcblk0p2 echo mma8453 0x1c > /sys/devices/virtual/i2c-adapter/i2c-0/new_device while true; do ROTATION=`hexdump -n16 /dev/input/event4|line|cut -f7 -d' '|cut -c4`; [ "$ROTATION" == "b" ] && SET_TO='U'; [ "$ROTATION" == "c" ] && SET_TO='D'; [ "$ROTATION" == "d" ] && SET_TO='L'; [ "$ROTATION" == "e" ] && SET_TO='R'; lipc-set-prop com.lab126.winmgr orientationLock "$SET_TO"; done |
![]() |
![]() |
![]() |
#14 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 405
Karma: 2330752
Join Date: May 2012
Device: kt
|
I noticed that driver writes current orientation to /sys/devices/system/mma8453_rotation/mma8453_rotation0/mma8453_rotation
It is easier to read it from this file. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Accessing accelerometer data from kindle touch | sptrks | Kindle Developer's Corner | 18 | 01-14-2012 03:18 AM |
Accelerometer | bart34 | Which one should I buy? | 5 | 07-13-2011 02:38 PM |
903 How to turn off accelerometer? | osowiecki | PocketBook | 4 | 02-21-2011 03:38 AM |
PB360: 3D Accelerometer funktioniert nicht | kbaerwald | PocketBook | 13 | 11-02-2010 06:31 AM |
How to disable the accelerometer ? | askyn | PocketBook | 4 | 05-23-2010 12:38 PM |