Is it possible to write a driver, say for a OV camera, based on the existing drivers at the RPI git repo?

As is I understand, with a datasheet for a sensor it should be possible to write a similar driver, based on the given ones in the repo. After compilation place the .ko file at lib/modules/.../kernel/drivers/media/i2c/ and hope it gets loaded on boot time.

Has anyone ever tried writing a custom driver, and if so maybe share their experience?


I got my hands on a sensor and its datasheet. I tried altering an existing driver, it compiled and I could insert it via modprobe, but didn't load correctly (I believe, because my debug messages weren't printed and the sensor didn't start). Although I couldn't get the driver running on the raspberry pi, on the Arduino I managed getting the sensor to run, by setting values to the i2c registers. Using the Arduino to get the video data is not possible, since you can only access them via csi.

My next step will be to recompile the RPi kernel, with the new driver already in it. Hopefully this will solve the problem.

  • Did you try using insmod instead of modprobe to load the kernel module? If so, what errors did you get?
    – David
    Apr 2 '19 at 22:40
  • I did, it said "unknown symbol". That error occurs because insmod does not load the required dependencies
    – Wh0Els3
    Apr 3 '19 at 20:59
  • where are you checking these errors?
    – David
    Apr 3 '19 at 21:22
  • With demsg. I enabled the i2c log during kernel compilation, thus it is written in there.
    – Wh0Els3
    Apr 3 '19 at 21:33
  • Could you share a code snippet to facilitate finding the problem? There are many things that can lead to an error here.
    – David
    Apr 3 '19 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.