문제

I need to use a USB Bluetooth dongle on a linux server. Actually it works and I can discover other bluetooth devices, but if I try to connect with one of them (with rfcomm) it says Can't connect RFCOMM socket: Connection refused.

I think that the problem is the pairing, because when I type the same command on desktop systems, it asks the passkey to me, in a dialog window (not in the terminal). So the question is: how can I pair a device without a desktop environment? Thanks in advice.

도움이 되었습니까?

해결책

This command works for me:

echo [PIN] | bluez-simple-agent hci0 [BT_MAC_ADDRESS]

다른 팁

  1. If your device is already paired, then to request pairing again, commands as below. Or else error mesage as Creating device failed: org.bluez.Error.AlreadyExists: Already Exists

    To remove pairing: bluez-test-device remove XX:XX:XX:XX:XX:XX   
    To pair again    : bluez-simple-agent hci0  XX:XX:XX:XX:XX:XX
    
  2. If you happen to have than 1 bluetooth hardware and would like to use second one, use hciconfig to find adapter name and then use that name in place of hci#. Command as below

    bluez-simple-agent hci# XX:XX:XX:XX:XX:XX
    
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top