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.

question on accessing SPI from within Android app using JNI



I've got my skeleton for implementing a library in my Android project and I'm porting the "spidev_fdx.c" to my library (my app will load this library and make JNI calls).

 

However, I'm looking through my "\android-ndk-r6\platforms\android-8\arch-arm\usr\include\linux" folder and there is no SPI include file (linux/spi/spidev.h) !

 

How do I proceed ?

  • First of all, please note that google does not recommend writing applications that include kernel headers. See following note from ndk docs.

    ** VERY IMPORTANT NOTE: ******************************************************
    *
    *  The kernel-specific headers in <linux/...> and <asm/...> are not considered
    *  stable at this point. Avoid including them directly because some of them
    *  are likely to change in future releases of the platform. This is especially
    *  true for anything related to specific hardware definitions.
    *
    ******************************************************************************

    If you still want to go ahead w/ your implementation, you will need to copy the kernel header files to the android-ndk directory, i.e. \android-ndk-r6\platforms\android-8\arch-arm\usr\include\linux

    Regards,
    Carlos.