Process
Step 1: Plug the data cable into your mobile phone and into your computer. Then see whether it was recognised by the kernel.
Step 2: Configure Ubuntu to be able to communicate with your phone and use it to connect to the Internet.
Install ppp (handles modems and dialing) if it's not installed already:
If the /var/log/messages output above showed something other than ttyACM0, substitute that in the above code.
Ubuntu will need to send some commands to your phone to tell it to connect to the Internet. These commands are stored in a chat script, and are sent when you try to connect.
You also need to be registered to use the modem connection. You are probably registered already, but this should take care of it if you're not (using your Ubuntu login name):
Specifically where I have set "INTERNET" above, may well be different in your case. This is the Access Point Name (APN). It can (probably) be found in your phone's settings - I can get to it through the following path on my phone: Menu > Tools > Settings > Connection > Access Points. From there choose the access point you use to connect to the Internet (most probably the first one on the list). One of the settings there is "Access point name". Substitute what it says there where I have put "INTERNET" above.
Step 3: You should now be ready to connect. To dial, use the "pon" command, and to disconnect, use the "poff" command.
Useful Commands
External Resources
Step 1: Plug the data cable into your mobile phone and into your computer. Then see whether it was recognised by the kernel.
tail /var/log/messagesShould result in something like the following output:
localhost kernel: [4295346.417000] usb 1-1: new full speed USB device using ohci_hcd and address3According to this output, the kernel driver being used is cdc-acm (you don't need to know that, but it may be useful for other applications). We can deduce from the second line that linux can see the device at /dev/ttyACM0 - this you will need to know.
localhost kernel: [4295348.125000] cdc_acm 1-1:1.8: ttyACM0: USB ACM device
localhost kernel: [4295348.133000] usbcore: registered new driver cdc_acm
localhost kernel: [4295348.133000] drivers/usb/class/cdc-acm.c: v0.23:USB Abstract Control Model driver for USB modems and ISDN adapters
Step 2: Configure Ubuntu to be able to communicate with your phone and use it to connect to the Internet.
Install ppp (handles modems and dialing) if it's not installed already:
sudo apt-get install pppYou will need to create a configuration file that tells Ubuntu how to handle communication with the phone. If you prefer using a graphical text editor, replace "vi" in this and the following steps with "gedit". The files should be empty to start with.
sudo vi /etc/ppp/peers/mobileEnter the following text:
Code:
debug
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/mobile"
usepeerdns
/dev/ttyACM0 115200
defaultroute
crtscts
lcp-echo-failure 0
If the /var/log/messages output above showed something other than ttyACM0, substitute that in the above code.
Ubuntu will need to send some commands to your phone to tell it to connect to the Internet. These commands are stored in a chat script, and are sent when you try to connect.
sudo vi /etc/chatscripts/mobileEnter the following text:
Code:
TIMEOUT 35
ECHO ON
ABORT '\nBUSY\r'
ABORT '\nERROR\r'
ABORT '\nNO ANSWER\r'
ABORT '\nNO CARRIER\r'
ABORT '\nNO DIALTONE\r'
ABORT '\nRINGING\r\n\r\nRINGING\r'
'' \rAT
OK 'AT+CGDCONT=1,"IP","INTERNET"'
OK ATD*99***1#
CONNECT ""
You also need to be registered to use the modem connection. You are probably registered already, but this should take care of it if you're not (using your Ubuntu login name):
sudo adduser your-username-here dialoutIf you can connect to the Internet on your phone (without your computer), the configuration scripts above should work. If not, look around in the links given below and see whether you can resolve the problem. The most likely points of failure are the 'AT+CGDCONT=1,"IP","INTERNET"' and ATD*99***1# sections.
Specifically where I have set "INTERNET" above, may well be different in your case. This is the Access Point Name (APN). It can (probably) be found in your phone's settings - I can get to it through the following path on my phone: Menu > Tools > Settings > Connection > Access Points. From there choose the access point you use to connect to the Internet (most probably the first one on the list). One of the settings there is "Access point name". Substitute what it says there where I have put "INTERNET" above.
Step 3: You should now be ready to connect. To dial, use the "pon" command, and to disconnect, use the "poff" command.
pon mobileWhatever messages are communicated between Ubuntu and your phone, should show up in /var/log/syslog. The easiest way to see what's happening in the process is to open another terminal and use the following command before connecting with the commands above:
poff mobile
tail -f /var/log/syslogWhatever messages are written to the log, will now be displayed on your terminal "live".
Useful Commands
Code:
tail /var/log/messages
lsusb
pon
poff
tail -f /var/log/syslog
External Resources


0 comments:
Post a Comment