Sunday, March 31, 2013

Adding 3G Dongle support to your Android Tablet


                I bought a new tablet (swipe 3d tab) having heard of 3g dongle support. I already have a 3g dongle ZTE MF631 unlocked. Tried plugging the dongle via OTG, but didn't work. Then i googled for hours and made it supported.
                Most of the tablets are made in-expensive by giving external 3g dongle support. But these devices support only a few limited dongles by default. What if you have a tablet with external dongle support but not working, here is the solution.

Note: Assuming your tablet have OTG support, root unlocked (Most of the tablets are root unlocked by default, connecting usb to computer and connecting via command adb, you will get root shell by "adb shell" command) .

Things you need
==============

1). Linux (If you are using windows, try using Linux, sorry i hate windows & will be explaining in Linux terms).
2). Adb tools
3). Tablet with super-user support.
4). 3g dongle

Steps:

1). Add device details in 3g_dongle.cfg configuration file (cfg file will be in /system/etc or /etc folder).

Pull this file from computer by (By connecting tablet to pc via usb):
    adb pull /system/etc/3g_dongle.cfg
  
( If you cant see your android device run "sudo adb kill-server" ,followed by "sudo adb start-server". )

The config template is as below:-

[device]
dongle_name=
production_name=
vendor_name=
network_type=GSM_MODE
pid_vid_origin=
bcdDevice_origin=
pid_vid_now=
bcdDevice_now=
at_port=
ppp_port=

a) fill names as you like, for eg:-

[MF631]
dongle_name=MF631
production_name=MF631
vendor_name=ZTE_HSPUA
network_type=GSM_MODE

b) next you need to find the hardware vendor and product id. Connect your dongle to pc. Then type command "usb-devices" or "lsusb -vv".

usb-device output:-

T:  Bus=02 Lev=02 Prnt=02 Port=02 Cnt=03 Dev#= 31 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=2003 Rev=00.00
S:  Manufacturer=ZTE,Incorporated
S:  Product=ZTE WCDMA Technologies MSM
S:  SerialNumber=MF6310ZTED010000   


From the output ,we can get vendor id as "19d2" and product id as "2003" and usb-version as "2.00"

or lsusb --vv output:-

Bus 002 Device 031: ID 19d2:2003 ZTE WCDMA Technologies MSM 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x19d2 ZTE WCDMA Technologies MSM
  idProduct          0x2003 
  bcdDevice            0.00

So you got all details, fill these.
"pid_vid as 0x<vendor id><prod id> "
"bcdDevice as 0x0<usb version>" as follows :-

Add these in cfg file:

pid_vid_origin=0x19d22003
bcdDevice_origin=0x0200
pid_vid_now=0x19d22003
bcdDevice_now=0x0200

c) Next you need to find the AT port and PPP port:-
  • Getting to know which port is AT,  Issue the following command to each of your ports separately by replugging your device each time you change the port to which you issue the command.
        # busybox tr -s "\n" < /dev/ttyUSBx    - Do this in terminal window 1

        # echo -e "ATi\r" > /dev/ttyUSBx        - Do this in another terminal window 2
        # echo -e "AT+CGDCONT=1,\"IP\",\"<type your apn here>\"\r" > /dev/ttyUSBx
        # echo -e "ATDT*991#\r" > /dev/ttyUSBx
  • The replies to each of the above commands in terminal window 1, if x is an AT port, must be the following in the order:
        OK
        OK
  • For a PPPD port x, the replies will be:
        OK
        OK
        CONNECT 72000000
  • If you get CONNECT for two ports, then you can use either one as AT port and the other as PPPD port.
  • Now, based on your findings, fill your 3g_dongle.cfg file completely as shown below:
[MF631]
dongle_name=MF631
production_name=MF631
vendor_name=ZTE_HSPUA
network_type=GSM_MODE
pid_vid_origin=0x19d22003
bcdDevice_origin=0x0200
pid_vid_now=0x19d22003
bcdDevice_now=0x0200
at_port=1
ppp_port=3

Push  back the cfg file into tablet :-

  adb push 3g_dongle.cfg /system/etc/

               Now you are almost done. try plugging the dongle to tablet. Check apns are displayed in settings>>more>>Mobile Network>> APN.

If you can see apn displayed then your device is detected. Most of the dongle have USB storage/USB Cdrom storage. When you connect dongle, device will activated as usb storage device, some devices automatically switch from USB_storage mode to USB_Modem after few seconds, some don't. If your dongle is not connecting to internet you need to switch it manually using usb_modeswitch command in yout tablet either using usb connect to pc or by a terminal emulator.

For that you need  add another configuration file,
usb_modeswitch.conf in / folder or anywhere you can easily access.
                              
# Configuration for the usb_modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
# This file is evaluated by the wrapper script "usb_modeswitch_dispatcher"
# in /usr/sbin
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"

# Disable automatic mode switching globally (e.g. to access the original
# install storage)

DisableSwitching=0

# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>"

EnableLogging=0 

If you added config file in / folder, from there run usb_modeswitch command as follows(Assuming you have usb_modeswitch command available):

usb_modeswitch -I -W -c usb_modeswitch.conf
  
You are done, you will be connected to internet successfully.

Referred source: configure-funbook-to-use-any-dongle

No comments:

Post a Comment