3
votes

I have a Galaxy S3 that is an android phone. I want to develop a USB Device Driver for it. So I made a simple driver that is compiled with Galaxy S3 Linux Kernel. But I can't execute 'insmod' command without root permission.

Is it possible to develop a device driver for android phone?

Additionally, a driver source code is a typical character device driver sample which has open(), close(), read(), write() functions.

And an error message are:

  1. insmod: Permission denied
    (have not a root permission )

  2. insmod: invalid module format
    (have a root permission through 'rooting'. I think that the kernel was changed because of 'rooting'. And device driver compiled with original Galaxy S3 Linux Kernel which is released by samsung. )

1
describe what you want from driver. Put info about you simple driver and info about errors. Add tags to current topic on what language you write you driver.b1_
Maybe Galaxy S3 is available for Android Host API.Joel
And someone told me a boot loader unlock.Joel

1 Answers

3
votes

Yes it IS possible to develop a device driver for any android phone as long as you have:
- access to the linux kernel source for that particular phone.
- have access to a root shell on the device.

Access to the kernel source is required so that one can build a kernel-module against that particular kernel. A root shell is required to insmod the kernel-module.

Regarding USB host support on android phones, certain phones have the USB-host support built-in to the kernel and will support the USB-host mode. But one needs to have the proper USB-cables to connect the peripherals.

Also to overcome the error,

insmod: invalid module format

you might want to try the --force-vermagic flag as follows :

insmod --force-vermagic <module.ko>

As you have rightly guessed, it is in fact an error due to mismatch of version numbers between the kernel running on the device and the kernel that the module is built against. More details here.