[Driver] Asix AX88772 kernel module (USB Ethernet)

Hello, this is my first dev posting, so  let  me know if there is anything missing...

I have a  Samsung  Galaxy SIII  S3  SGH-I747M (Bell) with  Jelly Bean  4.1.1 kernel 3.0.31 (stock rooted, root66_BMC_I747MVLDLK4.7z). I also have an Asix  USB  LAN adapter  (from monoprice)  +  USB  OTG  cable  which did not work out of the box... but i am a  software  engineer... so I made it work. The process below should work for other carriers / modules if you find the proper kernel source.  Compiling latest drivers directly from Asix  is the best method... Read that part first!

Read the README that comes with your kernel source, you may need a different compiler!  https://github.com/AdiPat/Android_Toolchains  is where I got mine...

Details about the Asix AX88772  USB  lan RJ45 adapter chipset can be found here:
http://www.asix.com.tw/products.php?...emID=86;71;101

You can skip to "Usage instructions" section and download pre-compiled modules, if you have identicalkernel + phone
built from SGH-I747M_BMC_JB_Opensource.zip (I747MVLDLK4, my phone) +  latest Asix driver, works great!!!
https://www.dropbox.com/sh/3lrhwdf2vxe5z90/Hr3-nYX4Ff
built from SGH-I747M_BMC_JB_Opensource.zip (I747MVLDLK4, my phone) stock kernel driver, 'insmod's, but 'ping' is flaky?
https://www.dropbox.com/sh/u068760ytpsn0k1/3di6Wg44ja
built from GT-I930_JB_Opensource_Update7.zip (I9300XXELLA, requested by gingerneil), stock kernel driver, works great!!!
https://www.dropbox.com/sh/5emvafthv061fp6/BKcakiOie8
built from GT-I930_JB_Opensource_Update8.zip (EMR2, requested by gingerneil), stock kernel driver, untested
https://www.dropbox.com/sh/rmc1n4yxckg01zy/a2V5hvIp20
built from Cyanogenmod 10 for i9300, git commit 43aaedbcde478c8e032771d62a1956133b29b1d4, untested
https://www.dropbox.com/sh/n1tdiap4pi2vzm8/TKAj_lChXA
built from Android 4.1.1 for Galaxy Tab 2 (GT-P5110) kernel 3.0.31-523998, contact 'patelkes' if you have questions.
https://www.dropbox.com/sh/r0zkg5do2n3lyg3/fWWyhsz2qy
built from Android 4.? for Xperia Tablet Z ROM (10.3.1.C.0.136), contact 'kristouf666' if you have questions.
https://www.dropbox.com/sh/nxqo1ipkbojakls/eDLHXJzl5s
built from Cyanogenmod 10.1.3 for SGH-i747m, git commit ?
Work in progress

Build environment setup:

-Get  root  access on a Ubuntu Natty (11.04) or similar  linux  build machine / virtual machine
-Install standard unix compiler  tools
apt-get install build-essential
-Install library for menuconfig
apt-get install libncurses5-dev
-Install lzop ( android  compression util)
apt-get install lzop
-Install git
apt-get install git
-Download  Android  toolchains using git

cd /root
git clone  https://github.com/AdiPat/Android_Toolchains.git
-Download  samsung  kernel  SGH-I747M_BMC_JB_Opensource.zip  (international model, etc, also available)... Or download your 3rd party Cyanogenmod,etc kernel SOURCE instead.
-Extract to /root/kernel
mkdir /root/kernel
cd /root/kernel
unzip SGH-I747M_BMC_JB_Opensource.zip
-Set path so  Android  compiler can be found
export CROSS_COMPILE=/root/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-
**EDIT: newer kernels, such as Cyanogenmod 10.2.1, use this
export CROSS_COMPILE=/root/Android_Toolchains/arm-eabi-4.6/bin/arm-eabi-

Compiling built-in kernel modules:  (left for documentation sake, the better method is "Compiling latest drivers directly from Asix")

