wpa_cli 连接 wifi(转)
wpa_cli 连接 wifi
use the following command:
wpa_supplicant -Dwext -iwlan0 -C/data/system/wpa_supplicant -c/data/misc/wifi/wpa_supplicant.conf
2: Run the command line tool wpa_cli to connect wifi
wpa_cli -p/data/system/wpa_supplicant -iwlan0
Then , it will let you set network interactively
some common command:
>scan = to scan the neighboring AP
>scan_results = show the scan results
>status = check out the current connection information
>terminate = terminate wpa_supplicant
>quit = exit wpa_cli
>add_network = it will return a network id to you
>set_network <network id> <variable> <value> = set network variables (shows list of variables when run without arguments), success will return OK, or will return Fail
>select_network <network id> = select a network (disable others)
>disable_network <network id> = disable a network
>enable_network <network id> = enable a network
> set_network 0 priority 0
> list_network
> save_config
3: example
for AP that doesn`t have encryption
>add_network (It will display a network id for you, assume it returns 0)
>set_network 0 ssid “666”
>set_network 0 key_mgmt NONE
>enable_network 0
>quit
if normal, we have connectted to the AP “666”, now you need a IP to access internet, for example:
dhcpcd wlan0
if everything is ok, it will get an IP & can access internet
for AP that has WEP
>add_network (assume returns 1)
>set_network 1 ssid “666”
>set_network 1 key_mgmt NONE
>set_network 1 wep_key0 “your ap passwork”(if usting ASCII, it need double quotation marks, if using hex, then don`t need the double quotation marks)
>set_network 1 wep_tx_keyidx 0
>select_network 1 (optional, remember, if you are connecting with another AP, you should select it to disable the another)
>enable_network 1
and then ,get an IP to access internet
for AP that has WPA-PSK/WPA2-PSK
>add_network (assume returns 2)
>set_network 2 ssid “666”
>set_network 2 psk “your pre-shared key”
>select_network 2 (optional, remember, if you are connecting with another AP, you should select it to disable the another)
>enable_network 2
there is still some others options to be set, but wpa_supplicant will choose the default for you, the default will include all we need to set and then ,get an IP to access internet
命令执行后,wpa_cli 会输出连接的过程信息。如果一切正确,则最后后输出:
<2>CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed (reauth) [id=0 id_str=]
获取IP地址
用 quit
命令退出wpa_cli 。然后用
dhclient wlan0
命令获取IP地址。
wpa_cli 连接 wifi(转)的更多相关文章
- wpa_cli 连接 wifi
转自:http://hi.baidu.com/yyangjjun/item/9dfe8e175439fc7a1009b5ba 1: run wpa_supplicant first use the ...
- linux下使用shell命令通过wpa_cli控制wpa_supplicant连接wifi
最近在调试wifi,已经把wpa_supplicant 工具编译打包好了,为了测试wif驱动及wifi模块是否ok,需要用shell命令临时启动wifi服务连接wifi热点测试. 首先板子启动用ifc ...
- Hi3516如何连接Wifi(二)
目录: 一.总体思路 二.启动Daemon 三.作者文章合集 书承上回(Hi3516如何连接Wifi(一)),上一篇聊了一下怎样在Hi3516中用wpa_supplicant连接到Wifi热点,本文讲 ...
- Linux 使用wpa_supplicant手动配置连接wifi
Linux 使用wpa_supplicant手动配置连接wifi wpa_supplicant 简介 wpa_supplicant是Linux BSD, Mac OSX和Windows的WPA的服务, ...
- 树莓派 连接wifi与路由器ip绑定
先推荐几个手机软件 在酷安网里应该能找到 1.JuiceSSH 橘子ssh软件 手机连上路由器 就可以控制局域网内的树莓派 2.VNC Viewer 远程桌面软件VNC 也是连接局域网的树莓派 ...
- 树莓派连接wifi
使用树莓派,通过无线网卡连接wifi,再通过远程桌面或者ssh的连接树莓派比较方便,本文记录树莓派wifi如何设置. 参考链接: http://www.jianshu.com/p/b42e8d3df4 ...
- 手机连接wifi自动弹窗的原理及其实现方案
一.手机连上wifi后会自动弹窗的原理 生活中,有很多需要认证的路由器,手机连接wifi热点后会自动弹出一个网页,让用户输入账号和密码,比如星巴克,肯地基,麦当劳,甚至是火车站和机场的候车室.其实这是 ...
- android开发连接wifi addNetwork 返回-1
如下代码:(注释掉的是会返回-1的代码,未注释的是能够正常连接wifi的代码) // public WifiConfiguration CreateWifiInfo(String SSID, Stri ...
- 为什么手机连接wifi会显示已停用?
1.通常导致手机连接WiFi显示“已停用”故障的原因是由于无线路由器“安全模式”设置不当造成的,对此我们可以通过以下方法来解决: 2.根据无线路由器背面的信息(包括路由器IP地址,登陆用户名和密码), ...
随机推荐
- 机器学习: 神经网络中的Error函数
利用神经网络做分类的时候,可以将神经网络看成一个mapping function,从输入到输出经过复杂的非线性变换.而输出的预测值与实际的目标值总是存在一定偏差的,一般利用这种偏差建立error 函数 ...
- idea的一些快捷键
查找文本的出现位置就用Ctrl+F/Ctrl+Shift+F在当前窗口或全工程中查找,再配合F3/Shift+F3前后移动到下一匹配处Intellij的Ctrl+N/Ctrl+Shift+N可以打开类 ...
- 数学图形(1.20)N叶草
有N个叶子的草 相关软件参见:数学图形可视化工具,使用自己定义语法的脚本代码生成数学图形.该软件免费开源.QQ交流群: 367752815 vertices = t = to (*PI) r = n ...
- 解析Java的JNI编程中的对象引用与内存泄漏问题
JNI,Java Native Interface,是 native code 的编程接口.JNI 使 Java 代码程序可以与 native code 交互——在 Java 程序中调用 native ...
- Dockerfile命令
Dockerfile分基础镜像信息.维护者信息.镜像操作指令.容器启动时执行指令 FROM 镜像名:标签 第一条指令必须时FROM MAINTAINER 维护者信息 RUN command或者RUN ...
- RecyclerView 数据刷新的几种方式 局部刷新 notify MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- Jquery chosen动态设置值 select Ajax动态载入数据 设置chosen和获取他们选中的值
在做一个编辑对话框时,要对里面带有select option的操作.主要是想动态载入option和对option的选中.可是由于项目中使用了jquery里的chosen()方法.怎么也无法实现效果 ...
- 使用mocha测试
学习了MOCHA官网的示例,将学习成果记录一下.[原文+例子:使用mocha测试] mocha是什么 Mocha是一个跑在node和浏览器上的javascript测试框架,让异步测试变得简单有趣, 并 ...
- 如何使用JW Player来播放Flash并隐藏控制按钮和自定义播放完成后执行的JS
在一个客户项目中播放的flash需要进行定制如不显示控制按钮,flash播放完成后执行特定的js等,在用过了N多的JQery插件和播放器后最终JW Player插件可以满足我的以上要求 因为JW Pl ...
- Report Studio中目录结构报表浅析
一:场景:在一个报表中如果存在多个页面,每个页面显示不同的数据,如何通过目录控件实现对每一个报表的友好访问呢?下面我们就来看一下下面的效果,如下图1,2 图1:-------------------- ...