22 #include <sys/ioctl.h>
23 #include <sys/types.h>
24 #include <sys/socket.h>
27 #include <linux/wireless.h>
29 #include <wifi_common_hal.h>
32 bool wifi_interfaceIsWireless(
const char * ifname)
34 bool hasWirelessExtensions =
false;
36 int soc = socket(AF_INET, SOCK_STREAM, 0);
38 WIFI_LOG_WARN(
"error creating socket while looking for wireless extensions. %d\n",
44 memset(&req, 0,
sizeof(req));
45 strncpy(req.ifr_name, ifname, IFNAMSIZ);
47 if (ioctl(soc, SIOCGIWNAME, &req) != -1)
48 hasWirelessExtensions =
true;
53 return hasWirelessExtensions;