Linux iw dev,linux下移植wifi之安装iw and iw操作(五)

第四节 安装iw and iw操作

一、 先查看README,获取了三个有用点:

1.    This is 'iw', a tool to use nl80211(iw需要nl80211)

2.  To build iw, just enter 'make'. If that fails, set the

PKG_CONFIG_PATH environment variable to allow the Makefile

to find libnl.(通过这个参数来指定libnl库的位置)

3.  'iw' is currently maintained at http://git.sipsolutions.net/iw.git/,(iw软件下载网站)

4.  some more documentation is available at

http://wireless.kernel.org/en/users/Documentation/iw. (iw 操作说明文档)

解压:tar -xf /mnt/hgfs/linux_share/0711/iw-4.9.tar.xz

nl80211已经安装了,通过PKG_CONFIG_PATH变量,我们已经指定了nl80211头文件和库的路径,可以通过命令进行查看。

命令:echo $PKG_CONFIG_PATH

得:/home/clh/work/libnl-3.2.25/tmp/lib/pkgconfig:

二、编译

在info.c的代码前面添加

#define htole16(X)  (((((uint16_t)(X)) << 8) | ((uint16_t)(X) >> 8)) & 0xffff)

修改Makefile ,加上libnl的头文件 和 lib库。

CFLAGS += -I/home/clh/work/libnl-3.2.25/tmp/include/libnl3

LDFLAGS += -L/home/clh/work/libnl-3.2.25/tmp/lib

make CC=arm-linux-gcc

make DESTDIR=$PWD/tmp install

三、将iw工具复制到根文件系统

cp tmp/usr/sbin/* /opt/rootfs/bin/     /*iw*/

四、iw 工具的操作

iw help                     //help 帮助信息

iw list                     //Getting device capabilities 列出WIFI网卡的性能

ifconfig wlan0 up

iw dev wlan0 scan             //Scanning     扫描WIFI AP

iw wlan0 connect hello      //Establishing a basic connection  连接到WIFI AP:hello (open)

iw wlan0 connect hello keys d:0:happygrilclh0 // 连接到WIFI AP:hello (WEP) "happygrilclh0" 是密码

d: default, 0: 第0个密码

ifconfig wlan0 192.168.2.200

ping 192.168.2.1            //ping 连接的AP的网关

iw wlan0 disconnect         //断开链接

注意点:

操作过程中,会出现这个警告,不用理会。

cfg80211: Calling CRDA to update world regulatory domain

下一节讲wpa加密的网络管理方法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值