Sunteți pe pagina 1din 13

MOD/HOW-TO] (UPD: 0.4.1) USB 3G modem and RNDIS tethering for urukdroid 0.7/0.

After experimenting for a while, I've managed to successfully use USB 3G dongle, and to connect my Archos 101IT, running uruk-droid 0.4.1, to the Internet over 3G data network. Test was made with two different 3G USB dongles - Huawei E1552 and ZTE MF190. First of all a big thanks to $aur0n for uruk-droid, because without uruk-droid kernel with adequate configuration, this 3G support would not be possible. Second, a big thanks to all guys behind usb_modeswitch project (http://www.draisberghof.de/usb_modeswitch/), for providing us with Linux support needed to switch our 3G USB dongles from default cd-rom/mass-storage mode to usb-serial mode needed for 3G operation. Process of initial setup of 3G USB dongle to a 3G provider under Linux (and Android/Archos) is fairly complex, and requires a little Linux knowledge, but once it is configured right, usage is simple. Unfortunately I don't see a way to make it simpler, because lot of parameters in various files are greatly dependant on model of 3G USB dongle you are using, and on settings of your 3G data provider. DISCLAMER:

This is a proof-of-concept modification. Don't expect that everything will work from a first try.
Please note that I don't take responsibility for anything that might happen with your Archos device and/or your data on it. I didn't had any problems with my A101IT using this mod with Huawei E1552 3G dongle and ZTE MF190 3G dongle, but that doesn't mean that someone else won't have them. Also, if you make your 3G USB dongle work as modem using steps described here, I don't take any responsibility for possible large bills form you 3G data service

provider. Be sure that you have good and cheap 3G data plan with your 3G data service provider, if you are planning to use 3G data network for Internet connection on a daily basis. Also, try to avoid using 3G data service while in roaming, because it is very expensive. Technical explanation: Basically USB tethering system on Archos is designed to work over PPP connection, provided by /system/bin/pppd via "Serial-over-USB link", provided by cdc-acm.ko kernel module, when supported cdc-acm class device is connected to USB host port of Archos. Here is a brief description of USB tethering on Archos 101, modified to work with 3G USB dongles, since you probably going to need to edit some of this files in order to adjust them for your 3G USB dongle and your 3G provider: 1. Kernel support for 3G USB dongles. This is provided by uruk-droid kernel. One part you'll use from this support is usbserial.ko kernel module that will be loaded by /system/xbin/3Gmodem_init.sh with adequate parameters, when you start tethering. 2. usb_modeswitch program and support files usb_modeswitch is responsible for switching of 3G USB dongles from default cd-rom/massstorage mode to usb-serial mode ready for 3G operation. You'll use it via /system/xbin/3Gmodem_init.sh, when you start tethering. 3. Archos USB tethering support which is partially in Android framework, and partially in Linux scripts called by framework. This part of tethering support is most complex one, and in order for Android framework to be aware of data connection, we must disguise 3G data connection as a USB tethering:

Android framework calls modified

/system/bin/tether_start_usb.sh, which calls /usr/bin/pppd binary, responsible for data connection to your 3G data provider.

Android framework calls modified

/system/bin/tether_stop.sh, for stopping data connection to your 3G data provider. pppd uses couple of configuration files (and additional binary /usr/xbin/chat):

from '/system/etc/ppp/peers' directory, pppd uses

configuration file 'tether' (with definition of pppd options for peer it connects to - this may need editing for your 3G provider) from '/data/' directory, pppd (via /system/xbin/chat) uses 'tether_start' file as definition of <SEND> <EXPECT> pairs of commands sent to configure modem and responses received from modem, when it connects to a peer (this may need editing for your 3G provider). from '/system/etc/chatscripts/' directory, pppd (via /system/xbin/chat) uses 'tether_stop' file as definition of <SEND> <EXPECT> pairs with commands sent to modem and responses received from modem, when it disconnects from a peer. This modification relies on modified '/system/bin/tether_start_usb.sh' and '/system/bin/tether_stop.sh', to be able to correctly initialize RNDIS connection or 3G modem, load adequate kernel modules and start connection, while trying to keep compatibility with original "Archos designed" way of USB tethering. Configured adequatly ('enable' parameter to 'off' in '/etc/uruk.conf/3Gsupport' file), this modified '/system/bin/terher_start_usb.sh' WILL behave as original one. - not needed anymore - scripts auto-detect connection type and behave adequatly. For a list of changes in recent versions please se post #2 of this thread.

