Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
trevd
Old
(Last edited by trevd; 28th March 2013 at 01:14 AM.)
#1  
Recognized Developer - OP
Thanks Meter 820
Posts: 744
Join Date: Jul 2011
Location: Hull

 
DONATE TO ME
Default [DEV] 3G Dongles - Huawei/ZTE GSM & CDMA

Hi Folks

[B][UPDATE]This is not the only way of getting Dongle's working on the N7, If widgets are your thing and you don't feel confident working with system files etc then you may be better served using the ppp widget form draisberghof.de, these are the folks who piratically wrote the book on getting dongles working on linux and by extension android and members have reported success using it. See this thread [Nexus7 UMTS-Stick extern working] in the general section for the initial find.

[UPDATE]This mod has seen success on ZTE Dongles ( Thanks To NexusPhreak ) See the supported devices list in the second post for a list of the latest tested devices

[UPDATE]It turns out this mod is good for CDMA Dongles as well as GSM - It needs a slight tweak. See this post [ Post #76 ] for details ( Thanks to mailbinoy )[UPDATE]

IMPORTANT: THIS IS A WIP AND NOT READY FOR PRIME TIME - IF YOU HAVE NEVER USED FASTBOOT, ADB, DON'T UNDERSTAND THE FIRST THING ABOUT NETWORKING OR HAVE NEVER SEEN A BASH PROMPT THEN THIS IS PROBABLY NOT FOR YOU

TROUBLESHOOTING: IF YOU ARE HAVING PROBLEMS PLEASE READ THE TROUBLESHOOTING SECTION IN THE SECOND POST - THE MORE INFORMATION YOU CAN PROVIDE THE BETTER AS THIS HELPS GET TO THE ROOT OF THE PROBLEM - THIS INCLUDES MODEL NUMBER OF THE DONGLE, LOGCAT LOGS AND DMESG OUTPUT.


DOUBLY IMPORTANT: PLEASE READ THE FIRST AND SECOND POST TO GET AN UNDERSTANDING OF WHAT WORK HAS BEEN DONE AND HOW THIS FUNCTIONALITY IS IMPLEMENTED

Okay I've seen a lot a thread asking whether using 3G Dongles ( Huawei in particular ) is possible with the nexus 7........ The Answer........ "Of course it is!!!11!! it's Android/Linux Kernel, If we can dream it we can code it! "

I've been working on getting the full connectivity going but so far I've managed to bring up a raw ppp connection which is good for all things google (play, web browsing, gmail ) as the google apps still aren't playing fair with the connectivity manager and they just scoot around that and use web sockets instead!

Normally to enable this functionality we need to compile the usb_wwan.ko and option.ko as kernel module, much to my surprise google/asus have built these in already so we can just usb_modeswitch into modem mode and init our ppp connection. Winner!

STAGE 1 PPP Connections

My test modems where Huawei E173s-1 and E1752Cu and the build I used is my own AOSP 4.1.1 with a kernel version of 3.1.10-g52027f9

Steps to 3G Fun

1. Do a full back up
2. Flash this boot.img through fastboot
3. Download This file ( nexus7-3g.7z ) See post 2 for link
4. unzip the file and adb push to correct directories
5. Turn off Wifi
6. Plug in Dongle
7. Restart
8. In Terminal Emulator of similar run
Code:
su 
/system/etc/init_pppd_gprs
If all has worked then your dongle should now be connected!

Detailed Explanation ( Or Why The Hell Am I Doing This? ):

Why The New Boot.img?
The boot image adds service called hotplugd and service called switch_ms_to_3g which handles the usb_modeswitching
The code for hotplugd is here ( github ). if you don't want to flash the new boot image you can always run usb_modeswitch manually pointing to the config file and specifying your vendor id and product id if you do not wish to run hotplugd

Why turn Wifi Off?
We turn wifi off first because otherwise the ppp connection doesn't get assigned properly if wifi is turned off after the event.

Why The Restart?
On My USB OTG cable at least it doesn't seem to get power if I plug it in after power up YMMV.

STAGE 2 - FULL CONNECTIVITY

Obviously the Stage 1 is good. But It's not Great and we can do better. Using a similiar Wifi Only Device as my frame of reference, ( the Motorola Xoom Wifi ) to bring full connectivity ( i.e Mobile Networks Option in the settings and The Signal Icon in the Menu Bar) to the device required modification of the framework-res to allow mobile networks, you can either modify the existing one on the device or if building from source you can modify the config.xml found in the device overlay in the aosp ( device/asus/grouper/overlay/frameworks/base/core/res/res/values/config.xml )
something along the lines of

Code:
<resources>
   <string-array translatable="false" name="networkAttributes">
        <item>"wifi,1,1,0,-1,true"</item>
        <item>"mobile,0,0,1,-1,true"</item>
        <item>"mobile_mms,2,0,2,60000,true"</item>
        <item>"mobile_supl,3,0,2,60000,true"</item>
        <item>"mobile_dun,4,0,5,60000,true"</item>
        <item>"mobile_hipri,5,0,3,60000,true"</item>
        <item>"bluetooth,7,7,0,-1,true"</item>
        <item>"ethernet,9,9,9,-1,true"</item>
        <item>"mobile_fota,10,0,2,60000,true"</item>
        <item>"mobile_ims,11,0,2,-1,true"</item>
        <item>"mobile_cbs,12,0,2,60000,true"</item>
        <item>"wifi_p2p,13,1,0,-1,true"</item>
    </string-array>
    <string-array translatable="false" name="radioAttributes">
        <item>"9,1"</item>
        <item>"1,1"</item>
        <item>"0,1"</item>
        <item>"7,1"</item>
    </string-array>
</resources>
NOTE: I've not really took the time to fully understand these settings and I've basically Kang'd them from another overlay.
As such they maybe suboptimal. Any further tweaks Improvements or general insight is more than welcome.

This seems to build okay and gives me the above mentioned features,I also set the build.prop default network to
GSM:
Code:
ro.telephony.default_network=3
CDMA:
Code:
ro.telephony.default_network=4
NOTE: Full CDMA Support require more than just this. There are a number of other build properties which affected and I'm currently working out which are the best ones to use.



and added the following files
Code:
/system/bin/rild
/system/lib/libhuaweigeneric-ril.so
/system/etc/permissions/android.hardware.telephony.gsm.xml
/system/etc/permissions/android.hardware.telephony.cdma.xml
I would expect this work and give me full connectivity on the device however it seems to "bork" when trying to load the vendor specific ril , I suspect I may be missing a permission or something similar

PROBLEMS - TROUBLE SHOOTING
If you're having problems, first I would Install busybox which will give you lsusb, this will tell you if your modem is actually recognized.
You can also run netcfg which will tell you if the network interface name ppp1 has been created and is up, then grab dmesg and a logcat, so something like this on adb will give you a good idea of what's going on.
Code:
adb shell netcfg
adb shell lsusb
adb shell dmesg
adb logcat -b main -b system -b events -b radio
* Note if you are running logcat through terminal emulator please run it with superuser permissions
Code:
su -c "logcat -b main -b system -b events -b radio"
Happy Hacking People and Good Luck!

References:
DerArtem Original Work with Huawei Dongles on the Toshiba Folio 100
usb_modeswitch official website
3g-modem.wetpaint.com A great source of information regarding 3G Dongles
Android Device Porting Walkthrough - Android Builder Summit 2012 ( An excellent presentation on device porting )
Don't forget to click Thanks If this post has helped. It gives me a little warm feeling inside

I WILL NOT RESPOND TO PM'S REQUESTING TECHNICAL SUPPORT


Development Work: Git Hub (https://github.com/trevd) | Huawei Dongle Support : Archos G9 , Asus Nexus 7 | adb extended version ( adbx ) [Always WIP] | The No Script, No Cygwin Standalone Boot Image Utility [WIP]
Other Work : Custom framework-res.apk resources.arsc using vendor overlays | [GUIDE][HACK]Cross Compiling for OSX on Linux with AOSP

A bug report without logs is just trivia!

Code:
adb shell dmesg ; adb logcat -b system -b radio -b events -b main
The Following 56 Users Say Thank You to trevd For This Useful Post: [ Click to Expand ]
 
trevd
Old
(Last edited by trevd; 19th January 2013 at 10:48 AM.)
#2  
Recognized Developer - OP
Thanks Meter 820
Posts: 744
Join Date: Jul 2011
Location: Hull

 
DONATE TO ME
Hi Folks.

[DISCLAIMER]YOU KNOW THE DRILL.... RESPONSIBILITY FOR DAMAGE, INCURRED COST THROUGH EXCESSIVE DATA USAGE ETC IS NOTHING TO DO WITH ME.[DISCLAIMER]

VITAL : THIS IS STILL A WIP - THERE IS A GOOD CHANCE THAT I'VE DONE SOMETHING WRONG, COPIED A FILE TO THE WRONG DIRECTORY OR SIMPLY MISSED SOMETHING OUT, PLEASE THINK ABOUT WHAT YOU ARE DOING BEFORE BLINDLY FOLLOWING THE INSTRUCTIONS OF SOME MANIAC ON THE INTERNET

Right on with the fun!

I haven't had much time to look at this as it wasn't top of my list, However the good news is I now have full 3g connectivity on the nexus 7 using Huawei 3G Dongles.

The issue turned out to be incorrect permissions on the /dev/ttyUSB* devices nodes which are created by the Huawei Modems, this was fixed by adding the following line to uevent.grouper.rc in the boot.img,
Code:
/dev/ttyUSB*              0660   root       radio
simple when you know how!

I've attached a zip file which contains the files needed to enable this. It is a manual installation at present although I plan to make this flashable through recovery at some point but would really like to leave any other modification you may have made in tact. I.e TabletUI etc

The Changes where made to the Stock Factory Image JRO03D with Kernel 3.1.10-g52027f9

I've included the stock Mms app and enabled both voice and sms capability in the framework-res.apk. I left out the Phone.apk as you can only make silent calls because of the lack of Audio Rooting ( A possible future project perhaps ). I also changed the Data Usage to monitor the connection used by the dongle which allows you to impose data limits on your bandwidth ( see screenshots ).

Upon applying this update you should have mobile networks available in "settings/more networks" and the signal strength icon should appear in your status bar

Download the file here ( hotfile )
Please follow the readme in the archive for installation instructions and take note of the notes!
In addition to the steps in the readme, It's worth making sure that everything that needs to be executable still is.

Code:
adb shell chmod 6755 /system/bin/pppd
adb shell chmod 755 /system/xbin/chat
adb shell chmod 755 /system/bin/usb_modeswitch
adb shell chmod 755 /system/bin/rild
adb shell chmod 755 /system/bin/hotplugd
adb shell chmod 755 /system/etc/ppp/init_pppd_gprs
adb shell chmod 755 /system/etc/ppp/ip-up-gprs
adb shell chmod 755 /system/etc/ppp/ip-down-gprs
SUPPORTED DEVICES
The theoretical list of supported devices come from those Huawei devices which are supported by the GSM Modem driver in 3.1.10 kernel.
my testing was on a E1752Cu, E173s-1 and the E1750

Confirmed Devices
Huawei
E1750
E1752Cu
E173s-1
E173-u2 ( Thanks to m3ritum ) Video
E367 ( Thanks to mynamesriz )
E3131s-2 GSM/HSPA+ ( Thanks to radkor )
EC156 CDMA with a couple of tweaks see this post [ Post #76 ] ( Thanks to mailbinoy )
E160E (Thanks to Dragon0501 )

ZTE
MF190J**
MF190**
MF636**
MF626**

** Thanks To NexusPhreak




TROUBLESHOOTING

There are 2 main ways your connection attempt can fail.
1. The UsbStick has not switched to modem mode
2. The ppp connection script failed

Either Way it would be highly useful post the list of system properties, outputs of dmesg and also a full logcat aswell as the vendor/product id from lsusb,
some like this throught the adb
Code:
adb shell getprop
adb shell lsusb
adb shell dmesg
adb logcat -b radio -b system -b main -b events
* Note if you are running logcat through terminal emulator please run it with superuser permissions
Code:
su -c "logcat -b main -b system -b events -b radio"
Attached Thumbnails
Click image for larger version

Name:	about_tablet.jpg
Views:	6612
Size:	21.0 KB
ID:	1245486   Click image for larger version

Name:	about_tablet_e1752.jpg
Views:	5864
Size:	20.9 KB
ID:	1245487   Click image for larger version

Name:	about_tablet_status.jpg
Views:	5618
Size:	16.8 KB
ID:	1245488   Click image for larger version

Name:	apn.jpg
Views:	5310
Size:	11.2 KB
ID:	1245489   Click image for larger version

Name:	data_usage.jpg
Views:	5727
Size:	29.6 KB
ID:	1245490  

Click image for larger version

Name:	mobile_network_settings.jpg
Views:	4976
Size:	18.4 KB
ID:	1245491   Click image for larger version

Name:	networks.jpg
Views:	4980
Size:	14.5 KB
ID:	1245492  
Don't forget to click Thanks If this post has helped. It gives me a little warm feeling inside

I WILL NOT RESPOND TO PM'S REQUESTING TECHNICAL SUPPORT


Development Work: Git Hub (https://github.com/trevd) | Huawei Dongle Support : Archos G9 , Asus Nexus 7 | adb extended version ( adbx ) [Always WIP] | The No Script, No Cygwin Standalone Boot Image Utility [WIP]
Other Work : Custom framework-res.apk resources.arsc using vendor overlays | [GUIDE][HACK]Cross Compiling for OSX on Linux with AOSP

A bug report without logs is just trivia!

Code:
adb shell dmesg ; adb logcat -b system -b radio -b events -b main
The Following 15 Users Say Thank You to trevd For This Useful Post: [ Click to Expand ]
 
trevd
Old
#3  
Recognized Developer - OP
Thanks Meter 820
Posts: 744
Join Date: Jul 2011
Location: Hull

 
DONATE TO ME
RESERVED
Don't forget to click Thanks If this post has helped. It gives me a little warm feeling inside

I WILL NOT RESPOND TO PM'S REQUESTING TECHNICAL SUPPORT


Development Work: Git Hub (https://github.com/trevd) | Huawei Dongle Support : Archos G9 , Asus Nexus 7 | adb extended version ( adbx ) [Always WIP] | The No Script, No Cygwin Standalone Boot Image Utility [WIP]
Other Work : Custom framework-res.apk resources.arsc using vendor overlays | [GUIDE][HACK]Cross Compiling for OSX on Linux with AOSP

A bug report without logs is just trivia!

Code:
adb shell dmesg ; adb logcat -b system -b radio -b events -b main
The Following 3 Users Say Thank You to trevd For This Useful Post: [ Click to Expand ]
 
Pond-life
Old
#4  
Junior Member
Thanks Meter 2
Posts: 14
Join Date: Apr 2011
All sounds very cool, nice one.
 
azoller1
Old
#5  
azoller1's Avatar
Senior Member
Thanks Meter 999
Posts: 1,483
Join Date: Aug 2011
Location: Lenexa
looks very promising, do you know if there are any CDMA dongles for 4G phones on Verizon?
DONT FORGET TO PRESS THE THANKS BUTTON!!

Device: LG Spectrum 16GB 4G
Rom: Running My Own Icy Fusion ROM
Kernel: Running Ortriggers Kernel

Device: Nexus 7 16GB
Rom: Running My Own Xylon Fusion ROM
Kernel: Running Imoseyon LeanKernel

MY DEV
GOO.IM FILES/FOLDERS
DEV-HOST FILES/FOLDERS

G+ COMMUNITY GOOGLE+ TWITTER FOLLOW
 
emarietta
Old
#6  
Senior Member
Thanks Meter 98
Posts: 461
Join Date: Oct 2010
Location: central ohio
Is there a better explanation of how this works ? Would we have to have a data plan to use this or is it just picking up 3g?

Sent from my Nexus 7 using Tapatalk 2
 
trevd
Old
(Last edited by trevd; 13th August 2012 at 03:58 PM.)
#7  
Recognized Developer - OP
Thanks Meter 820
Posts: 744
Join Date: Jul 2011
Location: Hull

 
DONATE TO ME
Quote:
Originally Posted by azoller1
looks very promising, do you know if there are any CDMA dongles for 4G phones on Verizon?
Not a clue, I'm not in the US and don't really have an understanding of the US celluar network. I'm unsure whether this implementation of the ril library ( the part that talks to android ) can handle CDMA as I've only got GSM dongles to test with.


Quote:
Originally Posted by emarietta View Post
Is there a better explanation of how this works ? Would we have to have a data plan to use this or is it just picking up 3g?
Sent from my Nexus 7 using Tapatalk 2
Hi

This is using Huawei 3G Dongles ( sometime called mobile broadband ) which were quite popular in the UK and Europe, Something along the lines of this ( linked picked at random ) they normally come with their own sim card, and by extension a data plan, generally on a pay-and-go basis.They are effectively a fast "dialup modem" ( by UK Standards anyway )

The modems are generally carrier branded / locked and are restricted to data and sms only. However the carrier restriction can be removed and voice support can be added via firmware updates if the hardware allows.

My carrier ( 3-UK ), picked this up as tethering when I used my Phone SimCard for testing and as such It is not a method around tethering restrictions your operator may have in place.

I hope the helps shed some light on the topic.
Don't forget to click Thanks If this post has helped. It gives me a little warm feeling inside

I WILL NOT RESPOND TO PM'S REQUESTING TECHNICAL SUPPORT


Development Work: Git Hub (https://github.com/trevd) | Huawei Dongle Support : Archos G9 , Asus Nexus 7 | adb extended version ( adbx ) [Always WIP] | The No Script, No Cygwin Standalone Boot Image Utility [WIP]
Other Work : Custom framework-res.apk resources.arsc using vendor overlays | [GUIDE][HACK]Cross Compiling for OSX on Linux with AOSP

A bug report without logs is just trivia!

Code:
adb shell dmesg ; adb logcat -b system -b radio -b events -b main
The Following 2 Users Say Thank You to trevd For This Useful Post: [ Click to Expand ]
 
DroidHam
Old
#8  
DroidHam's Avatar
Senior Member
Thanks Meter 148
Posts: 2,134
Join Date: Aug 2010
Location: Akron, OH
cool idea, ill just use my 4g tether though
The Following User Says Thank You to DroidHam For This Useful Post: [ Click to Expand ]
 
lovleshgarg
Old
#9  
Senior Member
Thanks Meter 38
Posts: 132
Join Date: Jul 2010
Great work mate!!! Just one question:
I will be getting my Nexus 7 in a couple of days and I already own a HP TouchPad running CM9. I want to know can I tether my dongle's internet on my nexus 7 with the HP Touchpad via Wifi or bluetooth?
 
trevd
Old
#10  
Recognized Developer - OP
Thanks Meter 820
Posts: 744
Join Date: Jul 2011
Location: Hull

 
DONATE TO ME
Quote:
Originally Posted by lovleshgarg View Post
Great work mate!!! Just one question:
I will be getting my Nexus 7 in a couple of days and I already own a HP TouchPad running CM9. I want to know can I tether my dongle's internet on my nexus 7 with the HP Touchpad via Wifi or bluetooth?
That's a dam fine question . The word FrankenConnection instantly sprung to mind I haven't got the tablet in front of me at the moment and off the top of my head I'd say probably not by default.

However, It wouldn't be too difficult to enable on a technical level, it's all about your ip routing tables, they are probably numerous apps on play to do it, although personally i've a little no success with then. Cyanogenmod has it built into to the rom, at least on CM9 on my Sensation and that works a treat. I will have a proper look as It could be crazy enough to work!.
Don't forget to click Thanks If this post has helped. It gives me a little warm feeling inside

I WILL NOT RESPOND TO PM'S REQUESTING TECHNICAL SUPPORT


Development Work: Git Hub (https://github.com/trevd) | Huawei Dongle Support : Archos G9 , Asus Nexus 7 | adb extended version ( adbx ) [Always WIP] | The No Script, No Cygwin Standalone Boot Image Utility [WIP]
Other Work : Custom framework-res.apk resources.arsc using vendor overlays | [GUIDE][HACK]Cross Compiling for OSX on Linux with AOSP

A bug report without logs is just trivia!

Code:
adb shell dmesg ; adb logcat -b system -b radio -b events -b main

The Following User Says Thank You to trevd For This Useful Post: [ Click to Expand ]
 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...