wifi移植后,连接几分钟后自动断开

heshanxingzhe 2011-06-13 04:50:34
最近移植了一个sdio的wifi驱动,能够正常启动。
iwconfig wlan2 essid "China-2205"和/sbin/udhcpc -i wlan2可以正确的连接,然后也可以ping 192.168.0.1也可以ping通


root@J2534:/# modprobe libertas_sdio
[ 22.315000] libertas_sdio: Libertas SDIO driver
[ 22.315000] libertas_sdio: Copyright Pierre Ossman
[ 23.610000] libertas: 00:0b:6c:b6:d6:e3, fw 9.70.3p24, cap 0x00000303
[ 23.610000] libertas: unidentified region code; using the default (USA)
[ 23.660000] cfg80211: Calling CRDA for country: US
[ 23.685000] libertas: wlan2: Marvell WLAN 802.11 adapter
root@J2534:/# wificfg
[ 37.790000] ADDRCONF(NETDEV_UP): wlan2: link is not ready

Searching wireless AP,please wait...
Scanning result:
ESSID key on/off
(1) "ChinaNet-CFEb" on
(2) "chinaNet" off
(3) "router-China 2205" on

you can also enter r/q for:
Rescanning(r)
quit(q)

Pls enter the Router's number[(1)?]:3
Pls enter key[null ?]:79376
The key is 79376 are you sure?[Y/N]
[ 244.325000] cfg80211: Calling CRDA for country: GB
udhcpc (v1.18.4) started
Setting IP address 0.0.0.0 on wlan2
Sending discover...
Sending select for 192.168.0.101...
Lease of 192.168.0.101 obtained, lease time 168000
Setting IP address 192.168.0.101 on wlan2
Deleting routers
route: SIOCDELRT: No such process
Adding router 192.168.0.1
Recreating /etc/resolv.conf
Adding DNS server 202.96.134.133
Adding DNS server 202.96.128.68

Connecting is successful!
root@J2534:/# ifconfig
wlan2 Link encap:Ethernet HWaddr 00:0B:6C:B6:D6:E3
inet addr:192.168.0.101 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::20b:6cff:feb6:d6e3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:115 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11378 (11.1 KiB) TX bytes:3104 (3.0 KiB)


但过了一阵后(3 minutes~10 minutes),就自动断开了连接。


root@J2534:/# [ 296.035000] cfg80211: Calling CRDA to update world regulatory domain

root@J2534:/# dmesg|grep cfg80211
[ 758.790000] cfg80211: Calling CRDA for country: GB
[ 791.595000] cfg80211: All devices are disconnected, going to restore regulatory settings
[ 791.595000] cfg80211: Restoring regulatory settings
[ 791.595000] cfg80211: Calling CRDA to update world regulatory domain


看内核里的代码net/wireless/reg.c中,应该是到了这里:

static int call_crda(const char *alpha2)
{
char country_env[9 + 2] = "COUNTRY=";
char *envp[] = {
country_env,
NULL
};

if (!is_world_regdom((char *) alpha2))
printk(KERN_INFO "cfg80211: Calling CRDA for country: %c%c\n",
alpha2[0], alpha2[1]);
else
printk(KERN_INFO "cfg80211: Calling CRDA to update world "
"regulatory domain\n");

/* query internal regulatory database (if it exists) */
reg_regdb_query(alpha2);

country_env[8] = alpha2[0];
country_env[9] = alpha2[1];

return kobject_uevent_env(®_pdev->dev.kobj, KOBJ_CHANGE, envp);
}




但一直看不懂究竟是啥意思?


从man crda中得知,crda是由kernel触发和发出的udev时间给userspace。
下面是摘自man crda中的一段:

Description
crda is the Linux wireless central regulatory domain agent. crda is intended to be used by udev scripts and
should not be run manually unless debugging udev scripts. crda is triggered to run by the kernel by sending a
udev event upon a new regulatory domain change. Regulatory domain changes are triggered by the wireless kernel
subsystem (upon initialization and on reception of country IEs), wireless drivers, or userspace (see iw ). Upon a
regulatory domain change the kernel sends a udev change event for the regulatory platform. The kernel ignores reg‐
ulatory domains sent to it if it does not expect them. The regulatory domain is read by crda from the regula‐
tory.bin file.



哪位大侠对mdev比较了解或遇见过类似情况的,麻烦指点下,感谢了!
...全文
157 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wodesa 2011-06-15
  • 打赏
  • 举报
回复
关注学习
Frankfu001 2011-06-14
  • 打赏
  • 举报
回复
关注一下,还没看到过!

3,846

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 无线
社区管理员
  • 无线
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