Gentoo Wiki ArchivesGentoo Wiki




I was suprised to find so little documentation on setting up Mobile Phones to interface with linux, so I decided to start the revolution with this article on the N60 series phones. There a quite a few topics that I havent covered in this article regarding these phones and I would encourage anyone to extend this artice and add in anything helpful including:


For all of those gentooers out there who are too cheap to invest in a bluetooth dongle (like myself), here is how to get your Nokia N60 series phone to talk to your pc via the DKU-2 cable which comes with the phone (I think).

About the DKU-2

After much obscure browsing of forums etc, I came across some details about the DKU-2. First of all the cable is passive and contains no convertors or chips etc like the DKU-5 cable has.This has lead some people to believe that the phone is just a straight USB device, but this is not true. The phone itself acts as a USB to Serial convertor.

Plug it in

plug the phone into your PC using the cable

lsusb should display the following:

Bus 001 Device 001: ID 0000:0000
Bus 002 Device 004: ID 0421:041e Nokia Mobile Phones  <- Bingo!! my Nokia6680
Bus 002 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000

you'll see the ID 0421:041e or something similar depending on your phone

Kernel Configuration

Now get into your kernel source directory and fire up the menuconfig

$ cd /usr/src/linux 
$ make menuconfig

ensure the following settings are enabled:

Device Drivers  --->  
    USB support  --->
       USB Serial Converter support  --->
       <M> USB Serial Converter support                                                                                                                        
       [*]   USB Generic Serial Driver

OR to get cdc_acm module

Device Drivers  --->  
    USB support  --->
    <M>   USB Modem (CDC ACM) support 

If you had to enable them then obviously recompile your kernel, which Im sure you've done before but just incase:

$ make && make modules_install
$ cp arch/i386/boot/bzImage /boot/kernel-xx     

Now restart so that the new kernel comes into effect

finally modprobe the module with your specific vendor and product ID's and you're done:

$ modprobe usbserial vendor=0x0421 product=0x041e

The device should now be under /dev/ttyUSB0

Tip:if you dont feel like modprobing the module with all the ID settings everytime, then put it into: /etc/modules.autoload.d/kernel-2.x

usbserial vendor=0x0421 product=0x041e

Using your Phone as a Modem

Kernel Configuration

Now to use your phone as a modem you'll need to do some kernel tweaking once more:

$ cd /usr/src/linux 
$ make menuconfig

and enable the following in your kernel:

Device Drivers  --->   
Network device support  --->         
<*> PPP (point-to-point protocol) support                                                                                                               
[*]   PPP multilink support (EXPERIMENTAL)                                                                                                              
[*]   PPP filtering                                                                                                                                     
<*>   PPP support for async serial ports                                                                                                                
<*>   PPP support for sync tty ports                                                                                                                    
<*>   PPP Deflate compression                                                                                                                           
<*>   PPP BSD-Compress compression                                                                                                                      
<*>   PPP MPPE compression (encryption) (EXPERIMENTAL)                                                                                                  
<*>   PPP over Ethernet (EXPERIMENTAL)                   

Recompile and copy your kernel image like before:

$ make && make modules_install
$ cp arch/i386/boot/bzImage /boot/kernel-xx 

Emerging Ppp

Now emerge ppp (if you havent done so already):

$ emerge ppp

portage might give you some sort of important message at the end about how the base layout has changed. If it suggests you do some sort of update, then do it.

Ppp Scripts

Now we need to get some ppp scripts going:


