i2c-gsensor: LIS3LV02DL accelerometer on HTC Shift G-Sensor
The “feature” commercially advertised as G-Sensor in HTC Shift turned out to be a STMicroelectronics LIS3LV02DL 3-axis inertial sensor [datasheet], which of course can be accessed through linux i2c/SMBus interface :)
Actually there’s a Linux kernel module for the HP Mobile Data Protection System 3D (mdps) by Yan Burman, which is the same accelerometer used in some HP laptops, however those laptops have the accelerometer connected through an SPI interface instead of i2c, so the driver is not suitable for the HTC Shift as it is, but maybe in the future… ;)
As a proof of concept, here’s an small userland tool that will show the output of X,Y,Z axis when moving the HTC Shift, just as if it was the Wii Remote :) To use it you need to modprobe i2c_i801 and i2c_dev modules first.
Download: i2c-gsensor.tar.gz.
Update (05/06/2008): gsensor-joy : HTC Shift G-Sensor Joystick Linux kernel module