8

I am using Xubuntu, pure Xfce, 64-bit.

The problem:

I have tried 2 ways; both have failed for different reasons: (1) the commandline way (see below) fails because at no stage does it actually ask for a pin verification. (2) the GUI way using the "Bluetooth" utility (that sounds generic but it's what the tool is actually called and how it is catalogued under Synaptic) fails because the keyboard is unresponsive when the pin is requested by Bluetooth.

How do I pair my device properly with the use of a automatically generated PIN?

I really don't care if the solution will be GUI-based or not, as long as you can get it to pair the secure way, with a PIN. I don't want to be using my keyboard on discovery mode all the time for obvious reasons relating to security.

Details of my failed efforts:

I followed the directions on http://ubuntuforums.org/showthread.php?t=224673 in order to activate a generic bluetooth device (http://www.ebay.com/itm/Mini-Bluetooth-Keyboard-PC-Mac-iPhone-Nokia-PDA-HTC-/110653444332?pt=PCA_Mice_Trackballs&hash=item19c37590ec), which succeeded. Except come the part where I am supposed to be asked for a password, I wasn't. This is a bit disturbing, I think to myself. Anyone in the neighborhood could've in this manner connected to my keyboard and started key-logging my activities.

Anyhow this is how I did it:

peter@peter-xfce:~$ hcitool scan
Scanning ...
peter@peter-xfce:~$ hcitool scan
Scanning ...
    00:12:A1:11:04:E9   Bluetooth Keyboard
peter@peter-xfce:~$ gksudo mousepad /etc/bluetooth/hcid.conf
peter@peter-xfce:~$ sudo gedit /etc/default/bluetooth
peter@peter-xfce:~$ sudo /etc/init.d/bluetooth restart
 * Stopping bluetooth                                                    [ OK ] 
 * Starting bluetooth                                                    [ OK ] 
peter@peter-xfce:~$ sudo hidd --connect 00:12:A1:11:04:E9
sudo: hidd: command not found
peter@peter-xfce:~$ hidd --connect 00:12:A1:11:04:E9
The program 'hidd' is currently not installed.  You can install it by typing:
sudo apt-get install bluez-compat

[at this point bluez-compat is installed]

peter@peter-xfce:~$ sudo hidd --connect 00:12:A1:11:04:E9
peter@peter-xfce:~$ 

[can now type using the bluetooth keyboard]

Again this is unacceptable. I don't consider that the device was paired securely because no pin was requested.

Alternatively via GUI:

enter image description here

But the keyboard is unresponsive so I cannot enter to PIN when requested.

ptrcao
  • 5,635
  • Try a Ubuntu LiveCD and see if it is just Xubuntu not helping? – Steve-o Aug 28 '11 at 09:14
  • I tried pairing with a Gnome 3 LiveCD and was able to successfully pair the BT device - so this problem may be specific to Ubuntu or Xfce... Still, I'm not going to convert desktop environments at this stage so I still need a solution for Ubuntu in Xfce. I'll try with a Ubuntu LiveCD (running Gnome) later to further narrow down the cause of the problem to Xfce if that is the case. Any ideas in the meantime? – ptrcao Aug 30 '11 at 01:52
  • I got my k760 working using the bluetoothctl command. sudo apt-get install bluez-compat. You run bluetoothctl and then scan. Use the device id listed and run pair xx:xx:xx:xx:xx filling in your device id then run connect xx:xx:xx:xx:xx then run trust xx:xx:xx:xx:xx. This should mean that your device is paired and correctly working. I got this working on Mate 14.04 running on a Raspberry pi 2 board. Thanks – james-see Dec 09 '15 at 22:02

3 Answers3

4

I just got the pairing to work myself in linux... I did the following:

I'm on Linux Mint

First I got the name of the bluetooth device using hcitool inq while the device was discoverable:

$ hcitool inq
Inquiring ...
00:1F:20:3D:7A:4A        clock offset: 0x14b4    class: 0x002540

Then I got identified the device:

$ hcitool scan
Scanning ...
        00:1F:20:3D:7A:4A        Logitech K760

This is the keyboard I was trying to connect. :) Next I needed the name of the bluetooth adapter as a device:

$ hciconfig
hci0:     Type: BR/EDR  Bus: USB
          BD Address: E0:2A:82:02:5D:EF   ACL MTU: 1021:8  SCO MTU: 64:1
          UP RUNNING PSCAN ISCAN
          RX bytes:5150 ac1:0 sco:0 events:262 errors:0
          TX bytes:1272 ac1:0 sco:0 commands:116 errors:0

Armed with this information, we can now use the simple agent:

$ bluez-simple-agent hci0 00:1F:20:3D:7A:4A
DisplayPasskey (/org/bluez/791/hci0/dev_00_1F_20_3D_7A_4A, 123456)

At this point, you can type the passkey which is the number after the comma in the parenthesis, on the bluetooth keyboard. then hit enter and you'll get:

Release
New Device (/org/bluez/791/hci0/dev_00_1F_20_3D_7A_4A)

Next we need to link up the keyboard to the input system:

hidd --connect 00:1F:20:3D:7A:4A

At this point I realized I made two mistakes: the tool wasn't installed...

$ sudo aptitude install bluez-compat
<all sorts of wonderful stuff you don't need to see here>

... and I didn't run as root:

$ hidd --connect 00:1F:20:3D:7A:4A
HID create error 13 (permission denied)
$ sudo !! # yes if you put this command in
          # after failing to run a command that requires elevation,
          # it will run as though sudo'ed, the shell subs !! for
          # the last command
sudo hidd --connect 00:1F:20:3D:7A:4A
Can't get device information: host is down

At this point, the keyboard had lost "discoverable" status (the blue light wasn't blinking anymore, so I pressed the discover key, then on the old keyboard, hit the up arrow, and enter to repeat the command:

$ sudo hidd --connect 00:1F:20:3D:7A:4A
$ _

The command gives no output if it succeeds, the device is now paired, and ready to use as a keyboard.

Enjoy!

1

If the keyboard does work without PIN, it means that the keyboard itself is not configured to require PIN for communication. You might need a hardware-specific tool for that device to make it use PIN-based pairing. Or else, maybe the instructions given here will work - note the part when you have to type the PIN on the keyboard to set it.

  • Those are the very same instructions I followed. At no point is there an opportunity to enter your PIN, it just connects, meaning anyone in the neighbourhood can connect. However, when I do it via a GUI tool, there is a stage in the pairing process that stipulates a PIN. Except my keyboard is inactive at that stage so I cannot enter a PIN. It seems I cannot pair my device securely either way... – ptrcao Aug 29 '11 at 10:24
  • Just to make sure you understand this part right: you should just type the PIN on your keyboard at that exact point of configuration and nothing would appear on your screen at that time, just your keyboard would remember the sequence for future connections. – rozcietrzewiacz Aug 29 '11 at 15:20
  • "A window should pop up on your computer asking you for the number you just entered on the keyboard." - this doesn't happen as the instructions lead me to expect. In fact sometimes the command sudo hidd --search responds so quickly there is no time to enter the PIN - device will be connected without PIN creation at any stage. Any ideas? – ptrcao Aug 29 '11 at 22:38
0

I got the same problem but the issue was that the gui was not giving the right pin ! if I look at the result of the command sudo hcidump -at the pin was way different I had to actualy look at the pin from the command to input it into the gui. in other way I belive this is an xfce bug that should have been fixed a while ago because it date from an older version.