OESF Portables Forum

Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: DaveR on July 06, 2006, 05:22:04 am

Title: Bluetooth Pairing Worked Before - Not Now [solved]
Post by: DaveR on July 06, 2006, 05:22:04 am
I installed BlueZ and paired to a Nokia 6310i mobile a while ago. I didn't have any problem with the Bluetooth part of the setup - in fact the pairing was so easy I can't remember exactly what I did. I do remember putting the pin into the phone then into the little window put up by the pin helper - and it was done. My problems were all to do with PPP - which was another thread here.

Anyway I had it all working but needed to change to another, identical, Nokia (the original wasn't mine). Since then I've failed to pair the Z with the new phone despite trying every which way. I always get:
Can't connect RFCOMM socket: Connection refused

Googling on this error I find that others have had this problem and there doesn't seem to be a common cause. Some seem never to have solved it. In my case I know that this Z will attach to an identical phone.

The session below is typical
Code: [Select]
[eject/insert BT card]

root@zaurus:/etc/bluetooth> tail /var/log/messages

Jul  5 21:56:06 cardmgr[138]: executing: './bluetooth stop ttyS3 2>&1'
Jul  5 21:56:06 cardmgr[138]: + Shutting down Bluetooth... Done.
Jul  5 21:56:06 hcid[1034]: HCI dev 0 down
Jul  5 21:56:06 hcid[1034]: Stoping security manager 0
Jul  5 21:56:06 hcid[1034]: HCI dev 0 unregistered
Jul  5 21:56:06 /sbin/hotplug: no runnable /etc/hotplug/bluetooth.agent is installed
Jul  5 21:56:33 cardmgr[138]: socket 0: Compaq iPAQ Bluetooth Sleeve
Jul  5 21:56:34 cardmgr[138]: executing: './bluetooth start ttyS3 2>&1'
Jul  5 21:56:34 cardmgr[138]: + Starting Bluetooth... Done.

root@zaurus:/etc/bluetooth> hciattach ttyS3 bcsp

root@zaurus:/etc/bluetooth> hciconfig -a
hci0:   Type: UART
        BD Address: 00:05:4E:00:D9:D7 ACL MTU: 128:8  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes:264 acl:0 sco:0 events:13 errors:0
        TX bytes:446 acl:0 sco:0 commands:12 errors:0
        Features: 0xff 0xff 0x05 0x00 0x00 0x00 0x00 0x00
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        Name: 'BlueZ (0)'
        Class: 0x120114
        Service Classes: Networking, Object Transfer
        Device Class: Computer, Palm
        HCI Ver: 1.1 (0x1) HCI Rev: 0x73 LMP Ver: 1.1 (0x1) LMP Subver: 0x73
        Manufacturer: Cambridge Silicon Radio (10)

root@zaurus:/etc/bluetooth> hcitool scan
Scanning ...
        00:60:57:80:E0:05       DR Nok 6310i
    
root@zaurus:/etc/bluetooth> rfcomm connect hci0 00:60:57:80:E0:05 1
[Phone: Connect with BlueZ(0)? (Accept) Password? - (I provide PIN) - Connecting... Failed...Disconnected]

Can't connect RFCOMM socket: Connection refused

root@zaurus:/etc/bluetooth> tail /var/log/messages

Jul  5 21:56:34 cardmgr[138]: + Starting Bluetooth... Done.
Jul  5 21:57:56 hcid[1034]: HCI dev 0 registered
Jul  5 21:57:56 /sbin/hotplug: no runnable /etc/hotplug/bluetooth.agent is installed
Jul  5 21:57:56 hcid[1034]: HCI dev 0 up
Jul  5 21:57:56 hcid[1034]: Starting security manager 0
Jul  5 21:59:13 hcid[1034]: pin_code_request (sba=00:05:4E:00:D9:D7, dba=00:60:57:80:E0:05)

root@zaurus:/etc/bluetooth> rfcomm show
rfcomm0: 00:60:57:80:E0:05 channel 1 clean

root@zaurus:/etc/bluetooth> ls -al /dev/rfcomm0
crw-rw-rw-    1 root     root     216,   0 Jul  5 21:44 /dev/rfcomm0

[something I noticed that might be relevant:]

root@zaurus:/etc/bluetooth> cat /dev/rfcomm0
[asks for pin on phone - same sequence as above]
cat: /dev/rfcomm0: Connection refused

If I just run the PPP dialler which worked before (rfcomm0 is now pointing to the new phone) I get a similar error:

Jul  5 17:17:17 pppd[1301]: Failed to open /dev/rfcomm0: Connection refused

Things I've tried:Not only can I not pair this new phone I now can't talk to the old one - I get the same error message now. The devices should still be paired (the Nokia thinks it is and I've put back the link-key file, though I might have damaged it since - I didn't take a backup of it before I started all this.)

I'm not sure that it's the pairing process that's at fault - without a pin file I'm not even asked for my pin on the Z. Something to do with /dev/rfcomm0.

Any ideas?

Dave
Title: Bluetooth Pairing Worked Before - Not Now [solved]
Post by: zmiq2 on July 06, 2006, 05:38:36 am
Hi,

I'd suggest you to verify the contents of files in /etc/bluetooth:

1) hcid.conf: there's an entry for pin_helper. Verify that the script/program pointed by that entry works ok. I'd suggest to point pin_helper to a simple bash script like
#!/bin/bash
echo "PIN:1234"

2) rfcomm.conf: delete this file (or better move to another name/place); it keeps the bluetooth_id of the previous phone associated with the device /dev/rfcomm0, which should be freed now

After the changes, use your usual bluetooth restart / zaurus reboot to make sure changes are in effect.

HTH
Title: Bluetooth Pairing Worked Before - Not Now [solved]
Post by: DaveR on July 06, 2006, 08:04:26 am
It worked! Thanks zmiq2.

Actually, I feel such an idiot. I'd seen that suggestion, and thought - why should that make any difference - it paired OK last time.? (Why does it?)

For the record, I did exactly as suggested and after a reboot:
Code: [Select]
root@zaurus:~> cd /etc/bluetooth
root@zaurus:/etc/bluetooth> hciattach ttyS3 bcsp
root@zaurus:/etc/bluetooth> hciconfig
hci0:   Type: UART
        BD Address: 00:05:4E:00:D9:D7 ACL MTU: 128:8  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes:250 acl:0 sco:0 events:12 errors:0
        TX bytes:446 acl:0 sco:0 commands:12 errors:0

root@zaurus:/etc/bluetooth> hcitool scan
Scanning ...
        00:60:57:80:E0:05       DR Nok 6310i
root@zaurus:/etc/bluetooth> rfcomm connect hci0 00:60:57:80:E0:05 1
[phone asked for PIN and pairing was successful]
Connected /dev/rfcomm0 to 00:60:57:80:E0:05 on channel 1
Press CTRL-C for hangup
So probably only the 2 commands are required to connect it.

Thanks a lot.

Dave