View Single Post
Old 12-27-2011, 08:22 AM   #2
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
UPDATE: I replaced /proc/input with /dev/input below. It should work "more better" now. Sorry about that.
Quote:
Originally Posted by sptrks View Post
I am trying to find out how to access the raw data from the touch's accelerometer and or sensors in general.

I have done some searches of this forum and have had no luck finding such information. If I missed something feel free to link me to the relevant post.


Thanks
I was playing with the accelerometer data yesterday with
cat /dev/input/event3
It emits a packet of binary data that appears to start with a timestamp.
If you shake the touch top-to-bottom or side-to-side, it emits one or more data packets with each direction change. It also emits data packets for side-to-side changes. When held vertically with the display towards you, rotating it also emits data packets when it crosses 45-degree angle boundaries, due to gravity sensing. You do not need to "enable" the accelerometer to receive this data.

The "shake mode" could be used with the media player to skip forward or back. The "gravity sensing mode" could be used to rotate the display. (Code changes would be required, of course.)

What I find interesting about this is that the accelerometer works great even though the bootup messages indicate that no accelerometer was found.

The touchscreen data is emitted from
cat /dev/input/event4
and it also emits binary packets that are 16-bytes long and start with a timestamp. The timestamp is useful for measuing velocity and acceleration of your finger or stylus on the display. It reports the touch position for up to two contact points. When no touch, no data emitted. (Experimentation shows that a stylus must be fairly thick, like a chopstick from a Chinese restaurant, and must be held perpendicular to the screen).

The touch must be awake (not is screensaver mode) to receive data from these devices.

There are also some /proc/ ports (buried inside /sys/) that report such things as how many fingers are touching the touchscreen (0, 1, or 2), battery voltage, temperature of battery (degrees F), temperature of display (degrees C), and much more.

EDIT: It is easier to analyzer the data packets with
hd /dev/input/event3
and
hd /dev/input/event3
because hd does a hexdump already formatted into 16-byte columns that match the packet size emitted by these devices.

Last edited by geekmaster; 12-27-2011 at 10:21 PM.
geekmaster is offline   Reply With Quote