Investigating sensors support in a tablet Fabien lysias Goncalves December 9, 2014
Introduction Did not know exactly what to work on Asked gaby There, this doesn t work
Section 1 The LSM303DLH
Where to start? How does it work? Using an accelerometer
Where to start? Which accelerometer? From Archlinux s wiki: The Series 7 Slate, as far as I can tell uses a STMicroelectronics LSM303DLH I am currently trying to get that up and running. Once I do, I ll post instructions on the LSM303DLH page
Where to start? Which accelerometer? From Archlinux s wiki: The Series 7 Slate, as far as I can tell uses a STMicroelectronics LSM303DLH I am currently trying to get that up and running. Once I do, I ll post instructions on the LSM303DLH page This page was last modified on 13 June 2012, at 15:54
Where to start? Generalities about the device STMicroelectronics 3D acceleration sensor 3D magnetic sensor Deprecated Communicates using I 2 C
Where to start? People trying to write a driver December 2010 chethan.krishna@stericsson.com
Where to start? People trying to write a driver December 2010 chethan.krishna@stericsson.com September 2012 srinidhi.kasagar@st.com
Where to start? People trying to write a driver December 2010 chethan.krishna@stericsson.com September 2012 srinidhi.kasagar@st.com Ok, why not do it myself?
The device I 2 C multi-master, multi-slave serial bus 2 bidirectionnal lines, one data (SDA) and one clock (SCL) 7-bit address (in our case)
The device I 2 C communication example
The device st accel const s t r u c t o f d e v i c e i d s t a c c e l o f m a t c h [ ] = { {. c o m p a t i b l e = st, lsm303dlh a c c e l,. data = LSM303DLH ACCEL DEV NAME, }, [... ]
The device st accel const s t r u c t o f d e v i c e i d s t a c c e l o f m a t c h [ ] = { {. c o m p a t i b l e = st, lsm303dlh a c c e l,. data = LSM303DLH ACCEL DEV NAME, }, [... ] In Kconfig: c o n f i g IIO ST ACCEL 3AXIS t r i s t a t e S T M i c r o e l e c t r o n i c s a c c e l e r o m e t e r s 3 A x i s D r i v e r
The device st accel - side note https://www.kernel.org/doc/documentation/i2c/smbus-protocol: Some adapters understand only the SMBus (System Management Bus) protocol, which is a subset from the I2C protocol. st sensors module
Section 2 The magnetometer
What is it? Principle Vector with force/direction
Communicating with the device flag{4ll0} How are devices handled? s t r u c t i 2 c d r i v e r { [... ] i n t ( probe ) ( s t r u c t i 2 c c l i e n t, c o n s t s t r u c t i 2 c d e v i c e i d ) ; [... ] } Driver returns 0 if it wants to handle the device.
Communicating with the device How are devices handled? https://www.kernel.org/doc/documentation/i2c/writing-clients The probe function is called when an entry in the id table name field matches the device s name. s t a t i c const s t r u c t i 2 c d e v i c e i d s t a c c e l i d t a b l e [ ] = { { LSM303DLH ACCEL DEV NAME }, // l s m 3 0 3 d l h a c c e l [... ] }
Section 3 Do we have the right device?
Windows and Android What Windows says Not much!
Windows and Android What Windows says OK. What about Android?
Windows and Android What Android says u0 a1@android : / $ lsmod grep a c c e l h i d s e n s o r a c c e l 3 d [... ]
Windows and Android HID sensor? HID? drivers/iio/accel IIO?
Windows and Android HID sensor? HID? drivers/iio/accel IIO? IIO is not included in the kernel shipped with archlinux
Windows and Android Let s try in archlinux hid-sensor-hub registers as a HID driver dispatches to other spectific drivers $ dmesg g r e p p r o b i n g p r o b i n g ; name : HID SENSOR 200073 // i n hid s e n s o r a c c e l 3d. c p r o b i n g r e t u r n e d 0 // i n hid s e n s o r a c c e l 3d. c
Windows and Android What s left? $ dmesg grep vendor vendor i d : 1155 // i n hid s e n s o r hub. c From HID: 1155 STMicroelectronics $ dmesg grep p r o d u c t p r o d u c t i d : 37329 // i n hid s e n s o r hub. c Product IDs (PIDs) are assigned by each vendor as they see fit
Windows and Android What s left? $ dmesg grep vendor vendor i d : 1155 // i n hid s e n s o r hub. c From HID: 1155 STMicroelectronics $ dmesg grep p r o d u c t p r o d u c t i d : 37329 // i n hid s e n s o r hub. c Product IDs (PIDs) are assigned by each vendor as they see fit Enable device in /sys/bus/iio/devices/iio:devicex Read /dev/iio:devicex
Windows and Android Conclusion Questions?