Random ...
December 2017
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Tags ...

Linux++:::: Fun with linux and S60
Posted at 19.Jan,2009 17:52  Comments 0 / Trackbacks 0 / Like this post!
Technorati tag(s):

Interacting with S60 from Linux is a lot of fun. Here's how to use the S60 phone to access the internet via GPRS/EDGE/3G.

If we're using the USB cable, plug in the phone and choose PC Suite. dmesg will reveal the device type. In my case, it's /dev/ttyACM0

Now, add these lines to /etc/wvdial.conf (replace diginet with your APN):

 [Dialer Defaults]
 Init1 = ATZ
 Init2 = ATM0
 Init3 = AT+CGDCONT=1,"IP","diginet","",0,0
 FlowControl = None
 Modem Type = USB Modem
 ISDN = 0
 Phone = *99***1#
 Modem = /dev/ttyACM0
 Username = digi
 Password = 1234
 Baud = 460800
 Stupid Mode = 1

Run wvdial, and we should be able to connect to the internet.

If we're connecting to the phone via bluetooth, we need to do it a little differently.

First, we need to pair our phone and linux. Now, we need to find the DUN channel. To do this, run:

 sdptool search DUN

 Searching for DUN on 00:xx:xx:xx:xx:xx ... 
 Service Name: Dial-Up Networking
 Service RecHandle: 0x10011
 Service Class ID List:
  "Dialup Networking" (0x1103)
 Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 2
 Language Base Attr List:
  code_ISO639: 0x454e
  encoding:    0x6a
  base_offset: 0x100
 Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

We need to configure rfcomm.conf. In fedora, edit/add a file at /etc/bluetooth/rfcomm.conf:

 # RFCOMM configuration file.

 rfcomm0 {
        bind yes;
        device 00:xx:xx:xx:xx:xx;
        channel 2; #from the sdptool search result
        comment "mine!";

Then run rfcomm bind 00:xx:xx:xx:xx:xx

Now, edit wvdia.conf (replace /dev/ttyACM0 with /dev/rfcomm0) and run wvdial

If everything goes well, we'll get:

 --> Sending: ATDT*99***1#
 --> Waiting for carrier.
 ~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
 --> Carrier detected.  Starting PPP immediately.
 --> Starting pppd at Mon Jan 19 17:43:06 2009
 --> Pid of pppd: 11227
 --> Using interface ppp0
 --> pppd: ��T �[06]U
 --> pppd: ��T �[06]U
 --> pppd: ��T �[06]U
 --> pppd: ��T �[06]U
 --> local  IP address
 --> pppd: ��T �[06]U
 --> remote IP address
 --> pppd: ��T �[06]U
 --> primary   DNS address
 --> pppd: ��T �[06]U
 --> secondary DNS address
 --> pppd: ��T �[06]U

Sometimes it took a few tries before the connection worked.

Now for connecting to pys60 via bluetooth. pys60 comes with bluetooth console that enables us to do the typing on our computer and the result popped up at the phone.

To get running:

  • run hciconfig reset (just in case)
  • run hcitool dev (to see we got everything in order) :
     hcitool dev
            hci0    00:10:C6:77:BC:5E
  • now run sdptool add --channel=2 SP :
     # sdptool add --channel=2 SP
     Serial Port service registered
  • and at run rfcomm listen 0 2 (make use of /dev/rfcomm0, connections via channel 2) :
      # rfcomm listen 0 2
     Waiting for connection on channel 2
     Connection from 00:xx:xx:xx:xx:xx to /dev/rfcomm0
     Press CTRL-C for hangup

Now from another terminal, run cu -l /dev/rfcomm0:

 $ cu -l /dev/rfcomm0

 >>> import appuifw
 >>> x=appuifw.query(u'Where you from?','text')

And the result will be displayed at the phone. Good for prototyping if we can't get the emulator running.

I will update the screenshots later ...

Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/224/tbping 

Post a comment