免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4924 | 回复: 0
打印 上一主题 下一主题

wifi移植后,连接几分钟后自动断开,郁闷中。。。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-06-13 22:51 |只看该作者 |倒序浏览
最近移植了一个sdio的wifi驱动,能够正常启动。
iwconfig wlan2 essid "China-2205"和/sbin/udhcpc -i wlan2可以正确的连接,然后ping 192.168.0.1也可以ping通(wificfg是自己写的一个wifi登陆脚本)
  1. root@J2534:/# modprobe libertas_sdio
  2. [   22.315000] libertas_sdio: Libertas SDIO driver
  3. [   22.315000] libertas_sdio: Copyright Pierre Ossman
  4. [   23.610000] libertas: 00:0b:6c:b6:d6:e3, fw 9.70.3p24, cap 0x00000303
  5. [   23.610000] libertas: unidentified region code; using the default (USA)
  6. [   23.660000] cfg80211: Calling CRDA for country: US
  7. [   23.685000] libertas: wlan2: Marvell WLAN 802.11 adapter
  8. root@J2534:/# wificfg
  9. [   37.790000] ADDRCONF(NETDEV_UP): wlan2: link is not ready

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

  16. you can also enter r/q for:
  17.                            Rescanning(r)
  18.                            quit(q)

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

  35. Connecting is successful!
  36. root@J2534:/# ifconfig
  37. wlan2     Link encap:Ethernet  HWaddr 00:0B:6C:B6:D6:E3  
  38.           inet addr:192.168.0.101  Bcast:255.255.255.255  Mask:255.255.255.0
  39.           inet6 addr: fe80::20b:6cff:feb6:d6e3/64 Scope:Link
  40.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  41.           RX packets:115 errors:0 dropped:0 overruns:0 frame:0
  42.           TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
  43.           collisions:0 txqueuelen:1000
  44.           RX bytes:11378 (11.1 KiB)  TX bytes:3104 (3.0 KiB)
复制代码
但过了一阵后(3 minutes~10 minutes),就自动断开了连接。

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

  2. root@J2534:/# dmesg|grep cfg80211
  3. [  758.790000] cfg80211: Calling CRDA for country: GB
  4. [  791.595000] cfg80211: All devices are disconnected, going to restore regulatory settings
  5. [  791.595000] cfg80211: Restoring regulatory settings
  6. [  791.595000] cfg80211: Calling CRDA to update world regulatory domain
复制代码
看内核里的代码net/wireless/reg.c中,应该是到了这里:

  1. static int call_crda(const char *alpha2)
  2. {
  3.         char country_env[9 + 2] = "COUNTRY=";
  4.         char *envp[] = {
  5.                 country_env,
  6.                 NULL
  7.         };

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

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

  16.         country_env[8] = alpha2[0];
  17.         country_env[9] = alpha2[1];

  18.         return kobject_uevent_env(&reg_pdev->dev.kobj, KOBJ_CHANGE, envp);
  19. }
复制代码
但一直看不懂究竟是啥意思?


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

  1. Description
  2.        crda is the Linux wireless central regulatory domain agent.  crda is intended to be used by udev scripts and
  3.        should not be run manually unless debugging udev scripts.  crda is triggered to run by the kernel by sending a
  4.        udev event upon a new regulatory domain change. Regulatory domain changes are triggered by the wireless kernel
  5.        subsystem (upon initialization and on reception of country IEs), wireless drivers, or userspace (see iw ). Upon a
  6.        regulatory domain change the kernel sends a udev change event for the regulatory platform. The kernel ignores reg‐
  7.        ulatory domains sent to it if it does not expect them. The regulatory domain is read by crda from the regula‐
  8.        tory.bin file.
复制代码
哪位大侠对mdev比较了解或遇见过类似情况的,麻烦指点下,感谢了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP