Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Driver] Asix AX88772 kernel module (USB Ethernet)

OP kevinf28

3rd February 2013, 08:39 PM   |  #1  
OP Member
Thanks Meter: 27
 
95 posts
Join Date:Joined: Oct 2012
More
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 identical kernel + 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
-Create a git account
https://github.com/
-Create private keys on linux (as root)
ssh-keygen
-Upload public key to github.com
-Download Android toolchains using git
mkdir /root/git
cd /root/git
git init
git remote add origin git@github.com:AdiPat/Android_Toolchains.git
git clone git@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/git/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/git/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/git/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/git/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
Last edited by kevinf28; 21st August 2014 at 04:45 PM. Reason: replaced makefile, modules_prepare
The Following 13 Users Say Thank You to kevinf28 For This Useful Post: [ View ]
4th February 2013, 10:53 AM   |  #2  
Senior Member
Thanks Meter: 27
 
124 posts
Join Date:Joined: Nov 2012
Quote:
Originally Posted by kevinf28

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'
-If there are no errors, you should see 'eth0' in 'netcfg'
-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
-Setup ethernet settings, if you want automatic dhcp address
dhcpd eth0

Hi,
I have tried to insert your modules (I have the 3.0.31 kernel on the international S3) - but I get "exec format error". This is after placing your files in right place, and running under root through terminal emulator. Any idea why I am getting this error, and how to get around it ?
4th February 2013, 03:05 PM   |  #3  
OP Member
Thanks Meter: 27
 
95 posts
Join Date:Joined: Oct 2012
More
Quote:
Originally Posted by gingerneil

Hi,
I have tried to insert your modules (I have the 3.0.31 kernel on the international S3) - but I get "exec format error". This is after placing your files in right place, and running under root through terminal emulator. Any idea why I am getting this error, and how to get around it ?

Unfortunately, you are not running an "identical" kernel. Linux is particularly fussy with kernel modules, it has to be a perfect match.

Android takes a generic 3.0.31 linux kernel and applies device specific patches. So my i747 3.0.31 kernel is not identical to your i9300 3.0.31.

I can build the modules for you, since I already have the environment setup. Please visit http://opensource.samsung.com/recept...rchValue=i9300 and let me know which one sounds correct..
4th February 2013, 04:33 PM   |  #4  
Senior Member
Thanks Meter: 27
 
124 posts
Join Date:Joined: Nov 2012
Quote:
Originally Posted by kevinf28

I can build the modules for you, since I already have the environment setup. Please visit http://opensource.samsung.com/recept...rchValue=i9300 and let me know which one sounds correct..

That would be fantastic - thanks. I am running the internation i9300 - so I would go with the top one -
GT-I9300_JB_Opensource_Update7.zip
But I'm not sure what may be different across the updates.
I assume that is doesnt matter which ROM I am running, and that a full Rom Manager backup would also backup my stock kernel ?
4th February 2013, 10:12 PM   |  #5  
OP Member
Thanks Meter: 27
 
95 posts
Join Date:Joined: Oct 2012
More
Quote:
Originally Posted by gingerneil

That would be fantastic - thanks. I am running the internation i9300 - so I would go with the top one -
GT-I9300_JB_Opensource_Update7.zip
But I'm not sure what may be different across the updates.
I assume that is doesnt matter which ROM I am running, and that a full Rom Manager backup would also backup my stock kernel ?

Kernel loadable modules are completely inert by themselves, so there is no need to worry about your phone bricking [but a backup never hurts].

If you build modules into the kernel itself on the other hand, its possible for the kernel to fail / panic / etc, so I don't plan on building any kernel packages.

Please see the OP for the 9300 modules. Hope they work! What is your full kernel version string and baseband version from "About Device" page?
4th February 2013, 10:32 PM   |  #6  
Senior Member
Thanks Meter: 27
 
124 posts
Join Date:Joined: Nov 2012
Quote:
Originally Posted by kevinf28

Kernel loadable modules are completely inert by themselves, so there is no need to worry about your phone bricking [but a backup never hurts].

If you build modules into the kernel itself on the other hand, its possible for the kernel to fail / panic / etc, so I don't plan on building any kernel packages.

Please see the OP for the 9300 modules. Hope they work! What is your full kernel version string and baseband version from "About Device" page?

It's giving a ' no such file or directory' error - even though the files are there and I'm running insmod from the dir as su. See terminal screen shot. thanks for the help!
Attached Thumbnails
Click image for larger version

Name:	13-02-04-09-43-45.jpg
Views:	1759
Size:	61.5 KB
ID:	1703848   Click image for larger version

Name:	Screenshot_2013-02-04-21-27-481.jpg
Views:	1623
Size:	82.2 KB
ID:	1703910  
Last edited by gingerneil; 4th February 2013 at 11:08 PM.
5th February 2013, 01:50 PM   |  #7  
OP Member
Thanks Meter: 27
 
95 posts
Join Date:Joined: Oct 2012
More
Re: [Driver] Asix AX88772 kernel module
I updated the OP with insmod errors

It does look like GT-I9300_JB_Opensource_Update7.zip JB 4.1.2 matches your I9300XXELLA baseband version.

http://www.androidgalaxys.net/news-g...android-4-1-2/
http://www.androidgalaxys.net/approf...ovo-controllo/
Last edited by kevinf28; 5th February 2013 at 02:04 PM.
5th February 2013, 05:25 PM   |  #8  
Senior Member
Thanks Meter: 27
 
124 posts
Join Date:Joined: Nov 2012
Quote:
Originally Posted by kevinf28

I updated the OP with insmod errors

It does look like GT-I9300_JB_Opensource_Update7.zip JB 4.1.2 matches your I9300XXELLA baseband version.

http://www.androidgalaxys.net/news-g...android-4-1-2/
http://www.androidgalaxys.net/approf...ovo-controllo/

Thanks - so it looks like I have some module dependancy issues. I'll take a look at dmesg and see whats going on. Seems strange though, if the zip does match everything...
Maybe I should go back to a stock ROM as I am currently running a de-odexed stock.
5th February 2013, 06:09 PM   |  #9  
OP Member
Thanks Meter: 27
 
95 posts
Join Date:Joined: Oct 2012
More
Quote:
Originally Posted by gingerneil

Thanks - so it looks like I have some module dependancy issues. I'll take a look at dmesg and see whats going on. Seems strange though, if the zip does match everything...
Maybe I should go back to a stock ROM as I am currently running a de-odexed stock.

It may be something trival, perhaps there is a third module you need for the international version.. I can't load your modules to test them, I get the exec format error :P. In regular linux, ldd is an amazing tool to list all the module deps, but unfortunately, it doesn't work for ARM, and arm-eabi-ldd does not exist in my toolchain.

[Edit: I have edited the OP, I rebuilt the modules and they do have some binary differences... give them a try as well]
Last edited by kevinf28; 5th February 2013 at 07:54 PM.
6th February 2013, 05:40 AM   |  #10  
CZ Eddie's Avatar
Senior Member
Flag Austin, TX
Thanks Meter: 1,093
 
3,766 posts
Join Date:Joined: Sep 2011
Donate to Me
Just curious... what are you using the USB-LAN adapter for with the USB-OTG?

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes