Writing a sensor device driver