ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

顯示具有 wifi 標籤的文章。 顯示所有文章
顯示具有 wifi 標籤的文章。 顯示所有文章

2013年1月14日 星期一

Wifi dongle with android sdk - RTL8192c

http://code.google.com/p/rtl8192cu/source/browse/

有提供 debian, android, android ics 的 sdk, porting guide。

2012年8月22日 星期三

hotspot (wifiap) 的 dhcp lease time

hotspot 的 dhcp,dns 等動作是交給 dnsmasq 這個程式來作。

netd 的 TetherController.cpp 是負責叫起 dnsmasq 動作的部份。

dnsmasq 跟一般的 command 一樣,是由 command argument 決定動作。
argument 也由 TetherController.cpp 負責。

dhcp 的 lease time 也由 argument 決定。

以下就是準備好 argument,然後用execv( ) 啟動 dnsmasq 的 code: int num_processed_args = 4 + (num_addrs/2) + 1; // 1 null for termination char **args = (char **)malloc(sizeof(char *) * num_processed_args); args[num_processed_args - 1] = NULL; args[0] = (char *)"/system/bin/dnsmasq"; args[1] = (char *)"--no-daemon"; args[2] = (char *)"--no-resolv"; args[3] = (char *)"--no-poll"; int nextArg = 4; for (int addrIndex=0; addrIndex < num_addrs;) { char *start = strdup(inet_ntoa(addrs[addrIndex++])); char *end = strdup(inet_ntoa(addrs[addrIndex++])); asprintf(&(args[nextArg++]),"--dhcp-range=%s,%s,1h", start, end); } if (execv(args[0], args)) { LOGE("execl failed (%s)", strerror(errno)); }

其中 : "--dhcp-range=%s,%s,1h" 最後一項就是 lease_time: 1h。


dnsmasq 啟動後,會由 read_opts( ) 負責 parsing argument, update parameter.



修改後,client 端可以用 showlease wlan0 這個 command 來看收到的 dhcp server 傳來的 lease time 是多少。

2012年5月25日 星期五

android: enable wifi ap mode

因為這版bsp,wifi 可以動。所以看看是不是 ap mode 也可以起得來。
直接 enable thethering -- portable Wi-Fi hotspot。
結果是 Error。

log 是.. E/WifiService( 2379): ath: load Wi-Fi driver for AP mode. set_cpu_freq, wp 0 I/wlan_tool( 2679): loadAPdriver+ I/wlan_tool( 2680): AP wifi loading I/wlan_tool( 2684): Try to load AP driver with ifname=softap0 devmode=ap AR6000: configuration opcode 7 is only used for RTOS systems, not Linux systemsD/dalvikvm( 2379): GC_CONCURRENT freed 979K, 45% free 4279K/7751K, external 2765K/3965K, paused 4ms+6ms AR6K: ** HIF layer does not support scatter requests (17) W/Netd ( 2309): action=5, iface=softap0 wmi_control_rx() : Unknown id 0x101e D/Tethering( 2379): interfaceLinkStatusChanged softap0, false D/NetdConnector( 2379): RCV <- {600 Iface linkstate softap0 down} W/Netd ( 2309): action=5, iface=softap0 /Tethering( 2379): interfaceLinkStatusChanged softap0, false D/NetdConnector( 2379): RCV <- {600 Iface linkstate softap0 down} D/Tethering( 2379): softap0 is not a tetherable iface, ignoring W/Netd ( 2309): action=5, iface=softap0 D/Tethering( 2379): interfaceLinkStatusChanged softap0, false D/NetdConnector( 2379): RCV <- {600 Iface added softap0} D/NetdConnector( 2379): RCV <- {600 Iface linkstate softap0 down} I/wlan_tool( 2699): ar6000 AP driver loaded I/wlan_tool( 2701): loadAPdriver- D/SoftapController( 2309): Softap driver stop: 0 D/SoftapController( 2309): fwReloadSoftap: argv[2]:wlan0 argv[3]:AP D/SoftapController( 2309): Softap fwReload - Ok D/SoftapController( 2309): Softap driver start: 0 D/NetdConnector( 2379): SND -> {softap stop wlan0} {null} D/NetdConnector( 2379): RCV <- {200 Softap operation succeeded} D/NetdConnector( 2379): RSP <- {200 Softap operation succeeded} D/NetdConnector( 2379): SND -> {softap fwreload wlan0 AP} {null} D/NetdConnector( 2379): RCV <- {200 Softap operation succeeded} D/NetdConnector( 2379): RSP <- {200 Softap operation succeeded} D/NetdConnector( 2379): SND -> {softap start wlan0} {null} D/NetdConnector( 2379): RCV <- {200 Softap operation succeeded} D/NetdConnector( 2379): RSP <- {200 Softap operation succeeded} E/SoftapController( 2309): AR6000_IOCTL wlap0 set wlan state failed: -1:No such device D/NetdConnector( 2379): SND -> {softap set wlan0 wlap0 "xxxAndroidAP" open null} {null} D/NetdConnector( 2379): RCV <- {400 Softap operation failed (No such device)} D/NetdConnector( 2379): RSP <- {400 Softap operation failed (No such device)} E/WifiService( 2379): Exception in startAccessPoint()

所以問題應該是在: E/SoftapController( 2309): AR6000_IOCTL wlap0 set wlan state failed: -1:No such device
然後記得以前 auron 說過,當初 ap mode fail 是 interface name 不對。
對照一下,果然,前面 wlan_tool 使用 softap0,後面 framework 都用 wlap0。

所以修改一下 wlan_tool
... 這個是在 atheros wifi sdk 的 driver project 中..



附記:auron 改 WifiService.java ,其中 SOFTAP_IFACE=" " 她改 wlan1
要注意 可以作為 tether 的 interface 寫在 framework/base/core/res/res/values/config.xml:

標籤

網誌存檔