luxai-qtrobot / QA

Virtual repository for Questions & Answers system
http://luxai-qtrobot.github.io
5 stars 0 forks source link

How to connect Bluetooth mouse/keyboard to QTrobot? #15

Open apaikan opened 4 years ago

apaikan commented 4 years ago

This tutorial explain how to pair and connect a Bluetooth mouse/keyboard to QTrobot NUC pc via terminal/ssh. The same procedure works also for RPI.

Notice: for RPI you may need to run the bluetoothctl with sudo!

Step 1: ssh to QTPC

connect to the QTrobot wifi and ssh into QTPC:

$ ssh qtrobot@192.168.100.2

Step 2: launch bluetoothctl

qtrobot@QTPC:~$ bluetoothctl
[NEW] Controller F8:63:3F:40:61:B2 QTPC [default]

Step 3: turn bluetooth power on and register the agent

[bluetooth]# power on
Changing power on succeeded

[bluetooth]# agent on
Agent registered

[bluetooth]# default-agent 
Default agent request successful

Step 4: scan and pair the bluetooth device

to scan the bluettoth devices:

[bluetooth]# scan on
Discovery started
[CHG] Controller F8:63:3F:40:61:B2 Discovering: yes
[CHG] Device 17:13:00:00:8A:04 Name: Bluetooth 3.0 Keyboard
...

in my case Device 17:13:00:00:8A:04 Name: Bluetooth 3.0 Keyboard is what I am looking for. Now to pair the bluetooth device:

[bluetooth]# pair 17:13:00:00:8A:04
Attempting to pair with 17:13:00:00:8A:04
[CHG] Device 17:13:00:00:8A:04 Connected: yes
[agent] PIN code: xxxx
...
[CHG] Device 17:13:00:00:8A:04 Paired: yes
Pairing successful

Some keyboards require to type a PIN code for pairing. Just type the code using your bluetooth keyboard. You do not see anything on the terminal. The code is sent directly by your keyboard while you are typing it.

Step 5: trust and connect to the device:

trust the device:

[bluetooth]# trust 17:13:00:00:8A:04
[CHG] Device 17:13:00:00:8A:04 Trusted: yes

and finally connect to the bluettoh/keyboard mouse:

[bluetooth]# connect 17:13:00:00:8A:04
Attempting to connect to 17:13:00:00:8A:04
[CHG] Device 17:13:00:00:8A:04 Connected: yes
Connection successful