Tutorial how to use RNDIS USB Tethering: No configuration needed - if your phone is indeed of USB-RNDIS type - everything will be auto-

detected. Just plug your Archos to a RNDIS capable phone in tethering mode via USB cable, wait for at least 5 seconds (or more - depending on phone), and start tethering on Archos. Expample of RNDIS tethering device is HTC Desire phone with built-in USB Tethering support enabled. Android based phones from "same generation as HTC Desire" are quite probably of same USB-RDNIS type. NOTE: due to a technical reasons (bad driver), RNDIS tethering support works only if usb host mode driver (musb_hdrc.ko) is loaded in PIO (as opposed to default DMA) mode. When tethering is started, USB host mode driver is reloaded in PIO mode, so this might be indicated on the phone like USB disconnection and re-connection. This is "normal" behaviour, and for now there is nothing I can do about it. When tethering is stopped USB host mode driver is re-loaded again to DMA mode.

Tutorial how to initially configure 3G USB dongle for USB tethering: NOTE: Everything written here, should be done in Terminal Emulator or ConnectBot (connected as local) under root shell (after 'su' command)!

1.

Install Terminal Emulator, or ConnectBot from Market.

2.
This step is no longer needed if you are running UrukDroid 0.7 or later since 3G modem/RNDIS support is integrated in it Get 3Gsupport-0.4.zip from attachment in this post. Extract 3Gsupport-0.4.tar.gz file from .zip file and copy it to your Archos to /sdcard. Archive contains everything needed (usb_modeswitch binary and support files, replacement tether_start_usb.sh, replacement tether_stop.sh, 3Gmodem_init.sh script, 3Gmodem_detect.sh). NOTE: Since /system/bin/tether_start_usb.sh and /system/bin/tether_stop.sh from 3Gsupport-0.4.tar.gz will

replace original ones, please backup originals. The 3Gsupport-0.4.tar.gz file contains absolute paths for all files, and should be extracted to a root ('/' path in RootExplorer). To backup original tether_start_usb.sh and tether_stop.sh:
Code:

# su # cp /system/bin/tether_start_usb.sh /system/bin/tether_start_usb.sh.ORIGINAL # cp /system/bin/tether_stop.sh /system/bin/tether_stop.sh.ORIGINAL

Assuming you have 3GSupport-0.4.tar.gz in /sdcard you should do following in Terminal Emulator or ConnectBot to extract 3Gsupport-0.4.tar.gz:
Code:

# su # cp /sdcard/3Gsupport-0.4.tar.gz / # cd / # tar -zvxf 3Gsupport-0.4.tar.gz

3.

Start the Terminal Emulator, or ConnectBot (to Issue 'su' command in terminal window to gain root Plug dongle in usb host port (full size USB on A101IT).

localhost). access. NOTE: For A70IT you'll need something called "mini USB Type-A to USB female host cable adapter", and maybe manually loading of host-mode USB driver (musb_hdrc.ko) I dont have A70IT so I cant test.

Wait couple of seconds (at least 5) and then start 3G

modem detection script with '/system/xbin/3Gmodem_detect.sh' command. The output of the detect scripts should be pretty self-explanatory, and if your modem is supported by usb_modeswitch (in both switching and non-switching mode) you should be able to see that usb serial module is loaded and configuration file is written and support for 3G modems is started. Output should look like this:
Code:

