Monday, September 17, 2012

Dell Latitude Freefall Sensor On Linux

Dell Latitude laptops come with a freefall sensor which is essentially a hidden accelerometer exposed to the system as an ACPI device, SMO8800. In Windows the device shows up as ACPI\SMO8800 for which Dell provides a driver. Unfortunately there is no existing Linux driver for this device until now that is :-)

I have written a Linux driver for this device after reverse engineering the DSDT tables of the laptop. This is how the device shows up in DSDT:

Scope (\_SB.PCI0)
    {
        Device (A_CC)
        {
            Name (_HID, "SMO8800")
            Method (_STA, 0, NotSerialized)
            {
                Return (0x0F)
            }

            Name (_UID, One)
            Name (BUF2, ResourceTemplate ()
            {
                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )
                {
                    0x00000017,
                }
            })
            Method (_CRS, 0, Serialized)
            {
                Return (BUF2)
            }

            Method (_SRS, 1, Serialized)
            {
                Return (BUF2)
            }
        }
    } 

Essentially the device uses IRQ 23 to notify the system whenever it detects a free fall. Note that it does not expose any IO ports for more general programming or reading 3 Axes acceleration values.

I started with a basic Linux driver which detected freefall conditions and just did a printk(). I eventually enhanced the driver to add the /dev/freefall interface similar to LIS3LV02DL driver.

Grab the driver source from https://github.com/sonals/SMO8800

Update (June 11, 2014)

Thanks to Pali Rohár. The driver has been upstreamed; it would appear in Linux kernel 3.16.

4 comments:

Unknown said...

Hi,I Found this post via google.
Your work is much appreciated.
But I am a linux newbie, so can u tell me how to install this?
I have tried make but not succeed.
Thanks!

Unknown said...

Is there a script that can link the driver's output to hdapsd or a similar program to park the drive heads? Unfortunately I don't have the programming/scripting skill to do it myself.

Florian Echtler said...

Neat! Is it also possible to get the raw accelerometer values?

Unknown said...

I'd love to use this sensor to trigger a change in DPI or screen resolution. I use my laptop often at a desk, and often in moving vehicles. In the latter, I can't focus as well on smaller details. So it would be nice to auto adjust based on vibration.

Anyone know how to trigger a script, please comment here!