USB 3G MODEM through usb USB OTG cable?

zerox981

Member
Feb 27, 2012
23
2
0
Actually, somebody mentioned Modding option.c to recognize the dongles. I haven't looked at the source but if anybody has input on this I'm all ears. Also, I'd be happy to add these resources to the overlay. Keeping in mind, the whole purpose of the overlay was to assist in hardware development and feature implementation. Seems to me this dongle work fits right in.
Maybe it was me. I suggested adding the K4605 to the option.c
I found this at the time I was struggling with my dongle http://www.gossamer-threads.com/lists/linux/kernel/1435727 .
It's also in the latest source http://git.kernel.org/?p=linux/kern...d;hb=9334c4c16e6fa80dc55865897337b49c1753f33b

If you patch it I'd be glad to test the new option.ko .

And also it would be great if the development overlay would have the chat (chat-ril?) binary /system/xbin/chat (I use the one in my zip for now - found it somewhere on xda I think) .

---------- Post added at 04:33 PM ---------- Previous post was at 04:20 PM ----------

I also found this https://github.com/DerArtem/huaweigeneric-ril
in the folio thread (http://forum.xda-developers.com/showthread.php?t=914350).

I don't know if I understand this correctly but it makes the android device use the 3g dongle as it was a built in modem?
 

bigrushdog

Inactive Recognized Developer
Apr 23, 2007
3,547
7,244
263
Maybe it was me. I suggested adding the K4605 to the option.c
I found this at the time I was struggling with my dongle http://www.gossamer-threads.com/lists/linux/kernel/1435727 .
It's also in the latest source http://git.kernel.org/?p=linux/kern...d;hb=9334c4c16e6fa80dc55865897337b49c1753f33b

If you patch it I'd be glad to test the new option.ko .

And also it would be great if the development overlay would have the chat (chat-ril?) binary /system/xbin/chat (I use the one in my zip for now - found it somewhere on xda I think) .
Ok nice. That version has a huge vendor list. Maybe we can make a list of devices that need adding with appropriate codes. Ya I grabbed your zip and ill throw those binaries in. Also on the overlay I added /data/local/bin to $PATH. Think I forgot to mention that. And I've of course got Linus on remote so easy merge there.

Edit: I can build that binary. I'd have to look over the source to see what's going on with it.
Edit 2; I looked over the update.zip in that thread. It appears he has devised a more sophisticated solution. It would take time time to analyze it and see what's all going on. For now ill update options.c and throw in those bins. But ill keep an eye on this as this work ties in with some other related work I got going.
 
Last edited:

cyccyo70

New member
Apr 22, 2012
1
0
0
updates

Hi all,

any updates?
Is there a way to use 3G modem in a more simple steps?
I'm a noob so I don't understands lots of things like:
"flash the overlay.zip files" that for me could means:
1) put the zip in your sdcard
2) go in recovery
3) install the zip in that way

Is there a new script or code more simply?
My friend that have the Ainol Aurora simply connect the USB dongle and then they are able to use it.

Thanks,
Regards,
Cy
 

indira19

Member
Aug 20, 2012
17
0
0
This is the way I get my dongle (Vodafone K4605) working with the latest TeamEOS nightly wingray (84 atm :)).

Tools I use:
WinSCP - http://winscp.net/eng/index.php
SSHdroid - https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&hl=en
putty - http://www.chiark.greenend.org.uk/~sgtatham/putty/

1) Download the latest development overlay from this thread:
http://forum.xda-developers.com/showthread.php?t=1513490

2) Delete the drivers you don't need from the zip file. (xoom_dev_overlay_v4.zip\data\local\lib\modules\).
For my needs it's enough to keep only the option.ko and usb_wwan.ko.

3) Flash the dev. overlay.

4) Install pppd, usb_modeswitch and chat binary
Now you need to install pppd, usbmodeswitch and the chat binary the kernel is missing. You can google them or use my 3gdongle.zip file with my configs:).
Run sshdroid so you can ssh to your android device (or use adb shell etc.).
Connect to your andrid device with putty.
Then run
Code:
sysrw
so you can write to your system folder.
Copy the contents of the zip file in the root folder using WinSCP.
Add the execute permission on
/system/xbin/chat
/system/xbin/usb_modeswitch
/system/bin/pppd
/system/etc/ppp/ip-up
/system/etc/ppp/ip-down
(using WinSCP or with chattr via ssh)

5) Plug the dongle to your windows machine & using Vodafone windows application disable pin authentication. (You can let it enabled but you have to modify the gprs-connect-chat i guess).

6) Disable the CD-ROM mode (I think it's not required because we are using usb_modeswitch, but i did it a long time ago and I'm too lazy to enable it back:D).
Under Control Panel->Phone and Modem look in the Modems tab. There should be the COM port written in the "Attached To" column.
Using putty & connection type serial connect to your modem and disable the CD-ROM mode using the command
Code:
AT^SETPORT="A1;1,2,3"
You can also check if your modem is responding with the AT command (it should write back OK).
Using te ATI command you should get the modem information back.
ex:
Code:
Manufacturer: Vodafone (Huawei)
Model: K4605
Revision: 11.113.21.00.11
IMEI: 353148040378952
+GCAP: +CGSM,+DS,+ES