-Generate '.config'  file  in kernel folder (replace 'm2_att_defconfig' with name of  file  in 'arch\arm\configs\')
make arch=arm m2_att_defconfig
-Modify kernel config to include Asix module and usbnet module
make menuconfig
[Navigate using arrow keys and enter]
Device Drivers ->
Network device support ->
USB Network Adapters ->
Multi-Purpose USB Networking Framework ->
[PRESS SPACEBAR until an M appears on the left]
[M] Multi-purpose USB Networking Framework
[M] ASIX AX88xxx Based USB 2.0 Ethernet Adapters
For reference here is the help info for the 2 options that are now set to 'M'

-Compile modules, where 2 is the number of CPU cores you have (speeds it up)
make -j2 && make -j2 modules
-Once finished, grab your modules
/root/kernel/drivers/net/usb/usbnet.ko
/root/kernel/drivers/net/usb/asix.ko

Usage instructions:

-Use a  root  explorer such as ES  File   manager
Mount /system as rw in ES File manager root settings
copy asix.ko and usbnet.ko to /system/lib/modules/
-Use a terminal emulator / adb shell to load modules ( asix depends on usbnet, so load usbnet first )
su
cd /system/lib/modules
insmod usbnet.ko
insmod asix.ko
-If there are errors, run 'dmesg' and see section called "Insmod errors"
-If there are no errors, you should see 'eth0' in 'netcfg'
-'lsmod' lists modules loaded
-Connect your  USB  ethernet adapter to an ethernet  network
-netcfg should show eth0 as connected
-Setup ethernet settings, if you want static address, for typical internet  router  at 192.168.1.1
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
route add default gw 192.168.1.1 dev eth0
setprop net.dns1 192.168.1.1
ip addr show
ip route show
-Setup ethernet settings, if you want automatic dhcp address
dhcpcd eth0
-If you want one-click enable of your  USB , see section "usbnet widget"

Insmod errors:
exec format error : wrong compiler / wrong kernel source / wrong phone
init_module failed usbnet.ko (file exists) : module already loaded or built into kernel
no such file or directory : run dmesg immediately after attempt... you are missing module dependency
can't open usbnet.ko : are you root?
usbnet widget

Install  Smanager
Download my usbnet script  http://pastebin.com/zQRQ6Kdj
Use a quality notepad editor such as  notepad ++ to edit, ensure line endings are "Unix"
Place in /system/lib/modules/usbnet *cannot be on sdcard, as sdcard is a windows filesystem*
In terminal emulator / adb: "chmod 777 /system/lib/modules/usbnet"
Open Smanager
-Menu -> Scripts
-Menu -> Browser -> /system/lib/modules/usbnet
-Ensure "Fav", "SU" and "is executable" are checked and give it a name 'usbnet', press save.
On homescreen, add widget, Smanager, pick your script 'usbnet'
You now have 1 click access to loading the modules, setting IP address, and testing connectivity to your router.
GT-9300 differences (thanks gingerneil)
Kernel source
GT-I930_JB_Opensource_Update7.zip
While building the kernel, the make config step is different
make arch=arm m0_00_defconfig
There is a third module built,
/root/kernel/drivers/net/mii.ko
Usage instructions,  new  order of operations

insmod mii.ko
insmod usbnet.ko
insmod asix.ko
/system/lib/modules is not persistent on this  phone , instead store modules + usbnet script
/system/media
Compiling latest drivers directly from Asix

For some reason on my  phone  the stock kernel asix module did not work 100%.
I could insmod both modules, and using Wireshark, I verified my computer was receiving 'ping' packets, but the  phone  wasn't getting any 'ping reply' packets. This latest Asix driver works perfectly for me. 

UPDATE::  http://www.asix.com.tw/FrootAttach/d...Source.tar.bz2  is available, but I have not tried it!

Follow "Environment setup" above

Code:
cd kernel_src_folder
Generate kernel '.config' file (replace 'm2_att_defconfig' with name of file in 'arch\arm\configs\')

Code:
make arch=arm m2_att_defconfig
Code:
mkdir /root/asix && cd /root/asix
Code:
wget http://www.asix.com.tw/FrootAttach/driver/AX88772B_772A_760_772_178_LINUX_Driver_v4.4.1_Source.zip
Code:
unzip AX88772B_772A_760_772_178_LINUX_Driver_v4.4.1_Source.zip
Code:
rm -rf Makefile
# we are replacing the Makefile with a new one.... if you edit, ensure indents = TABS
Code:
CROSS_COMPILE=/root/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi- make
**EDIT: newer kernels, such as Cyanogenmod 10.2.1, use this
Code:
CROSS_COMPILE=/root/Android_Toolchains/arm-eabi-4.6/bin/arm-eabi- make
Follow the "usage instructions" above, but since this is an "all-in-one" module, remove references to 'usbnet' 

Other informational Links

Thanks to viulian for his inspirational  post here  in regards to compiling  external  module.

If you want to compare your phone's kernel configuration to the one in the download source from  Samsung read this post: 

To see the list of loadable and built-in modules,  see this.

More information about compiling  kernel modules / asix / other usb chipsets / other devices 

Did you know that Asix now manages Moschip products?  Looking for MCS7830 drivers? 

Thanks to zhlvf for pointing  this  , there is a way to hack  android  to think  Wifi  is connected when an  USB  ethernet is plugged in... (solves issues in some  apps , like  google  play / market, which ignore  USB  ethernet as a valid connection).

Make errors documentation

Model number and version code explanation  (how to tell which samsung.opensource.com zip  file  to download)

https://www.kernel.org/doc/Documenta...ld/modules.txt

To get the active .config from a Cyanogen mod  android ,
Code:
adb pull /proc/config.gz
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值