-
还是很不错的,以后用到再说了。:time::time::time::time::time:
-
因为经常把工作带回家去做,在家用电脑上写的一些代码常常来不及与公司电脑上的代码进行同步,导致代码管理混乱。现在使用git来进行源代码管理,就轻松多了,而且还可以很方便地和别人一起协作开发。
步骤如下:
1. 配置server: mkdir repos.git
cd repos.git
git --bare init #建立一个空的 git仓库,--bare 参数说明当前init 的不是工作目录
2. 将PC-1上现有的workspace进行git管理并上传到服务器端: cd workspace
git init
git add *
git commit -m 'initial commit'
git remote add origin ssh://huzhenwei@192.168.1.2/home/huzhenwei/repos.git #192.168.1.2为服务器的内网IP
git push origin master #将本地的代码上传到服务器端
3. 从服务器端检出版本库到PC-2,在PC-2上新建文件并上传到服务器端: git clone ssh://huzhenwei@192.168.1.2/home/huzhenwei/repos.git workspace
cd workspace
touch newfile #创建一个新文件来做测试
git add newfile
git commit -m 'add newfile'
git push origin master #将本地的代码上传到服务器端
4. 在PC-1上获取PC-2更新的内容: git pull origin master #将服务器端的代码下载到本地
-
zhaojiyuan6 发表于 2015-6-1 15:43
遇到相同问题, 不过是在silicon labs芯片上 求扩散, 求解决啊
就是一些库文件的问题,理清他们的引用关系就可以了。
-
直接不用lib_driver_cmd_rtl,屏蔽就可以通过了。
-
http://blog.csdn.net/harhy/article/details/8700011
-
教育一个人是困难的事情,你前面几个已经是入门的,你搞定了再想别的了,无非是做一些实验了,看代码了。看代码,了解执行流程和原理,如果你能搞定这些,就做做修改,基本算入门了。
-
Android包编译出来一般都要10G左右,如果有些不干净的包会20~30G内核几百M,所以你一般要选择50G以上才能弄,否则,后面会很麻烦,硬盘要很大的。
-
frameworks/base/wifi/java/android/net/wifi/WifiMonitor.java: if (WifiNative.connectToSupplicant()) {
----------------------------------
貌似代码改了
private boolean connectToSupplicant() {
int connectTries = 0;
while (true) {
if (WifiNative.connectToSupplicant()) {
return true;
}
if (connectTries++ < 5) {
nap(1);
} else {
break;
}
}
return false;
}
-
/**
* Send the tracker a notification that a connection to the supplicant
* daemon has been established.
*/
//在上面的public class WifiMonitor=>ensureSupplicantConnection
//=>
//while (!supplicantConnected) {
// boolean connected;
//synchronized (mWifiStateTracker) {
//connected = WifiNative.connectToSupplicant();//如果沒有連接成功,那麽while循環嘗試,直到嘗試成功,或者定義了oneShot,僅一次嘗試
//=>mWifiStateTracker.notifySupplicantConnection();//如果WifiNative.connectToSupplicant()成功,那麽將執行
//mWifiStateTracker.notifySupplicantConnection();的調用.
void notifySupplicantConnection() {//向對象發送message
Message.obtain(this, EVENT_SUPPLICANT_CONNECTION).sendToTarget();
}
void notifyStateChange(SupplicantState newState) {
Message.obtain(this, EVENT_SUPPLICANT_STATE_CHANGED, newState).sendToTarget();
}
...
}
-
看了一下wifi的整个工作流程,终于找到了一些蛛丝马迹
private boolean setWifiEnabledBlocking(boolean enable, boolean persist, int uid) {
if (enable) {
if (!WifiNative.loadDriver()) {
setWifiEnabledState(WIFI_STATE_UNKNOWN, uid);
}
if (!WifiNative.startSupplicant()) {
WifiNative.unloadDriver(); ——串口终端不停的打印加载libertas_sdio.ko,说明之前必然有一个卸载libertas_sdio.ko模块的程序被执行了,应该就是这里!
setWifiEnabledState(WIFI_STATE_UNKNOWN, uid);
}
registerForBroadcasts();
mWifiStateTracker.startEventLoop();
} else {
………………
}
// Success!
setWifiEnabledState(eventualWifiState, uid);
}
不管有多难,总会找到一些出问题的地方的。
-
上文讲到WIFI的启动流程,当然接着便扫描热点(AP),然后显示扫描到的AP、配置AP(填写IP地址等信息)、连接AP、获取IP地址、最后就是想要的上网咯!一、扫描热点(AP)上文启动WIFI成功后:// Success!
setWifiEnabledState(eventualWifiState, uid);
private void setWifiEnabledState(int wifiState, int uid) {
// Broadcast
final Intent intent = new Intent(WifiManager.WIFI_STATE_CHANGED_ACTION);
}当使能成功后,会广播发送WIFI_STATE_CHANGED_ACTION 这个Intent 通知外界WIFI已经成功使能了。WifiLayer 创建的时候就会向Android 注册接收WIFI_STATE_CHANGED_ACTION,因此它会收到该Intent,从而开始扫描。WifiSetting.java:protected void onCreate(Bundle savedInstanceState) {
mWifiLayer.onCreate();
}-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------WifiLayer.java:
public void onCreate() {
mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
mIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
mIntentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
}
public void onResume() {
mContext.registerReceiver(mReceiver, mIntentFilter);
if (isWifiEnabled()) {
// Kick start the continual scan
queueContinuousScan();
}
}以上就是WifiLayer.java注册接收的部分事件。接收部分事件处理有:
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
handleNetworkStateChanged(
(NetworkInfo) intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO),
intent.getStringExtra(WifiManager.EXTRA_BSSID));
} else if (action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) {
handleScanResultsAvailable();
} …… else if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
handleWifiStateChanged(intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
WifiManager.WIFI_STATE_UNKNOWN));
}
}
};从可接受的事件看,当WIFI_STATE_CHANGED_ACTION时,对应的处理函数有:handleWifiStateChanged(intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
WifiManager.WIFI_STATE_UNKNOWN));private void handleWifiStateChanged(int wifiState) {
attemptScan();
…………
}public void attemptScan() {
if (!mWifiManager.startScanActive()) {
postAttemptScan();
}
}WifiManager.java:
public boolean startScanActive() {
return mService.startScan(true);
}-------AIDL-------------------------------------------------------------------------------------------------------------------------------------------------------------------------WifiService.java:
public boolean startScan(boolean forceActive) {
…………
return WifiNative.scanCommand(forceActive);
}---------JNI---------------------------------------------------------------------------------------------------------------------------------------------------------------------------android_net_wifi_wifi.cpp:
{ "scanCommand", "(Z)Z", (void*) android_net_wifi_scanCommand },
static jboolean android_net_wifi_scanCommand(JNIEnv* env, jobject clazz, jboolean forceActive)
{
…………
result = doBooleanCommand("SCAN", "OK");
}
static jboolean doBooleanCommand(const char *cmd, const char *expect)
{
if (doCommand(cmd, reply, sizeof(reply)) != 0) {
return (jboolean)JNI_FALSE;
}
}
static int doCommand(const char *cmd, char *replybuf, int replybuflen)
{
if (::wifi_command(cmd, replybuf, &reply_len) != 0)
return -1;
…………
}-------HAL------------------------------------------------------------------------------------------------------------------------------------------------------------------------wifi.c:
int wifi_command(const char *command, char *reply, size_t *reply_len)
{
return wifi_send_command(ctrl_conn, command, reply, reply_len);
}
int wifi_send_command(struct wpa_ctrl *ctrl, const char *cmd, char *reply, size_t *reply_len)
{
ret = wpa_ctrl_request(ctrl, cmd, strlen(cmd), reply, reply_len, NULL);
…………
}
wpa_ctrl.c:
int wpa_ctrl_request()在wpa_ctrl.c中其实就是执行SCAN命令。二、显示扫描的AP当扫描成后,WifiMonitor 中的MonitorThread 会被执行来出来这个事件: void handleEvent(int event, String remainder) {
switch (event) {
case SCAN_RESULTS:
mWifiStateTracker.notifyScanResultsAvailable();
->sendEmptyMessage(EVENT_SCAN_RESULTS_AVAILABLE);
break;
} WifiStateTracker.java
public void handleMessage(Message msg) {
switch (msg.what) {
case EVENT_SCAN_RESULTS_AVAILABLE:
if (ActivityManagerNative.isSystemReady()) {
mContext.sendBroadcast(new Intent(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
}
}WifiLayer注册接收SCAN_RESULTS_AVAILABLE_ACTION这个Intent:private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
else if (action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION))
{ handleScanResultsAvailable(); }
handleScanResultsAvailable();
-> list = mWifiManager.getScanResults();
-> mCallback.onAccessPointSetChanged(ap, true);handleScanResultsAvailable()中首先会去拿到SCAN的结果(最终是往wpa_supplicant中发送SCAN_RESULT命令并读取返回值来实现的),对每一个扫描返回的AP,WifiLayer会回调WifiSetting的onAccessPointSetChanged函数,从而最终把该AP加到GUI显示列表中。三、配置AP当用户在 WifiSettings 界面上选择了一个AP 后,会显示配置AP 参数的一个对话框:public boolean onPreferenceTreeClick()
->showAccessPointDialog(state, AccessPointDialog.MODE_INFO);
->AccessPointDialog dialog =
new AccessPointDialog(this, mWifiLayer);
showDialog(dialog);当用户在AccessPointDialog中选择好加密方式和输入密钥之后,再点击连接按钮,Android就会去连接这个AP。四、连接AP在AccessPointDialog.java中点击连接后会执行:public void onClick(DialogInterface dialog, int which) {
handleConnect();
-> mWifiLayer.connectToNetwork(mState);
-> // Need WifiConfiguration for the AP
WifiConfiguration config = findConfiguredNetwork(state);
config = addConfiguration(state, 0);
managerEnableNetwork(state, false)
->mWifiManager.enableNetwork()
->mService.enalbeNetwork()
->WifiNative.enableNetworkCommand() 接下去就JNI { "enableNetworkCommand", "(IZ)Z", (void*)android_net_wifi_enableNetworkCommand },最终就是向wpa_supplicant发送连接命令
五、获取IP地址当wpa_supplicant成功连接上AP之后,它会向控制通道发送事件通知连接上AP了,从而wifi_wait_for_event函数会接收到该事件,由此WifiMonitor中的MonitorThread会被执行来出来这个事件:void handleEvent(int event, String remainder) {
switch (event) {
case CONNECTED:
handleNetworkStateChange();
-> mWifiStateTracker.notifyStateChange(newState, BSSID, networkId);
->msg.sendToTarget();
break;
}WifiStateTracker.java
public void handleMessage(Message msg) {
switch (msg.what) {
case EVENT_NETWORK_STATE_CHANGED:
sendNetworkStateChangeBroadcast(mWifiInfo.getBSSID());
}
}
WifiStateTracker中注册的对Wifi相关数据库的观察者if(changed) 则启动:
private void configureInterface()
-> mDhcpTarget.sendEmptyMessage();
private class DhcpHandler extends Handler
handleMessage()
->switch (msg.what) {
case EVENT_DHCP_START:
Target.sendEmptyMessage(event);DhcpHandler会发送EVENT_DHCP_START消息启动DHCP去获取IP地址,当DHCP拿到IP地址之后,会发送EVENT_INTERFACE_CONFIGURATION_SUCCEEDED的消息,然后WifiStateTacker中的handleMessage会处理这样的消息 case EVENT_INTERFACE_CONFIGURATION_SUCCEEDED:
sendNetworkStateChangeBroadcast(mWifiInfo.getBSSID());
-> Intent intent = new Intent(WifiManager.NETWORK_STATE_CHANGED_ACTION);
-> mContext.sendStickyBroadcast(intent);这次带上完整的IP地址信息。WifiLayer中注册了此Intent的接受者,会调用handleNetworkStateChanged进行处理。最后就可以自由的上网了
-
最近又忙着搞一些非技术的问题,现在回来继续分析!下面也是不停打印的adb logcat信息输出如下:
lStateException: Unable to communicate with native daemon to set ipv6privacyexte
nsions - com.android.server.NativeDaemonConnectorException: Cmd {interface ipv6p
rivacyextensions wlan0 enable} failed with code 400 : {Failed to set ipv6 privac
y extensions (No such file or directory)}
F/NetworkStats( 2268): problem reading network stats
F/NetworkStats( 2268): java.lang.IllegalStateException: problem parsing idx 1
F/NetworkStats( 2268): at com.android.internal.net.NetworkStatsFactory.readNetw
orkStatsDetail(NetworkStatsFactory.java:300)
F/NetworkStats( 2268): at com.android.server.NetworkManagementService.getNetwor
kStatsUidDetail(NetworkManagementService.java:1282)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService.performPol
lLocked(NetworkStatsService.java:831)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService.performPol
l(NetworkStatsService.java:799)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService.access$100
(NetworkStatsService.java:128)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService$2.onReceiv
e(NetworkStatsService.java:624)
F/NetworkStats( 2268): at android.app.LoadedApk$ReceiverDispatcher$Args.run(Loa
dedApk.java:728)
F/NetworkStats( 2268): at android.os.Handler.handleCallback(Handler.java:605)
F/NetworkStats( 2268): at android.os.Handler.dispatchMessage(Handler.java:92)
F/NetworkStats( 2268): at android.os.Looper.loop(Looper.java:137)
F/NetworkStats( 2268): at android.os.HandlerThread.run(HandlerThread.java:60)
F/NetworkStats( 2268): Caused by: java.io.FileNotFoundException: /proc/net/xt_qt
aguid/stats: open failed: ENOENT (No such file or directory)
F/NetworkStats( 2268): at libcore.io.IoBridge.open(IoBridge.java:406)
F/NetworkStats( 2268): at java.io.FileInputStream.(FileInputStream.java:7
8)
F/NetworkStats( 2268): at com.android.internal.net.NetworkStatsFactory.readNetw
orkStatsDetail(NetworkStatsFactory.java:269)
F/NetworkStats( 2268): ... 10 more
F/NetworkStats( 2268): Caused by: libcore.io.ErrnoException: open failed: ENOENT
(No such file or directory)
F/NetworkStats( 2268): at libcore.io.Posix.open(Native Method)
F/NetworkStats( 2268): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
F/NetworkStats( 2268): at libcore.io.IoBridge.open(IoBridge.java:390)
F/NetworkStats( 2268): ... 12 more
I/wpa_supplicant( 3309): rfkill: Cannot open RFKILL control device
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :16 found
E/ethernet( 2268): the device flag :1043
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :16 found
E/ethernet( 2268): the device flag :1003
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
E/wpa_supplicant( 3309): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3309): P2P: Own listen channel: 6
D/dalvikvm( 2268): GC_CONCURRENT freed 723K, 10% free 10508K/11591K, paused 3ms+
9ms
I/wpa_supplicant( 3309): P2P: Random operating channel: 81:11
I/wpa_supplicant( 3309): [CTRL_IFACE]DRIVER MACADDR
I/wpa_supplicant( 3309): [CTRL_IFACE]LIST_NETWORKS
E/WifiConfigStore( 2268): Error parsing configurationjava.io.FileNotFoundExcepti
on: /data/misc/wifi/ipconfig.txt: open failed: ENOENT (No such file or directory
)
D/StatusBar.NetworkController( 2347): refreshViews connected={ } level=?? combin
edSignalIconId=0x7f0200ae/com.android.systemui:drawable/stat_sys_wifi_signal_0 c
ombinedActivityIconId=0x0 mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId
=0x0 mDataDirectionIconId=0x0 mDataSignalIconId=0x0 mDataTypeIconId=0x0 mWifiIco
nId=0x7f0200ae mEthernetIconId=0x7f02008f mBluetoothTetherIconId=0x1080533
I/wpa_supplicant( 3309): [CTRL_IFACE]SCAN_INTERVAL 15
I/wpa_supplicant( 3309): [CTRL_IFACE]DRIVER BTCOEXSCAN-STOP
E/wpa_supplicant( 3309): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3309): [CTRL_IFACE]DRIVER RXFILTER-ADD 3
E/wpa_supplicant( 3309): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3309): [CTRL_IFACE]DRIVER RXFILTER-STOP
E/wpa_supplicant( 3309): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3309): [CTRL_IFACE]AP_SCAN 1
I/wpa_supplicant( 3309): [CTRL_IFACE]RECONNECT
I/wpa_supplicant( 3309): [CTRL_IFACE]DRIVER SETBAND 0
E/wpa_supplicant( 3309): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3309): wlan0: CTRL-EVENT-DRIVER-STATE HANGED
E/WifiStateMachine( 2268): Failed to set frequency band 0
I/wpa_supplicant( 3309): [CTRL_IFACE]TERMINATE
D/CommandListener( 2158): Clearing all IP addresses on wlan0
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :16 found
E/ethernet( 2268): the device flag :1002
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
I/wpa_supplicant( 3309): wlan0: CTRL-EVENT-TERMINATING
D/StatusBar.NetworkController( 2347): refreshViews connected={ } level=?? combin
edSignalIconId=0x7f0200ae/com.android.systemui:drawable/stat_sys_wifi_signal_0 c
ombinedActivityIconId=0x0 mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId
=0x0 mDataDirectionIconId=0x0 mDataSignalIconId=0x0 mDataTypeIconId=0x0 mWifiIco
nId=0x7f0200ae mEthernetIconId=0x7f02008f mBluetoothTetherIconId=0x1080533
D/StatusBar.NetworkController( 2347): refreshViews connected={ } level=?? combin
edSignalIconId=0x0/(null) combinedActivityIconId=0x0 mAirplaneMode=false mDataAc
tivity=0 mPhoneSignalIconId=0x0 mDataDirectionIconId=0x0 mDataSignalIconId=0x0 m
DataTypeIconId=0x0 mWifiIconId=0x0 mEthernetIconId=0x7f02008f mBluetoothTetherIc
onId=0x1080533
D/dalvikvm( 2347): GC_CONCURRENT freed 496K, 9% free 8994K/9863K, paused 1ms+2ms
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :17 found
E/ethernet( 2268): the device flag :1002
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
W/Netd ( 2158): No subsystem found in netlink event
D/NetlinkEvent( 2158): Unexpected netlink message. type=0x11
D/WifiP2pService( 2268): P2pDisabledState{ what=131203 when=-1ms }
D/StatusBar.NetworkController( 2347): refreshViews connected={ } level=?? combin
edSignalIconId=0x0/(null) combinedActivityIconId=0x0 mAirplaneMode=false mDataAc
tivity=0 mPhoneSignalIconId=0x0 mDataDirectionIconId=0x0 mDataSignalIconId=0x0 m
DataTypeIconId=0x0 mWifiIconId=0x0 mEthernetIconId=0x7f02008f mBluetoothTetherIc
onId=0x1080533
D/StatusBar.NetworkController( 2347): refreshViews connected={ } level=?? combin
edSignalIconId=0x0/(null) combinedActivityIconId=0x0 mAirplaneMode=false mDataAc
tivity=0 mPhoneSignalIconId=0x0 mDataDirectionIconId=0x0 mDataSignalIconId=0x0 m
DataTypeIconId=0x0 mWifiIconId=0x0 mEthernetIconId=0x7f02008f mBluetoothTetherIc
onId=0x1080533
D/Tethering( 2268): sendTetherStateChangedBroadcast 1, 0, 0
F/NetworkStats( 2268): problem reading network stats
F/NetworkStats( 2268): java.lang.IllegalStateException: problem parsing idx 1
F/NetworkStats( 2268): at com.android.internal.net.NetworkStatsFactory.readNetw
orkStatsDetail(NetworkStatsFactory.java:300)
F/NetworkStats( 2268): at com.android.server.NetworkManagementService.getNetwor
kStatsUidDetail(NetworkManagementService.java:1282)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService.performPol
lLocked(NetworkStatsService.java:831)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService.performPol
l(NetworkStatsService.java:799)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService.access$100
(NetworkStatsService.java:128)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService$2.onReceiv
e(NetworkStatsService.java:624)
F/NetworkStats( 2268): at android.app.LoadedApk$ReceiverDispatcher$Args.run(Loa
dedApk.java:728)
F/NetworkStats( 2268): at android.os.Handler.handleCallback(Handler.java:605)
F/NetworkStats( 2268): at android.os.Handler.dispatchMessage(Handler.java:92)
F/NetworkStats( 2268): at android.os.Looper.loop(Looper.java:137)
F/NetworkStats( 2268): at android.os.HandlerThread.run(HandlerThread.java:60)
F/NetworkStats( 2268): Caused by: java.io.FileNotFoundException: /proc/net/xt_qt
aguid/stats: open failed: ENOENT (No such file or directory)
F/NetworkStats( 2268): at libcore.io.IoBridge.open(IoBridge.java:406)
F/NetworkStats( 2268): at java.io.FileInputStream.(FileInputStream.java:7
8)
F/NetworkStats( 2268): at com.android.internal.net.NetworkStatsFactory.readNetw
orkStatsDetail(NetworkStatsFactory.java:269)
F/NetworkStats( 2268): ... 10 more
F/NetworkStats( 2268): Caused by: libcore.io.ErrnoException: open failed: ENOENT
(No such file or directory)
F/NetworkStats( 2268): at libcore.io.Posix.open(Native Method)
F/NetworkStats( 2268): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
F/NetworkStats( 2268): at libcore.io.IoBridge.open(IoBridge.java:390)
F/NetworkStats( 2268): ... 12 more
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :16 found
E/ethernet( 2268): the device flag :1002
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
D/Tethering( 2268): InitialState.processMessage what=4
D/Tethering( 2268): sendTetherStateChangedBroadcast 0, 0, 0
E/SoftapController( 2158): SIOCGIPRIV failed: -1
E/SoftapController( 2158): Softap fwReload - failed: -1
E/WifiStateMachine( 2268): Failed to reload STA firmware java.lang.IllegalStateE
xception: Error communicating to native daemon
D/CommandListener( 2158): Setting iface cfg
D/CommandListener( 2158): Trying to bring down wlan0
D/CommandListener( 2158): broadcast flag ignored
D/CommandListener( 2158): multicast flag ignored
D/NetworkManagementService( 2268): rsp
D/NetworkManagementService( 2268): flags
E/CommandListener( 2158): Failed to open /proc/sys/net/ipv6/conf/wlan0/use_tempa
ddr: No such file or directory
E/WifiStateMachine( 2268): Unable to change interface settings: java.lang.Illega
lStateException: Unable to communicate with native daemon to set ipv6privacyexte
nsions - com.android.server.NativeDaemonConnectorException: Cmd {interface ipv6p
rivacyextensions wlan0 enable} failed with code 400 : {Failed to set ipv6 privac
y extensions (No such file or directory)}
F/NetworkStats( 2268): problem reading network stats
F/NetworkStats( 2268): java.lang.IllegalStateException: problem parsing idx 1
F/NetworkStats( 2268): at com.android.internal.net.NetworkStatsFactory.readNetw
orkStatsDetail(NetworkStatsFactory.java:300)
F/NetworkStats( 2268): at com.android.server.NetworkManagementService.getNetwor
kStatsUidDetail(NetworkManagementService.java:1282)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService.performPol
lLocked(NetworkStatsService.java:831)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService.performPol
l(NetworkStatsService.java:799)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService.access$100
(NetworkStatsService.java:128)
F/NetworkStats( 2268): at com.android.server.net.NetworkStatsService$2.onReceiv
e(NetworkStatsService.java:624)
F/NetworkStats( 2268): at android.app.LoadedApk$ReceiverDispatcher$Args.run(Loa
dedApk.java:728)
F/NetworkStats( 2268): at android.os.Handler.handleCallback(Handler.java:605)
F/NetworkStats( 2268): at android.os.Handler.dispatchMessage(Handler.java:92)
F/NetworkStats( 2268): at android.os.Looper.loop(Looper.java:137)
F/NetworkStats( 2268): at android.os.HandlerThread.run(HandlerThread.java:60)
F/NetworkStats( 2268): Caused by: java.io.FileNotFoundException: /proc/net/xt_qt
aguid/stats: open failed: ENOENT (No such file or directory)
F/NetworkStats( 2268): at libcore.io.IoBridge.open(IoBridge.java:406)
F/NetworkStats( 2268): at java.io.FileInputStream.(FileInputStream.java:7
8)
F/NetworkStats( 2268): at com.android.internal.net.NetworkStatsFactory.readNetw
orkStatsDetail(NetworkStatsFactory.java:269)
F/NetworkStats( 2268): ... 10 more
F/NetworkStats( 2268): Caused by: libcore.io.ErrnoException: open failed: ENOENT
(No such file or directory)
F/NetworkStats( 2268): at libcore.io.Posix.open(Native Method)
F/NetworkStats( 2268): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
F/NetworkStats( 2268): at libcore.io.IoBridge.open(IoBridge.java:390)
F/NetworkStats( 2268): ... 12 more
I/wpa_supplicant( 3325): rfkill: Cannot open RFKILL control device
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :16 found
E/ethernet( 2268): the device flag :1043
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :16 found
E/ethernet( 2268): the device flag :1003
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :16 found
E/ethernet( 2268): the device flag :1003
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
E/wpa_supplicant( 3325): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3325): P2P: Own listen channel: 11
I/wpa_supplicant( 3325): P2P: Random operating channel: 81:1
I/wpa_supplicant( 3325): [CTRL_IFACE]DRIVER MACADDR
I/wpa_supplicant( 3325): [CTRL_IFACE]LIST_NETWORKS
D/StatusBar.NetworkController( 2347): refreshViews connected={ } level=?? combin
edSignalIconId=0x7f0200ae/com.android.systemui:drawable/stat_sys_wifi_signal_0 c
ombinedActivityIconId=0x0 mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId
=0x0 mDataDirectionIconId=0x0 mDataSignalIconId=0x0 mDataTypeIconId=0x0 mWifiIco
nId=0x7f0200ae mEthernetIconId=0x7f02008f mBluetoothTetherIconId=0x1080533
E/WifiConfigStore( 2268): Error parsing configurationjava.io.FileNotFoundExcepti
on: /data/misc/wifi/ipconfig.txt: open failed: ENOENT (No such file or directory
)
I/wpa_supplicant( 3325): [CTRL_IFACE]SCAN_INTERVAL 15
I/wpa_supplicant( 3325): [CTRL_IFACE]DRIVER BTCOEXSCAN-STOP
E/wpa_supplicant( 3325): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3325): [CTRL_IFACE]DRIVER RXFILTER-ADD 3
E/wpa_supplicant( 3325): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3325): [CTRL_IFACE]DRIVER RXFILTER-STOP
E/wpa_supplicant( 3325): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3325): [CTRL_IFACE]AP_SCAN 1
I/wpa_supplicant( 3325): [CTRL_IFACE]RECONNECT
I/wpa_supplicant( 3325): [CTRL_IFACE]DRIVER SETBAND 0
E/wpa_supplicant( 3325): wpa_driver_nl80211_driver_cmd: failed to issue private
commands
I/wpa_supplicant( 3325): wlan0: CTRL-EVENT-DRIVER-STATE HANGED
E/WifiStateMachine( 2268): Failed to set frequency band 0
I/wpa_supplicant( 3325): [CTRL_IFACE]TERMINATE
D/CommandListener( 2158): Clearing all IP addresses on wlan0
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :16 found
E/ethernet( 2268): the device flag :1002
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
D/StatusBar.NetworkController( 2347): refreshViews connected={ } level=?? combin
edSignalIconId=0x7f0200ae/com.android.systemui:drawable/stat_sys_wifi_signal_0 c
ombinedActivityIconId=0x0 mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId
=0x0 mDataDirectionIconId=0x0 mDataSignalIconId=0x0 mDataTypeIconId=0x0 mWifiIco
nId=0x7f0200ae mEthernetIconId=0x7f02008f mBluetoothTetherIconId=0x1080533
I/wpa_supplicant( 3325): wlan0: CTRL-EVENT-TERMINATING
D/StatusBar.NetworkController( 2347): refreshViews connected={ } level=?? combin
edSignalIconId=0x0/(null) combinedActivityIconId=0x0 mAirplaneMode=false mDataAc
tivity=0 mPhoneSignalIconId=0x0 mDataDirectionIconId=0x0 mDataSignalIconId=0x0 m
DataTypeIconId=0x0 mWifiIconId=0x0 mEthernetIconId=0x7f02008f mBluetoothTetherIc
onId=0x1080533
E/ethernet( 2268): recvmsg get data
E/ethernet( 2268): event :17 found
E/ethernet( 2268): the device flag :1002
E/ethernet( 2268): Done parsing
E/ethernet( 2268): poll state :, left:4096
E/ethernet( 2268): Poll events from ethernet devices
W/Netd ( 2158): No subsystem found in netlink event
D/NetlinkEvent( 2158): Unexpected netlink message. type=0x11
E/EthernetStateTracker( 2268): DhcpHandler: DHCP request failed: Timed out waiti
ng for DHCP to finish
-
woody_chen 发表于 2015-4-28 16:49
最近我也在搞W8686的驱动,板子是tiny210, 系统是2.6.35.7。
驱动应该是加载成功的。用iwlist wlan0 scan可以搜索到周围的AP.
1.执行 ifconfig wlan0 up的时候也会提示ADDRCONF(NETDEV_UP): wlan0: link is not ready。再执行这个命令的时候又不提示了。
2. wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf 提示这个conf文件不能读或解析。
目前没有什么进展。
tiny210 不是已经支持Marvel8686 了吗,为啥你还要自己搞?
2、是否是权限问题?
-
这个好像,是插入卡,就频繁的通过CD引脚检测中断引起加载wifi libertas_sdio.ko
模块,但是如果一旦加载一次这个模块驱动,下次加载就会提示已经存在,这里重复加载意味着这个加载一次后又卸载了,然后又再次加载?!怎么会这样呢?
-
android之wifi移植全过程(一)之后的android之wifi移植全过程(二)非常不错,照着做应该很快就能搞定了!
六、android的wifi移植。
现在底层的都通了,接下来就把wifi移植到android系统中。
1.提供固件firmware给驱动。
WIFI需要的firmware要复制到/etc/firmware。 或者复制到WIFI驱动指定的位置,然后WIFI驱动会自动加载。
在此把wifi模块提供的sd8686.bin sd8686_helper.bin放到out/target/product/fs100/system/etc/firmware目录下。
其实,和上面放目录是一样的。
2.修改自己定制的BoardConfig.mk,使能wpa_supplicant。
修改vendor/farsight/fs100/BoardConfig.mk:
把BOARD_WPA_SUPPLICANT_DRIVER :=true
改为BOARD_WPA_SUPPLICANT_DRIVER := WEXT
目的是:把driver_wext.c作为wpa_supplicant的driver。wpa_supplicant通过它去与内核的wifi驱动打交道。
修改external/wpa_supplicant/Android.mk
把WPA_BUILD_SUPPLICANT :=false
改为WPA_BUILD_SUPPLICANT := true
默认使用驱动driver_wext.c。
如果使用定制的wpa_supplicant驱动(例如 madwifi),可以设置:
BOARD_WPA_SUPPLICANT_DRIVER := MADWIFI
3.使wpa_supplicant打印更多的调试信息
wpa_supplicant默认信息显示的等级为SG_INFO,为了输出更多信息,可修改:
修改external/wpa_supplicant/common.c
把int wpa_debug_level = MSG_INFO;
改为:int wpa_debug_level = MSG_DEBUG;
修改external/wpa_supplicant/common.h
把宏定义#define wpa_printf(level, ...)中的if ((level) >= MSG_INFO)
改为if ((level) >= MSG_DEBUG)
4.提供一个合适的wpa_supplicant.conf
修改wpa_supplicant.conf:
把external/wpa_supplicant/wpa_supplicant.conf拷贝到out/target/product/fs100/system/etc/wifi/目录下,
并把:ctrl_interface=DIR=/data/misc/wifi/wpa_supplicant GROUP=wifi
改为:
ctrl_interface=wlan0
5.修改init.rc配置路径和权限
A)配置init.rc文件修改out/target/product/fs100/root/init.rc, 让wifi用户拥有相关的权限,
在 #give system access to wpa_supplicant.conf for backup and restore后面增加:
#add by liyulei 2011-11-19
mkdir /data/misc/wifi/sockets 0777 wifi wifi
chown wifi wifi /data/misc/wifi
chown wifi wifi /data/misc/wifi/wpa_supplicant.conf
#for dhcp
mkdir /data/misc/dhcp 0777 dhcp dhcp
chmod 0770 /data/misc/dhcp
#end add
B)注释原有环境变量#export PATH
改为:
export PATH /sbin:/system/sbin:/system/bin:/system/xbin
#above modified by liyulei 2011-11-19
6. 确保wpa_supplicant和dhcpcd是通过init.c起来的。
配置init.rc文件修改out/target/product/fs100/root/init.rc, 在末尾添加:
#add by liyulei 2011-11-19
for wifi Android private socket
service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c/system/etc/wifi/wpa_supplicant.conf
socket wpa_wlan0 dgram 660 wifi wifi
group system wifi inet
disabled
oneshot
#for dhcp
service dhcpcd /system/bin/dhcpcd wlan0
group system dhcp
disabled
oneshot
#end add。
7.设置驱动以模块方式加载
拷贝内核生成的drivers/net/wireless/libertas/libertas_sdio驱动模块
到out/target/product/fs100/system/lib/modules/目录下。
然后修改hardware/libhardware_legacy/wifi/wifi.c
1)修改wifi.c中的宏:
#define WIFI_DRIVER_MODULE_PATH "/system/lib/modules/libertas_sdio.ko"
#define WIFI_DRIVER_MODULE_NAME "libertas_sdio"
#define WIFI_TEST_INTERFACE "wlan0"
或者,也可以这样改:
修改vendor/farsight/fs100/BoardConfig.mk:
WIFI_DRIVER_MODULE_PATH ="/system/lib/modules/libertas_sdio.ko"
WIFI_DRIVER_MODULE_NAME ="libertas_sdio"
WIFI_TEST_INTERFACE ="wlan0"
和上面一样的效果。
8.添加休眠唤醒代码:
1)在frameworks\base\core\Jni\android_net_wifi_Wifi.cpp中添加相应的休眠唤醒函数:
在static JNINativeMethod gWifiMethods[]结构体添加方法:
{"moduleWakeupStatus","()Z",(void*)android_net_wifi_moduleWakeupStatus},
{"WaitTime","(I)Z",(void*)android_net_wifi_WaitTime},
并实现这些方法/*add by liyulei 2011-11-20*/
static jboolean android_net_wifi_moduleWakeupStatus(JNIEnv* env, jobject clazz)
{
return (jboolean)(::wifi_module_wakeup_status() == 0);
}
static jboolean android_net_wifi_WaitTime(JNIEnv* env, jobject clazz, jint waittime)
{
return (jboolean)(::wifi_module_wait_time(waittime) == 0);
}
/*end add by liyulei*/
2)而相应的细体实现在wifi.c中:
在wifi.c添加:
/*add by caoyi 2011-10-20*/
int wifi_module_wakeup_status()
{
return 1;
}
int wifi_module_wait_time(int watiTime)
{
sleep(watiTime);
return 0;
}
/*end add*/
9.配置dhcpcd.conf
修改源码目录下external/dhcpcd下的Android.mk文件
取消注释
-->26 include $(CLEAR_VARS)
-->27 LOCAL_MODULE := dhcpcd.conf
-->28 LOCAL_MODULE_TAGS := user
-->29 LOCAL_MODULE_CLASS := ETC
-->30 LOCAL_MODULE_PATH := $(etc_dir)
-->31 LOCAL_SRC_FILES := android.conf
-->32 include $(BUILD_PREBUILT)
然后重新编译mm,将编译产生的dhcpcd.conf放置到文件系统的目录system/etc/dhcpcd/dhcpcd.conf
最后确定dhcpcd.conf内容有:
interface wlan0
option subnet_mask, routers, domain_name_servers
option ntp_servers
没有的话,就修改。
10.修改WifiStateTracker.java
将frameworks/base/wifi/java/android/net/wifi/WifiStateTracker.java 里的mInterfaceName = SystemProperties.get("wifi.interface", "eth0");
改为:
mInterfaceName = SystemProperties.get("wifi.interface", "wlan0");
最后重新编译mm
编译镜像文件后烧写到开发板上就可以使用WiFi模块连接网络。
-
O(∩_∩)O~,编译出来,马上就可以用了,爽歪歪!
-
soso 发表于 2015-4-22 16:45
赞 嘿嘿 谢谢分享
你也越来越少出现了!
-
哎,经过各种折腾,搞定了,还是SDMMC驱动的问题,移植一个可行的就出来了。
/ # insmod system/lib/modules/libertas.ko
/ # insmod system/lib/modules/libertas_sdio.ko
libertas_sdio: Libertas SDIO driver++
libertas_sdio: Copyright Pierre Ossman
libertas_sdio mmc2:0001:1: (unregistered net_device): 70:f3:95:ec:3e:3f, fw 9.70.3p24, cap 0x00000303
libertas_sdio mmc2:0001:1: wlan0: Marvell WLAN 802.11 adapter
libertas_sdio: Libertas SDIO driver--
-
本帖最后由 Wince.Android 于 2015-4-16 15:42 编辑
方法1:把Marvell 8686的固件放在内核里编译进内核
Device Drivers --->
Generic Driver Options --->
下面这两项不选,如果选择会avoid building firmware.
[ ] Select only drivers that don't need compile-time external firmware
[ ] Prevent firmware from being built
Include in-kernel firmware blobs in kernel binary
固件的名称以空格分开
(sd8686_helper.bin sd8686.bin) External firmware blobs to build into the kernel binary
(firmware) Firmware blobs root directory
把固件sd8686_helper.bin sd8686.bin放到内核目录
android_kernel/firmware/
方法2:把固件放在文件系统,加载内核的时候从文件系统里获得
要配置固件的路径
看看把,固件放到kernel会怎么样,只能这样尝试了
——————这几个尝试各种方法就是没用,后来还是老老实实看代码了,在libertas 源码里面发现,就初始化这个SDIO WiFi都没成功,所以更别想做好了,真悲剧啊。
/*******************************************************************/
/* Module functions */
/*******************************************************************/
static int __init if_sdio_init_module(void)
{
int ret = 0;
lbs_deb_enter(LBS_DEB_SDIO);
printk(KERN_INFO "libertas_sdio: Libertas SDIO driver++\n");
printk(KERN_INFO "libertas_sdio: Copyright Pierre Ossman\n");
ret = sdio_register_driver(&if_sdio_driver);
/* Clear the flag in case user removes the card. */
user_rmmod = 0;
printk(KERN_INFO "libertas_sdio: Libertas SDIO driver--\n");
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
return ret;
}
这个就出错了。god!!!
-
Longtrump_seven 发表于 2015-4-15 11:02
用我司的WIFI模块,可支持MCU驱动已调好~
我用这个芯片基本没什么用了,我只是要搞定他,不是用来做产品的。