Last active
August 29, 2015 14:22
-
-
Save jadonk/ebeef7fb784226fdc80b to your computer and use it in GitHub Desktop.
Install LSM303DLHC driver on BeagleBone (Debian)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
apt-get install linux-headers-`uname -r` | |
mkdir lsm303 | |
cd lsm303 | |
wget http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/driver/stsw-mems026.tar | |
tar xvf stsw-mems026.tar | |
tar xvf lsm303dlhc.v.1.0.13.tar | |
cat <<MAKEFILE >Makefile | |
obj-m += lsm303dlhc_acc.o | |
obj-m += lsm303dlhc_mag.o | |
MAKEFILE | |
cp lsm303dlhc.h /lib/modules/`uname -r`/build/include/linux/input/ | |
# Note: http://elinux.org/Kernel_3.4_to_3.10_porting_guide | |
patch -p0 <<PATCH | |
--- lsm303dlhc_acc.c.orig 2015-05-28 02:21:48.419725347 +0000 | |
+++ lsm303dlhc_acc.c 2015-05-28 02:25:49.009569126 +0000 | |
@@ -1547,7 +1547,7 @@ | |
return err; | |
} | |
-static int __devexit lsm303dlhc_acc_remove(struct i2c_client *client) | |
+static int lsm303dlhc_acc_remove(struct i2c_client *client) | |
{ | |
struct lsm303dlhc_acc_status *stat = i2c_get_clientdata(client); | |
@@ -1610,7 +1610,7 @@ | |
.name = LSM303DLHC_ACC_DEV_NAME, | |
}, | |
.probe = lsm303dlhc_acc_probe, | |
- .remove = __devexit_p(lsm303dlhc_acc_remove), | |
+ .remove = lsm303dlhc_acc_remove, | |
.suspend = lsm303dlhc_acc_suspend, | |
.resume = lsm303dlhc_acc_resume, | |
.id_table = lsm303dlhc_acc_id, | |
--- lsm303dlhc_mag.c.orig 2015-05-28 02:35:34.734178571 +0000 | |
+++ lsm303dlhc_mag.c 2015-05-28 02:38:15.105272340 +0000 | |
@@ -45,6 +45,7 @@ | |
#include <linux/mutex.h> | |
#include <linux/input-polldev.h> | |
#include <linux/slab.h> | |
+#include <linux/module.h> | |
#include <linux/input/lsm303dlhc.h> | |
/* #include "lsm303dlhc.h" */ | |
@@ -1091,7 +1092,7 @@ | |
.pm = &lsm303dlhc_pm, | |
}, | |
.probe = lsm303dlhc_mag_probe, | |
- .remove = __devexit_p(lsm303dlhc_mag_remove), | |
+ .remove = lsm303dlhc_mag_remove, | |
.id_table = lsm303dlhc_mag_id, | |
}; | |
PATCH | |
make -C /lib/modules/`uname -r`/build M=$PWD modules | |
make -C /lib/modules/`uname -r`/build M=$PWD modules_install | |
cd /lib/modules/`uname -r` | |
depmod -a | |
modprobe lsm303dlhc_acc | |
echo lsm303dlhc_acc 0x19 > /sys/bus/i2c/devices/i2c-1/new_device | |
echo 1 > /sys/bus/i2c/devices/1-0019/enable_device | |
evtest /dev/input/event1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rebuilding with http://builds.beagleboard.org/builders/build-kernel/builds/38 is now giving me errors: