Apr 28, 2008

ASUS WL-167G (USB WLAN Adapter) For ARM Linux

UPDATE : 學弟搞定了
usb host timeout的原因是....usb controller過熱被保護電路關電.......

林老師卡好勒


=============================================================
great~ it offers linux driver~

copy the directory Linux/rt73 in the Driver CDROM    ( remember to chmod +w )

follow the README in Linux/rt73/module/
if you got error "undefined get_wireless_stats"

just fix rtmp_main.c, replace  netdev->get_wireless_stats to netdev->get_stats

=======================================

編譯module


網路上有非官方driver : rt2x00 project

每天最新版本

或是直接用CVS更新
cvs -d:pserver:anonymous@rt2400.cvs.sourceforge.net:/cvsroot/rt2400 login

cvs -z3 -d:pserver:anonymous@rt2400.cvs.sourceforge.net:/cvsroot/rt2400 co -P source/rt73

修改Makefile

最前面增加五行

ARCH=arm

CROSS_COMPILE=/usr/local/arm/3.4.1/bin/arm-linux-

KERNDIR=/home2/fyodor/kernel/linux-2.6.25__from__2.6.24.3

(KERNDIR要指到目標板所使用的KERNEL SOURCE,而且KERNEL必須先設定好交叉編譯)

ROOTFS = /home2/fyodor/filesystem/rootfs

MODDIR = /lib/modules/2.6.24.3/extra

把module install 的目標位置依照目標kernel版本設定

否則就會安裝到目前uname -r 所找到的kernel module位置...

ps. make install時,modules.dep的設定不會跟著MODDIR而改變

所以還是得設定成extra

修改一行
FIRM_DIR :=    $(ROOTFS)/lib/firmware

編譯

(host)# make armdebug

警告訊息

!!! WARNING: Module file much too big (>1MB)
!!! Check your kernel settings or use 'strip'
*** Module rt73.ko built successfully

表示編出來的module太大了,這個好解決

必須削減(strip)多餘訊息 (strip之後,板子上無法modprobe!format不合)
(host)# arm-linux-strip ./rt73.ko

把module安裝到target rootfs


這一步,我不很確定怎麼做,試看看吧~

(host)# sudo make install
*** Install module in /lib/modules/2.6.24.3/extra ...
make[1]: Entering directory `/home2/fyodor/kernel/linux-2.6.25__from__2.6.24.3'
INSTALL /home2/fyodor/filesystem/tools/wirelessTool/WL-167G/rt73-cvs/rt73-cvs-2008042100/Module/rt73.ko
DEPMOD  2.6.24.3
make[1]: Leaving directory `/home2/fyodor/kernel/linux-2.6.25__from__2.6.24.3'
/sbin/depmod -a
*** Update /etc/modprobe.d/ralink alias for wlan*
*** Install firmware in /home2/fyodor/filesystem/rootfs/lib/firmware ...
*** Check old config ...

警告訊息

WARNING: Couldn't find symtab and strtab in module /lib/modules/2.6.20-15-generic/extra/rt73.ko
*** Update /etc/modprobe.d/ralink alias for wlan*
*** Install firmware in /home2/fyodor/filesystem/rootfs/lib/firmware ...
*** Check old config ...

因為這一個編譯所使用的kernel版本2.6.24.3,和host機器上目前使用的版本2.6.15不同導致這個錯誤不知道怎麼處理... 應該是沒關係因為真正運作時,這個module在板子上所配合的kernel 版本就對上了參考: http://www.linuxsir.org/bbs/thread307321.html
結束

一樣照著路徑複製到rootfs裡面
module : /lib/modules/2.6.24.3/extra/rt73.ko

firmware : /lib/firmware/rt73.bin

status code :

s3c2410-ohci s3c2410-ohci: urb c2704ec0 path 1 ep0in 5ec20000 cc 5
–> status -62

all status code : include/asm-generic/errno.h
#define ETIME 62      /* Timer expired */

