/*
WIFI ioctl中SIOCSIWSCAN命令从应用程序到内核再到驱动
应用程序中:
ioctl(skfd, SIOCSIWSCAN , &wrq);
其中,#define SIOCSIWSCAN 0x8B18
0x8B00 ~ 0x8BFF 调用net/core/dev.c --> dev_ioctl
dev_ioctl中执行到default中,最后调用了wireless_process_ioctl
对wireless_process_ioctl,又跑到了default中,如果有handler,最后到ioctl_standard_call中;
没有handler时,使用老的接口(dev->do_ioctl)。
if(handler != NULL) {
/* Standard and private are not the same */
if(cmd < SIOCIWFIRSTPRIV)
return ioctl_standard_call(dev,
ifr,
cmd,
handler);
else
return ioctl_private_call(dev,
ifr,
cmd,
handler);
}
/* Old driver API : call driver ioctl handler */
if (dev->do_ioctl) {
return dev->do_ioctl(dev, ifr, cmd);
}
有handler时,在具体WIFI驱动中,有类似如下实现:
netdev->wireless_handlers = (struct iw_handler_def *)&iwctl_handler_def;
{
......
.get_wireless_stats = &iwctl_get_wireless_stats,
.standard = (iw_handler *) iwctl_handler,
......
}
{
(iw_handler) iwctl_commit, // SIOCSIWCOMMIT
......
......
(iw_handler) iwctl_giwrange, // SIOCGIWRANGE
......
......
#if WIRELESS_EXT > 13
(iw_handler) iwctl_siwscan, // SIOCSIWSCAN
(iw_handler) iwctl_giwscan, // SIOCGIWSCAN
#else
(iw_handler) NULL,
(iw_handler) NULL,
#endif
......
};
WIFI ioctl调用(从应用程序到内核再到WIFI网卡驱动)
转载socket的ioctl先看net/socket.c的sock_ioctl
对于无线:
handler = get_handler(dev, cmd);
const struct iw_handler_def iwctl_handler_def =
static const iw_handler iwctl_handler[] =
rt_ioctl_siwessid
![](https://ucenter.51cto.com/images/noavatar_middle.gif)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
树莓派搭建无线AP
树莓派搭建无限AP教程
树莓派 git DNS