I haven’t used this feature, but a simple Google search gives what looks like 
the answer you are looking for:

http://stackoverflow.com/questions/16721346/linux-kernel-version-macro-definition
 
<http://stackoverflow.com/questions/16721346/linux-kernel-version-macro-definition>

So in your case:

#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,1,17)


Regards,
John




> On May 28, 2016, at 10:58 PM, Drew Fustini <[email protected]> wrote:
> 
> Robert: I'm hoping you might have some advice for this issue I'm encountering.
> 
> Peter's pull request for Adafruit_BBIO uses LINUX_VERSION_CODE to determine 
> if the kernel is 4.1 or newer:
> https://github.com/adafruit/adafruit-beaglebone-io-python/pull/96#issuecomment-222343880
>  
> <https://github.com/adafruit/adafruit-beaglebone-io-python/pull/96#issuecomment-222343880>
> 
> When I build Adafruit_BBIO, LINUX_VERSION_CODE is set to old version 200711.  
> It appears to come from:
> 
> /usr/include/linux/version.h:#define LINUX_VERSION_CODE 200711
> /usr/src/linux-headers-4.1.17-ti-rt-r46/include/generated/uapi/linux/version.h:#define
>  LINUX_VERSION_CODE 262417
> 
> I'm using image "BeagleBoard.org <http://beagleboard.org/> Debian Image 
> 2016-02-07" with Linux kernel 4.1.25-ti-r62 and Debian 8.4.  
> "/usr/include/linux/version.h" appears to come from linux-libc-dev:armhf 
> 3.16.7-ckt25-2.  
> "/usr/src/linux-headers-4.1.17-ti-rt-r46/include/generated/uapi/linux/version.h"
>  comes from linux-headers-4.1.17-ti-rt-r46.
> 
> What would be the proper way to update /usr/include/linux/version.h to 
> reflect 4.1+?
> 
> Related gist:
> https://gist.github.com/pdp7/193cb6252440850926297ac79ed39acc 
> <https://gist.github.com/pdp7/193cb6252440850926297ac79ed39acc>
> 
> Thanks,
> Drew
> 
> On Thursday, April 28, 2016 at 9:36:36 PM UTC-5, Peter Lawler wrote:
> Hi folks, 
> Just a quick note to let you know I've spent some time tracking down the 
> differences between 3.8 and later versions for the Adafruit BBIO Python 
> library. 
> 
> I first noted this post 
> https://forums.adafruit.com/viewtopic.php?f=49&t=91903&p=468811#p469266 
> <https://forums.adafruit.com/viewtopic.php?f=49&t=91903&p=468811#p469266> 
> which discusses that the 3.8 Adafruit library won't work on 4.1, and 
> that there were some fixes out in the wild so to speak but that Adafruit 
> weren't in a rush to get them happening. 
> 
> So I took a look at one of the solutions, by grizmio, and it Just Worked 
> for me. 
> 
> I've now shoved a bunch of ifdef's around the changes in the C code that 
> grizmio made, so I am *hoping* it's simultaneously 3.8 and 4.1 friendly. 
> 
> I don't have a spare 3.8 machine at hand right now, but if there's 
> anyone out there who could try it out and see what happens, it'd be 
> appreciated. All I know is bad C and that it compiles. Please don't 
> shoot me for doing things wrong ;) 
> 
> 
> https://github.com/PeteLawler/adafruit-beaglebone-io-python 
> <https://github.com/PeteLawler/adafruit-beaglebone-io-python> 
> 
> Regards, 
> 
> Pete. 
> 
> -- 
> For more options, visit http://beagleboard.org/discuss 
> <http://beagleboard.org/discuss>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beagleboard/6dfd7521-cf7e-48b4-b6fc-5ba2d1461d36%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beagleboard/6dfd7521-cf7e-48b4-b6fc-5ba2d1461d36%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/A78B609F-BD1F-4943-AA95-2EEE90766148%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to