This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Android - Getting Kernel Driver Interrupt from Api Service or User Application ?

Hi everyone,

I'm sorry if my post is wrong group.

I'm developing SPI driver for my new device on android ICS running on panda board es. I use GPIO interrupt to know when i got data to receive from SPI port.

I can run interrput function in kernel space, however i can not get it from my application on android user space.

Please tell me what i need to do in Kernel space and User space.

Thanks in advances.

Luan

  • Hello Aut,

    You have several options to make a hardware interrupt available to a user space application.  There are many tradeoffs based on the application's requirements.

    One option would be to create a sysfs directory for this device driver, and create a sysfs file which when read can indicate if there has been an interrupt received.

    Another option would be to register this device driver as an input device, and generate input events.  There is some infrastructure for this already with Android.  To get an idea of how this works, take a look at the gpio-keys driver in the blaze-tablet kernel tree (I don't know if it is also in the Panda Board tree).  The blaze tablet defines several GPIOs for things like the volume-up/down buttons, and these are reported as input events which you can see by running getevent.

    Maybe as a test, you can try to write a small test driver that uses the GPIO button on the PandaBoard, and generates input events when it is pressed/released.

    A third option would be to create a character device in /dev for this hardware.  The character device outputs a character when there is an interrupt.  The user space application does a blocking read on the character device, so the read system call will return when the interrupt is received.

    Best regards,

    James Graves

  • Hi James Graves,

    Thanks for your suggestions. I'm success with input event.

    Thank you so much.

    Best Regards,

    AJ