PyS60 Bluetooth console

From OpenSource

Jump to: navigation, search

The Bluetooth console is an interactive Python interpreter running on the phone that communicates with your PC over a Bluetooth connection. It's immensely useful for debugging and experimentation, but it can be a bit of a pain to set up.

See also Bluetooth section


[edit] Windows

[edit] Mac OS X

[edit] Linux

To be able to understand or to evaluate different howtos it is important to understand basics of the bluetooth layered architecture. http://en.wikipedia.org/wiki/Bluetooth_protocols Otherwise with all the different linux tools for each layer it looks like a mess. You will need at least following tools:

  • 'hcitool' to find your mobile device
  • 'sdptool' and 'sdpd' daemon to register services like serial port
  • 'rfcomm' to emulate serial port over bluetooth
  • 'cu' or any other terminal program


Instructions

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

You're now in control of your mobile's python console :)

Tested with:

  • Nokia 6630, Ubuntu 7.10.
  • N73, Ubuntu 7.04, Thinkpad T42p.

Notes:

  • This procedure doesn't work on Ubuntu 8.04 due a bug in bluez-utils [1] and can be temporally fixed till hardy is updated installing debian sid package [2]

Additional HOWTOs

Personal tools
MediaWiki Resources