Jump to content

How to manually (using command line) configure Bluetooth keyboard/mouse?


laurentppol

Recommended Posts

Hi there,

I am a new user of OPi PC+, downloaded, flashed Armbian_5.20_Orangepipcplus_Debian_jessie_3.4.112_desktop.img

basic setup OK, got IP, changed passwords etc, GUI starts.

 

As I don't have USB keyboard/mouse, I've opened SSH session, then set

export DISPLAY=laptop2:0 , then xterm. OK.

 

From BT side it also looks ok: adapter blinks, I can find my BT keyboard/mouse using

hcitool scan

 

Now the problem: if I launch bluetooth-applet / bluetooth-assistant it CRASHES (assistant) at step of PAIRING device. (applet still alive).

 

So my quiestion is, how to pair this remote device without "assistant", and make it available as "normal" keyboard/mouse? [device is OK, it works with Fedora on my laptop and Android]

Link to comment
Share on other sites

- Check your adapter is enabled by "hcitool dev" (if not, you may need "hciconfig up", or "rfkill unblock all", but this is probably not the problem if you can use "hcitool scan).

 

- Try "bluetoothctl"

   * it should annuounce [new] controller ... (or you have a problem and should se in the logs ...)

   * discoverable on

   * pairable on

   * scan on

   * try to force a connection attempt with device (switch on, pair button, l2ping <dev addr>) until you get a message of your device with its bt-address

   * trusted <bt-address>

   * connect <bt-address>

Link to comment
Share on other sites

- Check your adapter is enabled by "hcitool dev" (if not, you may need "hciconfig up", or "rfkill unblock all", but this is probably not the problem if you can use "hcitool scan).

 

- Try "bluetoothctl"

   * it should annuounce [new] controller ... (or you have a problem and should se in the logs ...)

   * discoverable on

   * pairable on

   * scan on

   * try to force a connection attempt with device (switch on, pair button, l2ping <dev addr>) until you get a message of your device with its bt-address

   * trusted <bt-address>

   * connect <bt-address>

 

also "* pair <bt-address>", but all of "enabling commands" and "trust/pair/force connection" commands should not be necessary. The most usefull is "trust".

Link to comment
Share on other sites

OK, did as Instructed:

 

oot@orangepipcplus:~# bluetoothctl
[NEW] Controller 00:15:83:3D:0A:57 orangepipcplus [default]
[NEW] Device DC:2C:26:AF:B2:9E Bluetooth Wireless Keyboard
[bluetooth]# disco
disconnect    discoverable  
[bluetooth]# discoverable on
Changing discoverable on succeeded
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:15:83:3D:0A:57 Discovering: yes
[CHG] Device DC:2C:26:AF:B2:9E LegacyPairing: yes
[CHG] Device DC:2C:26:AF:B2:9E RSSI: -77
[bluetooth]# trusted DC:2C:26:AF:B2:9E
Invalid command
[bluetooth]# trust DC:2C:26:AF:B2:9E
Changing DC:2C:26:AF:B2:9E trust succeeded
[bluetooth]# connect DC:2C:26:AF:B2:9E
Attempting to connect to DC:2C:26:AF:B2:9E
[CHG] Device DC:2C:26:AF:B2:9E Connected: yes
[CHG] Device DC:2C:26:AF:B2:9E Modalias: usb:v0A5Cp8502d011B
[CHG] Device DC:2C:26:AF:B2:9E UUIDs:
        00001124-0000-1000-8000-00805f9b34fb
        00001200-0000-1000-8000-00805f9b34fb
Connection successful
[bluetooth]#
 

eventually inserting "pair DC:2C:26:AF:B2:9E" before "connect"

 

Now, DEVICE looks paired / connected (LED on keyboard / LED on adapter flashing on keypress/mouse move),

BUT cursor on HDMI display does NOT move.

And I got (2x) GUI window "Enter PIN", but pressing keys on BT keyboard had no effect.

 

Same after "Windoze method" -> reboot.

I got same GUI for some time...

 

What am I missing?

[what to look in logs for?]

Is there a method to enter PIN from SSH? (as normally I got GUI (on laptop) with "press PIN on device" (or something like), then enter PIN+ENTER and it worked)

Link to comment
Share on other sites

try to launch : /usr/share/doc/bluez-tests/examples/monitor-bluetooth

 

I never tried  to use a keyboard ...

 

I presume that the keyboad auto-connect the profile when powered on, GUI intercept device base-band connection event and launch an agent to pair (although it is already paired) and if you respond to the agent it reset the connection.

 

Type help in "bluetoothctl", you will see an "agent" command but I never used it. (remove device to start from beginning)

 

WTF ? Probably that it uses 3 state machines (one in the kernel, one in bluetoothd, one in GUI), as if 3 persons where trying to drive your car ...

 

If I understand your problem, it is how to enable a keyboard in GUI with no keyboard to answer stupid questions ? Perhaps by connecting first time with "ssh -Y" from another X11 host ?

 

You could perhaps try in /etc/bluetooth/input.conf if "UserspaceHID=true" helps ...

Link to comment
Share on other sites

After few reboots (I hate this "Win$hit way") now it sometimes (only) starts GUI.

 

But how to find out if connection is secure (encrypted)?

In /var/lib/bluetooth I see nothing like "keys"? (from Fedora)

 

If you type : "hcitool con", I think you should see a line about the asynchronous base logical channel (ACL) with "MASTER AUTH ENCRYPT" when the higher level profile is connected. (In BR/EDR mode - don't know what is possible and reported with BTLE)

 

Your keys should be in /var/lib/bluetooth/<controler address>/<device address>/info (At least in version 5.37 of bluez - all in ever moving with bluez ...)

 

Or you can try to capture with "hcidump" (but probably need an apt-get install)  during connect phase and search for "Link Key Request" (and reply) in HCI events (those are communication between host and controller : auth or encrypt are handled by hardware)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines