Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux command line howto accept pairing for bluetooth device without pin

Is there a way to pair a device in linux without requiring a pin(for testing purposes so I need it to be done w/out human interaction, assuming you have root access)?

bluez-simple-agent seems to require a pin except with some simple devices such as mice.

like image 859
Roman A. Taycher Avatar asked Oct 15 '12 02:10

Roman A. Taycher


People also ask

How do I find the PIN for my Bluetooth device?

Go into the Bluetooth menu on your cell phone to find the passcode for your cell phone. The Bluetooth menu for your phone is typically located under the "Settings" menu. In the Settings menu, there should be an option to "Get code" or something comparable, which would allow you to find the code for your phone.

Why is my Bluetooth asking me for a PIN?

With newer devices, pairing usually happens automatically without any input from you. Older or lower-end devices may prompt you to enter a PIN as part of the pairing process.


1 Answers

Entering a PIN is actually an outdated method of pairing, now called Legacy Pairing. Secure Simple Pairing Mode is available in Bluetooth v2.1 and later, which comprises most modern Bluetooth devices. SSPMode authentication is handled by the Bluetooth protocol stack and thus works without user interaction.

Here is how one might go about connecting to a device:

# hciconfig hci0 sspmode 1 # hciconfig hci0 sspmode hci0:   Type: BR/EDR  Bus: USB BD Address: AA:BB:CC:DD:EE:FF  ACL MTU: 1021:8  SCO MTU: 64:1 Simple Pairing mode: Enabled # hciconfig hci0 piscan # sdptool add SP # hcitool scan     00:11:22:33:44:55    My_Device # rfcomm connect /dev/rfcomm0 00:11:22:33:44:55 1 & Connected /dev/rfcomm0 to 00:11:22:33:44:55 on channel 1 Press CTRL-C for hangup 

This would establish a serial connection to the device.

like image 187
Paul Poulsen Avatar answered Sep 28 '22 08:09

Paul Poulsen