OK
7) Plug the modem into your android device. You can check if the necessary moodules are loaded with lsmod:
Code:
sh-4.1# lsmod
option 13380 0 - Live 0xbf016000
usb_wwan 8789 1 option, Live 0xbf00d000
8) Check the dmesg or use lsusb to get your devices vendor and product id
dmesg>
Code:
[ 1903.631599] usb 2-1: new high speed USB device number 3 using tegra-ehci
[ 1903.689362] usb 2-1: New USB device found, idVendor=12d1, idProduct=14c1
[ 1903.689606] usb 2-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 1903.689739] usb 2-1: Product: Vodafone Mobile Broadband (Huawei)
[ 1903.689970] usb 2-1: Manufacturer: Vodafone Group (Huawei)
[ 1903.695541] scsi1 : usb-storage 2-1:1.0
[ 1904.701649] scsi 1:0:0:0: CD-ROM            Vodafone CD ROM (Huawei)  2.31 PQ: 0 ANSI: 2
lsusb>
Code:
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Bus 002 Device 003: ID 12d1:14c1
9) Switch usb mode using usb_modeswitch and the config file for your device. In my case it's 12d1:14c1.
Code:
usb_modeswitch  -c /etc/usb_modeswitch.d/12d1_14c1
If the switch was succsessful you should see the correct productid now (in my case 14c6):
Code:
sh-4.1# lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Bus 002 Device 005: ID 12d1:14c6
10) optional - K4605 or other unrecognized devices
After the modeswitch you should see your device under /dev/ttyUSB*. But with the K4605 we don't because option.ko doesn't know our device. So we need to call
Code:
echo "12d1 14c6" >/sys/bus/usb/drivers/option/module/drivers/usb-serial:option1/new_id
and our device appears:).

11) check if modem is responding:
Code:
cat /dev/ttyUSB0 & echo AT > /dev/ttyUSB0
You should get an OK.

12) Set the config files. If you installed my 3gdongle.zip file you will find my config files under /system/etc/ppp .
You have to edit the gprs-connect-chat file and the peers/gprs file.
I will not go into detail about this config files. There is a lot of information about it on xda forums and google should be your best friend too ;).

bonus) I use this scripts to enable and disable internet via my 3G dongle using the scriptmanager app (https://play.google.com/store/apps/details?id=os.tools.scriptmanager&hl=en)

01_init3g.sh - Run it after plugging the 3g dongle to your android device (k4605 specific)
Code:
# My modem Vodafone K4605 is unknown to option.ko so we manually add it
# you can delete this line if your modem is recognized by option.ko
echo "12d1 14c6" >/sys/bus/usb/drivers/option/module/drivers/usb-serial:option1/new_id
# switch modes with usb_modeswitch
usb_modeswitch  -c /etc/usb_modeswitch.d/12d1_14c1
02_connect via 3g.sh - Connect to the internet (you have to wait 10-20sec after using init because the modem has to initialize first)
Code:
#!/system/bin/sh
#save old route & primary dns
OLDROUTE=`/system/xbin/netstat -r | /system/xbin/grep default | /system/xbin/awk '{print $2}' | /system/xbin/head -n1`
OLDDNS=`/system/bin/getprop net.dns1` 
/system/xbin/echo $OLDROUTE > /data/ppp/ppp0.route;
/system/xbin/echo $OLDDNS >> /data/ppp/ppp0.route;
# just some logging for debugging. Can be removed :)
/system/bin/log -pw -t zeroxPPPD "OldRoute: $OLDROUTE"
/system/bin/log -pw -t zeroxPPPD "OldDNS: $OLDDNS"

#connect to the internet
pppd call gprs
03_restore wlan.sh - Disconnect the 3g dongle & restore WLAN
Code:
#!/system/bin/sh
# restore the old route & primary dns (you can extend the script to add the secondary dns..
OLDROUTE=`cat /data/ppp/ppp0.route | head -n1`
OLDDNS=`cat /data/ppp/ppp0.route | tail -n1`

/system/bin/setprop "net.dns1" "$OLDDNS"
/system/xbin/route add default gw $OLDROUTE dev wlan0

# delete the settings file
/system/xbin/rm /data/ppp/ppp*.route
sorry for an off topic post....any help how to get the 3g dongle work on a galaxy tab 10.1 wifi only...all my requests went in vain , i found that on acer and xoom many have developed it. then it must be possible that on galaxy tab it should be able to work....can u compile the required files and let me know how should i go about it. i am completely noob to this but would want to try it, i am rooted and on a custom ICS ROM
any any help even i am ready to try on my tab if u can give a "solution like"....please and thanks in advance