• No results found

Dynamic Android Sensor HAL

N/A
N/A
Protected

Academic year: 2021

Share "Dynamic Android Sensor HAL"

Copied!
36
0
0

Loading.... (view fulltext now)

Full text

(1)

Dynamic Android Sensor HAL

D * A * S * H

Oskar Anderö

Senior Software Architect

E-mail: [email protected]

(2)

D * A * S * H

Just another sensor HAL implementation

But...

Easy to integrate

Configurable

Scalable

Copyright 2012 Sony Corporation 12.09.24

(3)

D * A * S * H

DASH is open-source!

Github:

https://github.com/sonyxperiadev/DASH

Allows openness

For mod hackers to enjoy

3rd party vendors

Sensor HAL example for anyone

Copyright 2012 Sony Corporation 12.09.24

(4)

What we had

Messy code

Lots of #ifdefs

Many branches

Different types of Linux drivers

Copyright 2012 Sony Corporation 12.09.24

(5)

What we wanted

What lead to the current situation?

Different sensors on different products

Different mounting on different products

Different 3rd party sensor libraries for different sets of sensors

What to do....?

Solution: abstract the abstraction!

Copyright 2012 Sony Corporation 12.09.24

(6)

What we wanted

Scalable

Configurable

Common code should be common

Ease integration of sensor fusion

Avoid multiple branches

Copyright 2012 Sony Corporation 12.09.24

(7)

Copyright 2012 Sony Corporation 12.09.24

(8)

Code example

BMA250

Accelerometer from Bosch

Linux interface is input device

Polls events in kernel

Polling frequency is set by sysfs

Implemented in

sensors/bma250_input.c

Copyright 2012 Sony Corporation 12.09.24

(9)

bma250_input.c

Copyright 2012 Sony Corporation 12.09.24

(10)

Copyright 2012 Sony Corporation 12.09.24

(11)

bma250_input.c

...and in sensors_list.h:

Copyright 2012 Sony Corporation 12.09.24

(12)

Copyright 2012 Sony Corporation 12.09.24

(13)

bma250_input.c

Copyright 2012 Sony Corporation 12.09.24

(14)

bma250_input.c

Copyright 2012 Sony Corporation 12.09.24

(15)

bma250_input.c

Sensors.conf example:

Copyright 2012 Sony Corporation 12.09.24

(16)

Copyright 2012 Sony Corporation 12.09.24

(17)

bma250_input.c

Copyright 2012 Sony Corporation 12.09.24

(18)

Copyright 2012 Sony Corporation 12.09.24

(19)

bma250_input.c

Copyright 2012 Sony Corporation 12.09.24

(20)

Copyright 2012 Sony Corporation 12.09.24

(21)

bma250_input.c

Copyright 2012 Sony Corporation 12.09.24

(22)

Case study: integrate on Xperia S

Copyright 2012 Sony Corporation 12.09.24

(23)

Case study: integrate on Xperia S

Copyright 2012 Sony Corporation 12.09.24

(24)

Case study: integrate on Galaxy Nexus

Copyright 2012 Sony Corporation 12.09.24

(25)

Case study: integrate on Galaxy Nexus

Step 1: What kernel drivers do we have?

Step 2: Write user-space drivers

Step 3: Build it

Step 4: Push it to target

Copyright 2012 Sony Corporation 12.09.24

(26)

What kernel drivers do we have?

Step 1: What kernel drivers do we have?

Use some application

adb shell dmesg

adb shell getevent -i

We are lucky: look in AOSP code!

Result:

Sharp GP2A proximity and light sensor

Bosch BMP180 pressure sensor

Invensense MPU3050 Gyroscope

BMA250 Accelerometer

YAS530 Compass

Copyright 2012 Sony Corporation 12.09.24

(27)

Writing user-space drivers have

Step 2: Writing user-space driver

Create a BMP180 user-space driver

Already included in DASH!

..but the driver is not the same.

Fix 1: input name is different

Fix 2: sysfs attributes are different

Add enable attribute

Rename poll rate attribute

Copyright 2012 Sony Corporation 12.09.24

(28)

Writing user-space drivers have

Create a Sharp GP2A proximity user-space driver

Again - there is already one!

Fix 1: input name is different

Fix 2: add handler for sysfs attribute “enable”

Copyright 2012 Sony Corporation 12.09.24

(29)

Writing user-space drivers have

Create a Sharp GP2A light user-space driver

Very similar to Sharp proximity

Uses enable sysfs and input device

Fix 1: Copy-paste proximity user-space driver

Fix 2: Use ABS_MISC instead of ABS_DISTANCE

Copyright 2012 Sony Corporation 12.09.24

(30)

Writing user-space drivers have

Create MPU3050 user-space driver

There is a user-space driver.

Drivers and lib are incompatible with Sony solution!

Fix 1: Port Galaxy invensens lib to DASH

Update the way DASH interfaces with the new lib

Fix 2: Add compass and accelerometer

SOMC version uses AKM and BMA250 through wrapper layer

Fix 3: Make it polling

Copyright 2012 Sony Corporation 12.09.24

(31)

Building DASH

Step 3: Build it

Make sure to enable sensors in makefile

mm

Copyright 2012 Sony Corporation 12.09.24

(32)

Install DASH

Step 4: Push it to target

adb root

adb remount

adb push $OUT/system/lib/hw/sensors.default.so \

/system/lib/hw/sensors.tuna.so

adb shell stop

adb shell start

Copyright 2012 Sony Corporation 12.09.24

(33)

All done!

Copyright 2012 Sony Corporation 12.09.24

(34)

Conclusion

DASH is a...

Generic

Configurable

Scalable

Open-source!

...framework for sensors

Copyright 2012 Sony Corporation 12.09.24

(35)

Questions?

https://github.com/sonyxperiadev/DASH

Copyright 2012 Sony Corporation 12.09.24

(36)

“SONY” or “make.believe” is a registered trademark and/or trademark of Sony Corporation.

Names of Sony products and services are the registered trademarks and/or trademarks of Sony Corporation or its Group companies. Other company names and product names are the registered trademarks and/or trademarks of the respective companies.

References

Related documents

Have a club advisor, employer, or a teacher for whom you have worked for (tutor, teacher assistant, volunteer) complete the Character, Leadership, and Service Evaluation

refugees and displaced persons returned (UNHCR 2012:3). However, this variable measures a specific type of return as an indicator for reconciliation and quality of democracy: The

Quantitative research based on the positivism that tries to put reality as objective as possible and release the values intervention to explain such reality. Qualitative research

Contact Information for Official Reporter, Project Editor or Document Custodian if different from the Working Group Chair (must be an SA member as well as an IEEE and/or

All other product, brand and company names and logos used are trademarks or registered trademarks of their respective owners...

• Condition of Weathering Steel was compared Condition of Weathering Steel was compared to galvanized rail of same age.. to galvanized rail of

o Inadequate notice and potential penalties o Ownership of data and data formats o Automatic contract extensions o Written notice requirements o Termination options?. o