# /system/xbin/3Gmodem_detect.sh Supported USB device found !!!! VendorID: 12d1 - ProductID: 1446 New VendorID: 12d1 New ProductID not detected in usb-modeswitch config file. Try to detect it later ! Switching device to usbserial mode ! Looking for target devices ... No devices in target mode or class found Looking for default devices ... Found devices in default mode, class or configuration (1) Accessing device 004 on bus 002 ... Getting the current device configuration ... OK, got current device configuration (1) Using endpoints 0x01 (out) and 0x81 (in) Using endpoints 0x01 (out) and 0x81 (in) Inquiring device details; driver will be detached ... Looking for active driver ... OK, driver found ("usb-storage") OK, driver "usb-storage" detached SCSI inquiry data (for identification) ------------------------Vendor String: HUAWEI Model String: Mass Storage

Revision String: 2.31 ------------------------USB description data (for identification) ------------------------Manufacturer: HUAWEI Technology Product: HUAWEI Mobile Serial No.: not provided ------------------------Setting up communication with interface 0 ... Using endpoint 0x01 for message sending ... Trying to send message 1 to endpoint 0x01 ... OK, message successfully sent Resetting response endpoint 0x81 Error resetting endpoint: -110 Resetting message endpoint 0x01 Error resetting endpoint: -19 Device is gone, skipping any further commands Checking for mode switch (max. 20 times, once per second) ... Searching for target devices ... Searching for target devices ... Found target device, now opening Found correct target device Mode switch succeeded. Bye. Detected ProductID of a switched device: 140c USB device VendorID: 12d1 ProdID: 140c. Probing serial mode usbserial.ko module registered and /dev/ttyUSB{X} device nodes created sucessfully. Writing default configuration to '/data/local.prop' file .....Done.

!!! REBOOT your A101IT now in order for your configuration to become active !!!

After reboot: 4. Disconnect your 3G USB dongle, do not connect

anything to USB host port and go to Settings->Wireless & Networks->Cellphone tethering. If there is tethering profile already defined, delete it Create new USB tethering profile. Your APN, username and password won't be detected Archos handles only one tethering profile definition at a time.

automatically, so fill them manually - find adequate info from your 3G service provider (for me on Telekom Srbija: APN is gprsinternet, username is mts, and password is 064 (some 3G operators don't need username and password)). This will create file '/data/tether_start' with adequate commands for ppp daemon to initialize 3G modem and make a connection to your 3G provider. NOTE for uruk-0.6: It '/data/tether_start' file is not created after wizard finishes try following in terminal emulator:
Code:

su chown 1000:1000 /data chmod ug+rwx /data then delete the tethering profile just created and re-create it again !!! Now everything should be OK. File should look like this:
Code:

TIMEOUT 5 ECHO ON ABORT BUSY ABORT ERROR ABORT 'NO CARRIER' ABORT VOICE

ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED TIMEOUT 12 '' ATZ OK AT+CGDCONT=1,"IP","<your APN configured in tethering wizard>" OK ATD*99# TIMEOUT 120 CONNECT ''

5.

If steps 3 and 4 were OK, then you should be able to

test pppd connection to the Internet. NOTE: This test assumes following: a) that SIM/USIM card in your 3G modem doesn't require PIN code. b) that your 3G modem automatically register SIM/USIM to a network in Automatic mode (auto-band, 3G preferred mode (EDGE service if no 3G available)) If this is not a case please take a look in section "Modifying tether_start script" later, for reference how to modify '/data/tether_start' script with adequate AT commands that should be sent to modem.

Re-plug your 3G USB dongle. Wait at least 5 sec. Start the Terminal Emulator, or ConnectBot (to Issue 'su' command in terminal window to gain root Issue '/system/xbin/3Gmodem_init.sh' command Issue '/system/bin/pppd /dev/ttyUSB0 460800 debug

localhost). access.

mtu 1280 mru 1280 name <username> password <password> call tether'

If you get CONNECTED message then your dongle and /dev/ttyUSBx port is set right and everything is configured well. Output should look like this:
Code:

ATZ OK AT+CGDCONT=1,"IP","<your APN configured in tethering wizard>" OK ATD*99# CONNECT

You can interrupt pppd with Ctrl+C. If you don't see CONNECT (or any) response from modem try with one of other ttyUSB[0-5] ports first, or refer to following section on modifying /data/tether_start script.

6.

Assuming the step 5 was success, edit '3Gmod.usbPort'

option to match the number you have used in test in step 5, in '/data/local.prop' file, and REBOOT your Archos.

From now you can use 3G USB tethering just by plugging 3G USB dongle, and starting 'Setup->Wireless & Network->Cellphone Tethering>Tether'.
Modifying '/data/tether_start' script for your particular 3G modem and 3G operator: File '/data/tether_start' is standard chatscript for unix chat program ('man chat' on Google for more info and syntax reference) used by pppd when making connection. In default tether_start file most important line is one for setting APN: ' OK AT+CGDCONT=1,"IP","<your APN configured in tethering wizard>" ' in example above.

Second important line is one that connects your modem to your 3G data provider: 'OK ATDT*99#' - for some providers it needs to be modified to 'OK ATDT*99***1#'. If your SIM/USIM card needs PIN in order for you to be able to use your 3G USB dongle, try to disable PIN on your card before using it in 3G USB dongle. If you can't disable PIN for your SIM/USIM card (for example, as far as I know Tele2 cards must have PIN), you'll probably need to modify 'tether_start' script and to add adequate AT commands and expected responses, before setting APN. A solid reference of 3G modem AT commands and manufacturer/model specific AT commands can be found these pages: http://3g-modem.wetpaint.com/page/common+AT-commands http://3g-modem.wetpaint.com/page/Huawei+AT-commands http://3g-modem.wetpaint.com/page/ZTE+AT-commands and http://3g-modem.wetpaint.com/page/Si...ss+AT-commands Example /data/tether_start script that sends PIN 1234 and sets "auto 3G/GPRS mode" (for Huawei 3G USB dongles only !!!) looks something like this:
Code:

ABORT 'BUSY' ABORT 'NO CARRIER' ABORT 'VOICE' ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT 'DELAYED' REPORT CONNECT TIMEOUT 6 '' ATQ0 OK-AT-OK ATZ TIMEOUT 3 OK AT+CPIN=1234 OK-AT-OK ATI OK ATZ OK ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

OK AT\^SYSCFG=14,2,3fffffff,0,1 OK-AT-OK AT+CGDCONT=1,"IP","<your APN configured in tethering wizard>" OK ATDT*99***1# TIMEOUT 30 CONNECT ''

There is a plenty of information on the Internet on how to configure Linux ppp chatscripts for particular models of 3G USB dongles and 3G operators, so please SEARCH, READ & TRY before asking, since you'll have to try it anyway at the end ISSUES: First start of tethering after plugging, re-plugging 3G .

USB dongle or stopping tethering can (and probably will) end in "unable to connect by tethering" message. This happens since dongle needs to be switched to usb-serial mode, kernel modules must be loaded, and most important 3G dongle must register to 3G data network to be able to connect, and Android framework timeout before connection is established. Solution is to just start tethering again, and since there is no need to do a usb_modeswitch again, and kernel modules are already loaded, and dongle is registered to 3G network provider, it will connect before timeout. When Archos wakes-up after sleep, some dongles (ZTE-

MF190 is one of them), wake-up in default mode (non usbserial mode), so tethering needs to be stopped and started manually. One possible workaround is to enable "Prevent device from going to sleep" in 'Setup>Wireless & Network->Cellphone Tethering', but with uruk-droid 0.4.1 based on Archos 2.0.x firmware this option didn't work as expected - device still goes to sleep, even if tethering is connected. With 2.1.x based uruk-droid (0.6 is first) it seems that this option works.

QUESTIONS & ANSWERS: Q: Can I use my phone and 3G modem whithout reconfiguring tethering every time I switch them ? A: Please take a look in this post

S-ar putea să vă placă și