From 6793baedf50fbf0822d2b87a1070527c0fd0685e Mon Sep 17 00:00:00 2001 From: Magnus Bergmark Date: Tue, 10 Nov 2015 23:20:10 +0100 Subject: [PATCH] Fix strnicmp not defined in Kernel >= 4.0 This particular fix is all over the internet, as patches posted on mailing lists, package maintainer's mirrors, etc. I don't know the full origin of it, but it works. It also makes sense. I found a quote regarding it here: http://comments.gmane.org/gmane.linux.drivers.driver-project.devel/71438 > [...] patched so it will compile against kernels that no longer > provide the old procfs API and with calls to strnicmp() replaced with > strncasecmp(). Here's an example of the patch in the wild: https://github.com/felixonmars/aur3-mirror/blob/9cf1f08f9a6806ae5804f534bceb174cfec3daa9/8192cu-dkms/RTL8192CU-kernel-4.0.patch Note that the sources mentioned above all talk about the more common 8192cu driver, but the change is the same as both drivers share the majority of the code with each other. I guess this is part of the reason why the hardware makers don't publish updated drivers; they've copy-pasted it everywhere and patching them all is a pain for them. --- os_dep/linux/rtw_android.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c index 98f0d31..242048a 100644 --- a/os_dep/linux/rtw_android.c +++ b/os_dep/linux/rtw_android.c @@ -337,8 +337,12 @@ int rtw_android_cmdstr_to_num(char *cmdstr) { int cmd_num; for(cmd_num=0 ; cmd_num= KERNEL_VERSION(4, 0, 0)) + if(!strncasecmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) ) +#else + if(0 == strnicmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) ) +#endif + break; return cmd_num; }