laurentppol Posted November 29, 2016 Posted November 29, 2016 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]
arox Posted November 30, 2016 Posted November 30, 2016 - 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>
arox Posted November 30, 2016 Posted November 30, 2016 - 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".
laurentppol Posted November 30, 2016 Author Posted November 30, 2016 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]# discodisconnect discoverable [bluetooth]# discoverable onChanging discoverable on succeeded[bluetooth]# pairable onChanging pairable on succeeded[bluetooth]# scan onDiscovery 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:9EInvalid command[bluetooth]# trust DC:2C:26:AF:B2:9EChanging DC:2C:26:AF:B2:9E trust succeeded[bluetooth]# connect DC:2C:26:AF:B2:9EAttempting 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-00805f9b34fbConnection 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)
laurentppol Posted November 30, 2016 Author Posted November 30, 2016 EDIT: after switching OFF/ON the DEVICE, GUI window appears once again. Mouse / keyboard WORKS. BUT if I enter any "PIN" in window it STOPS working. If I simply CLOSE the "PIN window" it works. WTF?
arox Posted November 30, 2016 Posted November 30, 2016 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 ...
laurentppol Posted December 20, 2016 Author Posted December 20, 2016 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)
arox Posted December 20, 2016 Posted December 20, 2016 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)
laurentppol Posted December 21, 2016 Author Posted December 21, 2016 THX, got it root@orangepipcplus:/sys/class# hcitool conConnections: > ACL DC:2C:26:AF:B2:9E handle 42 state 1 lm MASTER AUTH ENCRYPT
laurentppol Posted August 27, 2017 Author Posted August 27, 2017 On 21.12.2016 at 9:25 PM, laurentppol said: Just for others, tested pairing with something that requires PIN (keyboard): https://stackoverflow.com/a/41520644 Tested on Fedora, not yet tested on OrangePi as connecting Bluetooth adapter seems cause kernel panic...(after some time).
Recommended Posts