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:
9cf1f08f9a/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.
<speculation>
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.
</speculation>
This commit is contained in:
Magnus Bergmark 2015-11-10 23:20:10 +01:00
parent 0c8b0caaaa
commit 6793baedf5
No known key found for this signature in database
GPG Key ID: DB2D6BB84D8E0309

View File

@ -337,7 +337,11 @@ int rtw_android_cmdstr_to_num(char *cmdstr)
{
int cmd_num;
for(cmd_num=0 ; cmd_num<ANDROID_WIFI_CMD_MAX; cmd_num++)
#if (LINUX_VERSION_CODE >= 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;