Author Topic: Bluetooth Pairing Worked Before - Not Now [solved]  (Read 5429 times)

DaveR

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • http://
Bluetooth Pairing Worked Before - Not Now [solved]
« 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:
  • With and without a pin file. When I paired the first phone I got a window to put the pin in, but I've failed ever to get that window again. I think this is significant - I get the error message before I'm asked for my pin on the Z. /bin/bluepin is still the pin-helper and does work.
  • PIN files with and without newlines. Some posts claim this is significant. I'm not sure it ever gets to read this though - see above.
  • Deleting the old link-key file.
  • With and without a rfcomm.conf file, and with a default one (bind no) and one set up for the new phone. (The hcid.conf and bt-uart.conf files are as installed.)
  • Just about every hcitool and rfcomm command I can find
  • Installed bluez-spd and checked that channel 1 is correct for DUN
  • Deleting a lock file var/lock/subsys/bluetooth
  • Uninstalling and reinstalling the bluez packages - trying to revert to the original situation.
  • Checked that the Nokia firmware is the same on both phones. The new one is secondhand & BT works with a headset.
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
« Last Edit: July 06, 2006, 08:05:44 am by DaveR »
Dave Royal
Sharp Zaurus C860 (pdaXrom 1.1.0beta1)
Buffalo WLI-CF-S11G 802.11b CF
Belkin F8T020 Bluetooth CF

zmiq2

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
    • http://
Bluetooth Pairing Worked Before - Not Now [solved]
« Reply #1 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
sl-c750, archos av580, socket cf [bt, wifi, modem], noname cf lan, audiovox rtm800 gsm-gprs cf, rom: sharp -> oz3.5.3 -> cacko -> oz3.5.4.1

DaveR

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • http://
Bluetooth Pairing Worked Before - Not Now [solved]
« Reply #2 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
Dave Royal
Sharp Zaurus C860 (pdaXrom 1.1.0beta1)
Buffalo WLI-CF-S11G 802.11b CF
Belkin F8T020 Bluetooth CF