/dev/ttyUSB0    # Serial device to which the GPRS phone is connected
#/dev/ttyACM0   #If using cdc-acm module
debug        # Comment this off, if you don't need more info
# scripts to initialize the 3G / EDGE / GPRS modem  
connect '/usr/sbin/chat -v -f /etc/ppp/peers/connect-chat'
# AT commands used to 'hangup' the connection
disconnect '/usr/sbin/chat -v -f /etc/ppp/peers/disconnect-chat'
460800      # Serial port line speed
crtscts    # hardware flow control for cable
local        # Ignore carrier detect signal from the modem:
lcp-echo-failure 0
lcp-echo-interval 0
# IP addresses:
# - accept peers idea of our local address and set address peer as
# (any address would do, since IPCP gives to it)
# - if you use the 10. network at home or something and pppd rejects it,
# change the address 
noipdefault        # pppd must not propose any IP address to the peer!
ipcp-accept-local    # Accept peers idea of our local address
defaultroute        # Add the ppp interface as default route to the IP routing table
#replacedefaultroute    # New route should be our default route to Internet
usepeerdns        # User DNS returned by server
noauth            # The phone is not required to authenticate
# Most phone do not support compression, so turn it off.
# Username and password:
# If username and password are required by the APN, put here the username
# and put the username-password combination to the secrets file:
# /etc/ppp/pap-secrets for PAP and /etc/ppp/chap-secrets for CHAP
# authentication. See pppd man pages for details.
user "insert_your_access_point_here"        # Change this
persist            # Persistent connection
maxfail 99999        # Retry and retry and retry if failed...


#! /bin/sh
TIMEOUT         10  
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'  
TIMEOUT         15  
OK              ATE1  
OK              'AT+cgdcont=1,"IP","insert_your_access_point_here",""' #change this  
OK              ATD*99#


# send break exec /usr/sbin/chat -V -s -S    \
ABORT           "BUSY"          \
ABORT           "ERROR"         \
ABORT           "NO DIALTONE"   \
SAY             "\nSending break to the modem\n"        \
""              "\K"            \
""              "\K"            \ 
""              "\K"            \
""              "\d\d+++\d\dATH"        \
SAY             "\nPDP context detached\n"

Now dont forget to make your scripts excecutable

chmod a+x /etc/ppp/peer/connect-chat
chmod a+x /etc/ppp/peer/disconnect-chat
chmod a+x /etc/ppp/peer/provider

This is where the real fun begins....

As with Linux, nothing ever works the first time around, so open up a new terminal and see whats happening:

$ tail -f /var/log/messages

Now plug in your phone

Make sure the usbserial or cdc-acm module is loaded

Open up a new terminal and remove your default gateway if you have one, as this will cause a conflict resulting in the phone not functioning properly as a modem

$ route del default gw

Now fire up the script and hope that it works

$ pon provider

Or better start pppd like this (and enable nodetach in /etc/ppp/options)

$ pppd dump call provider

If it does work, you should be able to see something like this when you run "ifconfig ppp0":

ppp0      Link encap:Point-to-Point Protocol
          inet addr:  P-t-P:  Mask:
          RX packets:2154 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1654 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:2400234 (2.2 Mb)  TX bytes:221590 (216.3 Kb)

otherwise, theres a problem in your script configuration and you need to investigate /var/log/messages to sort it out

Tip: You might want to make sure that the device is unplugged, that all processes started by the provider script are killed and then the device is reconnected, before attempting to rerun the script

once you've got it working you can disconnect by simply running:

$ poff provider

Transferring Files to/from MMC Card via USB

Connect phone with USB cable in "Data transfer mode", then check your "dmesg" command output. It should be something like this:

SCSI device sdb: 3966728 512-byte hdwr sectors (2031 MB)
sdb: Write Protect is off
sdb: Mode Sense: 03 00 00 00
sdb: assuming drive cache: write through
 sdb: unknown partition table
sd 4:0:0:0: Attached scsi removable disk sdb
usb-storage: device scan complete

In my case MMC card didn't have partition table at all. All card is one FAT16 partition. So I was able to mount it by command:

# mount /dev/sdb /mnt/mmc

Here you need to use device from "dmesg" command. In my case it's "sdb". After that you can access files on MMC card through folder /mnt/mmc. Don't forget to unmount it at the end:

# umount /mnt/mmc


Last modified: Mon, 04 Aug 2008 00:00:00 +1000 Hits: 25,696

Created by, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.