159.736 - Assignment 2


To be submitted by 30th May 2015


This assignment is about writing a userspace library for the sensor device driver you wrote in assignment 1.

For this assignment you will need to download at least part of the open source android code as described here:

http://source.android.com/source/downloading.html

Use the android-5.1.1_r1 branch.

The sensors.h include file is in here:

https://android.googlesource.com/platform/hardware/libhardware.git

There is a sensors library for goldfish that uses qemud here:

https://android.googlesource.com/device/generic/goldfish.git (sensors/sensors_qemu.c)

You will need to modify sensors_qemu.c to use your driver interface from a1 and create a shared library called sensors.goldfish.so.


Use the mm command to quickly build only the necessary library.


Once you have this, you can test it by writing it to /system/lib/hw/ in the android filesystem. You will need to remount the system partition as r/w using 'adb remount'.


If you want to fully test your library you will need to write some code to send sensor updates to the emulator, however this code will not be marked.


If you find that you need to modify the interface to your kernel driver then document any changes you make to it in the source for the userspace library.


Your library must be a single file (no header) and you should submit your driver source code electronically from the paper web page. Marks will be awarded for well written libraries that use the hardware interface well. This is an individual assignment, obviously plagiarised submissions will be awarded zero marks.




M.Johnson 2015