00101010

My blog on life the universe and everything…

Category Archives: PyS60

How to use the Bluetooth console of PyS60 from your computer.

Open a shell and type the following commands one at a time:

“hciconfig reset”

“rfcomm listen 0 3”

This last command will advertise an rfcomm connection on channel 3.

then on your PyS60 screen on the phone choose “Options ->Bluetooth Console” to connect to the computer.

Once this is done, open a new shell and type “screen /dev/rfcomm0″

whala! you can now type in commands on your PC and those are redirected to the phone. Commands that do not require UI access will be displayed on your computer screen, but UI based commands such as appuifw.note(u”hello world”,”info”) will be displayed on your phone as would happen if the script was running on your phone (which is what is happening actually).

——————————————————————–

If the above approach does not work for you, try the one below:

Plug-in your bluetooth adapter, and then from the shell:

hciconfig reset

Then check that the device exists by typing:

  • $ hcitool dev

Register a serial port (use channel 2. For some reason, channel 1 and channel 3 might not let the connection through)

  • $ sdptool add –channel=2 SP

Now listen to the channel:

  • $ rfcomm listen rfcomm2 2

In your phone, make sure bluetooth is on, then go to the Python application and then select the Bluetooth Console. Select from the list of available devices your computer’s bluetooth adapter (you might need to select search even if you think you have already defined the pairing). If the operation is successful, you should see something similar to the following on your computer’s shell:

  • Waiting for connection on channel 2
  • Connection from 00:11:9F:BE:47:CA to /dev/rfcomm2
  • Press CTRL-C for hangup

Now open a new shell terminal and execute:

  • $ cu -l /dev/rfcomm2

Enjoy!

sources:

PyS60 Bluetooth console

bluetooth fun with my Nokia 6600

%d bloggers like this: