Wednesday, 16 May 2007

bluetooth fun with my Nokia 6600

I just started poking with my Nokia 6600 and python for S60. From the highlights of the evening (I just started, so I needed to set things up).
  • 'obexpushd -B' is good for receiving all the images and videos stored on the phone and taking space
  • 'obexftp -b "phonename" -p somefile' - is the way to send files to the phone (I installed pyS60 on the phone, whoohoo)
  • nothing works unless you use hcitool dev and hciconfig reset before using any of the above
  • it is really useful if you have tried a couple of days ago to make it easier for your father to receive via Bluetooth on the laptop files sent from the phone and realised the former (since gnome in Etch doesn't have any graphical means to start an obexpushd server)
Now I would really like to know how to start a serial terminal server that listens on Bluetooth to be able to start the bluetooth console in a manner similar to the Windows or Mac method.

Update: After digging and trying different things I got to a message which put me on the right track. After a while I got the magic formula:

bounty:/home/eddy/usr/lib/linux_and_other_oses/series 60/devel/python# rfcomm listen 0 3
Waiting for connection on channel 3
Connection from 00:60:57:BB:B6:C5 to /dev/rfcomm0
Press CTRL-C for hangup


The 1 means to create a /dev/rfcomm1 device; the 3 is the channel on which the Bluetooth console tries to connect (try once and you will see it).

After that, the hint in the Mac tutorial, so I typed:

bounty:/home/eddy$ screen /dev/rfcomm0
help
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'help' is not defined
>>>

Victory! Now I can actually start to program.

Update2:
Oh, yes, I remembered I should write something like "How to connect PyS60 Bluetooth console and Linux" so is easier to spot. I tried to add myself a link to the proper page, but I couldn't make an account because of the broken capthca.

7 comments:

Anonymous said...

My guide to using Bluetooth to talk with devices on Debian Etch:

http://thegoldenear.org/toolbox/unices/desktop-system-setup-debian-etch.html#bluetooth

sh1mmer said...

Hi, I added your link to the Nokia wiki. The trick with the CAPTCHA is to type it in lower case and put a space between the words. It's pretty insane.

Ulf said...

Hi, I've followed your instructions but I'm still able to connect to the bluetooth console. I get this message error when I select my computer from Bluetooth console option:

No serial ports found!

I have a Nokia 6670, does it connects on a different channel other than 3?

Thanks in davance for the help

Anonymous said...

Can you post your /etc/bluetooth configuration files? I can't get the pys60 bluetooth console to work, even after following your instructions.

eddyp said...

Here are they (of course, anonymized):

eddy@bounty /etc/bluetooth $ ls
hcid.conf rfcomm.conf
eddy@bounty /etc/bluetooth $ cat hcid.conf
#
# HCI daemon configuration file.
#

# HCId options
options {
# Automatically initialize new devices
autoinit yes;

# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
#
security user;

# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing multi;

# Default PIN code for incoming connections
passkey "0000";
}

# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
name "%h-%d";

# Local device class
class 0x3e0100;

# Default packet type
#pkt_type DH1,DM1,HV1;

# Inquiry and Page scan
iscan enable; pscan enable;

# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
lm accept;

# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;
}

# HCI device for gnubox
device {
# Local device name
# %d - device id
# %h - host name
name "BlueZ(%d)";

# Local device class
class 0x100;

# Default packet type
#pkt_type DH1,DM1,HV1;

# Inquiry and Page scan
iscan enable; pscan enable;

# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
lm accept;

# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp hold,sniff,park;
}


eddy@bounty /etc/bluetooth $ cat rfcomm.conf
#
# RFCOMM configuration file.
#

#rfcomm0 {
# # Automatically bind the device at startup
# bind no;
#
# # Bluetooth address of the device
# device 11:22:33:44:55:66;
#
# # RFCOMM channel for the connection
# channel 1;
#
# # Description of the connection
# comment "Example Bluetooth device";
#}

rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device
device 00:11:22:00:11:22;

# RFCOMM channel for the connection
channel 1;

# Description of the connection
comment "Bluetooth connection with somedevice";
}

rfcomm1 {
# Automatically bind the device at startup
bind no;

# Bluetooth address of the device
device 00:11:22:33:44:55;

# RFCOMM channel for the connection
channel 2;

# Description of the connection
comment "Bluetooth connection with some other device";
}

Vladimir said...

I was recieving
"No serial ports found!" as other comment posters while trying to connect from my Nokia N95 until I registered the serial port service on the computer by running "sdptool add –channel=3 SP"

Josh said...

Im using Nokia 6600 and now I got problem... when Im trying to open gallery I need to wait a long time but not nothing... always loading...