Document of error codes : Documentation/usb/error-codes.txt

-ETIME (**)
No response packet received within the prescribed bus turn-around time.  This error may instead be reported as -EPROTO or -EILSEQ.

懶惰的script



ROOTFS=/home2/fyodor/filesystem/rootfs
echo " install module to $ROOTFS/lib/modules/2.6.24.3/extra/"
cp /lib/modules/2.6.24.3/extra/rt73.ko $ROOTFS/lib/modules/2.6.24.3/extra/rt73.ko
echo " install firmware to $ROOTFS/lib/firmware/"
cp /lib/firmware/rt73.bin $ROOTFS/lib/firmware/
ls -alh $ROOTFS/lib/modules/2.6.24.3/extra/rt73.ko
ls -alh $ROOTFS/lib/firmware/rt73.bin

modprobe


[busybox] # modprobe rt73 debug=15 firmware=/lib/firmware/rt73.bin

[busybox] # ifconfig wlan0 up

[busybox] # dmesg
rt73: USBVendorRequest TIMEOUT
rt73: Retry count exhausted or device removed!!!
rt73: BBP version = 0
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0in 5ec20000 cc 5 --> status -62

rt73: USBVendorRequest TIMEOUT
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0out 5ec20000 cc 5 --> status -62

rt73: USBVendorRequest TIMEOUT
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0in 5ec20000 cc 5 --> status -62

rt73: USBVendorRequest TIMEOUT
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0in 5ec20000 cc 5 --> status -62

rt73: USBVendorRequest TIMEOUT
s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0in 5ec20000 cc 5 --> status -62

rt73: USBVendorRequest TIMEOUT
rt73: Retry count exhausted or device removed!!!
rt73: BBP version = 0

為什麼會timeout勒.....  搞了一個禮拜還是搞不清楚
rt73: USBVendorRequest TIMEOUT是我自己加的訊息

總之status -62 = -ETIME,就是TIMEOUT

上面說過了,status code的詳細定義在$(KERNDIR)/include/asm-generic/errno.h

error的解釋在$(KERNDIR)/Documentation/usb/error-codes.txt

去rt2x00.serialmonkey.com post問題,一邊trace driver 一邊等

覺得問題比較有可能出在s3c2410-ohci

畢竟這部份的2440移植,我做的很粗糙

Error Code Tracing


rt73: USBVendorRequest TIMEOUT


$(RT73)/Module/rtusb_io.c ===> RTUSB_VendorRequest function內的ret 值

ret=usb_control_msg(pAd->pUsb_Dev, usb_sndctrlpipe( pAd->pUsb_Dev, 0 ), \

Request, RequestType, Value,Index, TransferBuffer, TransferBufferLength, \

CONTROL_TIMEOUT_JIFFIES);

message : s3c2410-ohci s3c2410-ohci: urb c1980840 path 1 ep0out 5ec20000 cc 5 --> status -62


來源:drivers/usb/host/ohci-q.c : dl_done_list() --> dl_reverse_done_list() --> ed_halted()

誰呼叫RTUSB_VendorRequest


RTUSBReadMACRegister

RTUSBWriteMACRegister


3 comments:

Andrew Chang said...

ps

記得check rootfs裡面的modules.dep

Austin said...

Hello, I've big trouble in establish the
ASUS' wireless card wl-167g , I hope you can help me in some issue.

Austin said...

I just want to drive the card in a fedora enviroment,but I'm a begginer of Linux.

So I got confused in some instructions
which was written in "Read Me"

Here is the problem:
(I promise I've searched for the anwser with google for hours ,but in vain.)

The instruction in step6 to step7:
# !!!check if it is a binary file before loading!!!

I've checked rt73sta.dat,but it's ASCII
code.I just can't find the command which transfers the file to binary code the guidance requires.


The problem is urgent to me...
Please teach me step by step.

I will thank you to death.

Post a Comment