- madkoding / pair-dual-boot-bluetooth.md
- Bluetooth mouse and keyboard
- 8.10 and newer
- 7.10 and 8.04
- Older Ubuntu versions
- 6.10, 7.04
- Ubuntu Versions Older than 6.10
- Connect the device
- Bluetooth keyboard
- Pairing process
- Troubleshooting
- Bluetooth controller does not show up in lsusb
- Bluetooth controller is not visible in bluetoothctl
- Bluetooth keyboard still does not work
- Error: hci0 ACL packet for unknown connection handle 4
- Xorg
- Подключение bluetooth клавиатуры linux
- Bluetooth интерфейс
- Поиск bluetooth клавиатуры
- Сопряжение bluetooth клавиатуры
madkoding / pair-dual-boot-bluetooth.md
6) In the chntpw raised console, enter in the bluetooth registry keys list like this:
cd \ControlSet001\Services\BTHPORT\Parameters\Keys
7) run ls command to show you a Unique id lists
(. )\Services\BTHPORT\Parameters\Keys> ls Node has 1 subkeys and 0 values key name
Like this one equivalent to 00:F4:8D:9E:41:AA
8) Enter in each Unique id folder to search for your MAC address of your bluetooth device in each value name
(. )\Services\BTHPORT\Parameters\Keys> cd 00f48d9e41aa (. )\BTHPORT\Parameters\Keys\00f48d9e41aa> ls Node has 0 subkeys and 3 values size type value name [value if type DWORD] 16 3 REG_BINARY
9) Get the hex code (that we will call friendly: the pairing key ) from the keyboard MAC address value
(. )\BTHPORT\Parameters\Keys\00f48d9e41aa> hex 34885dd82480 Value of type REG_BINARY (3), data length 16 [0x10] :00000 BE 7F B1 99 23 29 D5 B2 6A E2 F6 96 2E FD 16 8A . #)..j.
10) So. we will copy the pairing key that use Wintendo to pair your device: BE7FB1992329D5B26AE2F6962EFD168A We will use this pairing key to make Linux pair our keyboard, without re-pairing again. We will use now de Unique Id , the MAC Address and edit this file in your Linux drive:
sudo nano /var/lib/bluetooth/[Unique ID]/[Mac Address]/info
sudo nano /var/lib/bluetooth/00\:F4\:8D\:9E\:41\:AA/34\:88\:5d\:d8\:24\:80/info
11) In the info file go to the [LinkKey] section and replace the Key value with the pairing key
Key=BE7FB1992329D5B26AE2F6962EFD168A
12) Save and restart the bluetooth service in Linux and you are ready to go
sudo service bluetooth restart
Bluetooth mouse and keyboard
Many people have reported problems with connecting a Bluetooth mouse or keyboard and making it stay connected. There is an easy solution to this problem. You only have to do this once, and the mouse will connect automatically when you turn it on, or it resumes from power savings.
8.10 and newer
Beginning with Ubuntu Hardy, X uses Input Hotplug for automatically configuring input devices.
7.10 and 8.04
- Go to System > Preferences > Bluetooth or right-click on the Bluetooth applet and choose Preferences.
- Under «Mode of operation» choose «Visible and connectable for other devices»
- Change to the Services tab, there will be a list of Available services. On that list, click once on Input service.
- Put your input device in «pair» or «connect» mode. This is usually done with a physical button on or under the device.
- In the Input Devices section, click «Add». A new window will appear with the input devices visible (in this example, a mouse).
- Mouse: Click on the mouse to choose it and click «Connect». A confirmation message will appear and the device should be connected.
- Keyboard: Click on the keyboard to choose it and click «Connect». It will prompt you to enter a password. Enter any password in the dialog, e.g. «1234», and then enter the exact same password on the keyboard, followed by Enter, and the device should be connected.
There is no need to modify any configuration files manually when using Ubuntu 7.10 or Ubuntu 8.04.
Older Ubuntu versions
6.10, 7.04
- Edit the file /etc/default/bluetooth: sudo sensible-editor /etc/default/bluetooth
- Set the variable HIDD_ENABLED=1.
- Restart the bluetooth service with the command: sudo /etc/init.d/bluetooth restart
Ubuntu Versions Older than 6.10
- sudo apt-get install bluez-utils
- Edit the file /etc/default/bluez-utils: sudo sensible-editor /etc/default/bluez-utils
- Set the variable HIDD_ENABLED=1.
- Restart the bluetooth service with the command: sudo /etc/init.d/bluez-utils restart
Connect the device
Now let’s connect the device:
Retry this command until the device connects. You may have to turn it off and on or press the reset/connect button a couple of times. The steps to do this may vary from one device to the other.
Once the address is known, type:
sudo hidd --connect deviceaddr
Where deviceaddr is the address of your mouse, for example 00:01:02:03:04:05
Now the mouse should reconnect once you turn it on, even if you reboot. Some people experience that using the hcitools for anything might create some fuzz with the hidd tool.
Bluetooth keyboard
This article describes how to set up a Bluetooth HID keyboard with Arch Linux, bluez version 5.
Pairing process
This article or section is a candidate for merging with Bluetooth.
Notes: Pairing process, and some troubleshooting related to it, are redundant with general device setup on Bluetooth page, and should be merged there. Keyboard-specific info would stay on this page. (Discuss in Talk:Bluetooth#Merging general setup from Keyboard, Mouse, Headset pages)
Login to the affected computer by a wired keyboard or by ssh.
First, make sure the local Bluetooth controller (e.g. a Bluetooth dongle the built in Bluetooth radio) is recognized:
Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. LAN9500 Ethernet 10/100 Adapter / SMSC9512/9514 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The above output is from a Raspberry-Pi revision ‘B’ with archlinux-arm and a Keysonic Bluetooth Dongle.
Three items worth remembering:
- Bluetooth devices (keyboard) and controllers (dongle) need to be paired once.
- The Bluetooth controller needs to be powered up after every boot.
- The Bluetooth controller needs to be told to connect to the keyboard after every boot.
Pairing is a one time process, required only once. There are Bluetooth keyboards sold with a Bluetooth dongle which come already paired, but that is not certain. We will use the bluetoothctl command from bluez-utils to pair our dongle and the keyboard.
Power up can be done with bluetoothctl , or automatically in /etc/bluetooth/main.conf , see below.
Same for connecting, either bluetoothctl or hcitool can be used, the latter is more useful for scripting.
We will use bluetoothctl for the pairing process. Run the command to get at the [bluetooth]# prompt.
Note: If you are on a color console: the word «bluetooth» is in the default color as long as no devices are available, and blue as soon as required devices and/or controllers have been found.
While in bluetoothctl power up the controller:
Changing power on succeeded [CHG] Controller 06:05:04:03:02:01 Powered: yes
Next, tell bluetoothctl to look only for keyboards, and make that the default agent:
[bluetooth]# agent KeyboardOnly
Default agent request successful
Next, put your controller (the local dongle) in pairable mode:
Changing pairable on succeeded
Next, put your keyboard in an active mode, where it is discoverable, i.e. pairable. Some keyboards have a special button for this on the underside, or require a special key combination to be pressed. See the documentation of your keyboard. Please note that this discoverability of a device is time limited; some devices are only visible for 30 seconds, other for 2 minutes. Your mileage may vary.
Next, let the controller scan the Bluetooth frequencies for a suitable device:
Discovery started [CHG] Controller 06:05:04:03:02:01 Discovering: yes
After a few seconds the address of the keyboard should be listed as found. This line will repeat over and over, but will not stop you from entering new commands.
Next, actually do the pairing. The address used is the Bluetooth MAC address of the keyboard:
[bluetooth]# pair 01:02:03:04:05:06
Note: Some keyboards, such as Microsoft Surface Ergonomic, will send a pass code (e.g. [agent] Passkey: 501334 ) which has to be typed in on the Bluetooth keyboard followed by the key Enter in order to pair successfully. Use paired-devices command to double check if the pairing succeeded.
Next, make this a trusted device (this allows the device to establish the connection on itself). Again, the Bluetooth MAC address is the address of the keyboard device:
[bluetooth]# trust 01:02:03:04:05:06
Next and finally connect to the device (keyboard). Again, the Bluetooth MAC address is the address of the keyboard device:
[bluetooth]# connect 01:02:03:04:05:06
Done. Leave the bluetoothctl utility:
Now the external device (i.e. keyboard) and the USB Bluetooth dongle are paired permanently, unless you break the pairing intentionally.
Troubleshooting
Bluetooth controller does not show up in lsusb
Bluetooth controller is not visible in bluetoothctl
- Check the bluetooth.service unit status.
- Check: You run the command with superuser privileges using su or sudo . Otherwise you have blue [bluetooth]# prompt and get the following message when powering on the controller:
[bluetooth]# power on No default controller available
Bluetooth keyboard still does not work
- Check: Does it have power?
- Check: Did it connect to the Bluetooth controller? If not, try with another controller or your smart phone.
Error: hci0 ACL packet for unknown connection handle 4
Xorg
Device should be added as /dev/input/event* and your Xorg should add it automatically if you did not disable such feature.
Подключение bluetooth клавиатуры linux
Для начала установим софт для работы с bluetooth под Linux:
sudo aptitude update sudo aptitude install bluetooth bluez bluez-tools bluez-utils python-gobject python-dbus
Bluetooth интерфейс
Показать все доступные bluetooth интерфейсы. Команда hciconfig аналог ifconfig, только для bluetooth.
Пример вывода (в случае если bluetooth интерфейс поднят):
hci0: Type: BR/EDR Bus: USB BD Address: 00:EE:CC:AA:10:44 ACL MTU: 1021:5 SCO MTU: 96:5 UP RUNNING PSCAN RX bytes:41239 acl:971 sco:0 events:1159 errors:0 TX bytes:12967 acl:470 sco:0 commands:289 errors:0 Features: 0xff 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF Link mode: SLAVE ACCEPT Name: 'myname-0' Class: 0x600100 Service Classes: Audio, Telephony Device Class: Computer, Uncategorized HCI Version: 4.0 (0x6) Revision: 0x500 LMP Version: 4.0 (0x6) Subversion: 0x500 Manufacturer: Intel Corp. (2)
Управление состоянием bluetooth интерыейсов.
hciconfig hci0 down hciconfig hci0 up
Убедиться в том, что нужный bluetooth поднят можно с помощью утилиты hcitool.
Если нужный bluetooth поднят, то мы должны увидеть вывод:
Devices: hci0 00:EE:CC:AA:10:44
Запомним название bluetooth интерфейса, оно нам понадобятся при подключении клавиатуры.
Поиск bluetooth клавиатуры
Нажмите кнопку «Pair» на bluetooth клавиатуре и выполните команду:
Scanning . CC:DD:AA:AA:00:11 Bluetooth Keyboard
Запомним MAC-адрес нашей клавиатуры.
Просмотр подробной информации об bluetooth устройстве.
hcitool info CC:DD:AA:AA:00:11
Пропингуем найденное устройство.
Сопряжение bluetooth клавиатуры
Для быстрого временного подключения bluetooth клавиатуры можно выполнить команду
hidd --connect CC:DD:AA:AA:00:11
после чего клавиатура сразу подключиться, в этом случае PIN код мы не задаем (после перезагрузки или перезапуске демона bluetoothd настройки не сохраняются). Данный способ категорически не рекомендую, лучше этот пункт пропустить и перейти к полноценному сопряжению.
Приступаем к сопряжению клавиатуры с bluetooth адаптером. Не забываем, bluetooth клавиатура в этот момент всё ещё должны быть в режиме поиска (сопряжения).
bluez-simple-agent hci0 CC:DD:AA:AA:00:11
При появлении сообщения запроса PIN кода
задаём любой PIN код, например 5829433212 (Не нужно вводить «0000»!).
На bluetooth клавиатуре нужно повторить ввод PIN кода и нажать Enter.
При корректном вводе PIN кода на bluetooth клавиатуре мы должны увидеть сообщение:
Добавим MAC-адрес нашей bluetooth клавиатуры в список доверенных.
bluez-test-device trusted CC:DD:AA:AA:00:11 yes
Настройки будут сохранены в каталог /var/lib/bluetooth/00:EE:CC:AA:10:44/, где 00:EE:CC:AA:10:44 это MAC-адрес bluetooth адаптера к которому мы привязываем bluetooth устройство.
hcitool cc CC:DD:AA:AA:00:11 hidd --connect CC:DD:AA:AA:00:11 hcitool auth CC:DD:AA:AA:00:11
Вывести список подключенных bluetooth устройст.
CC:DD:AA:AA:00:11 Bluetooth Keyboard [0a5c:8502] connected
Теперь наша bluetooth клавиатура уже подключена и будет автоматически подключаться при перезагрузки системы и/или включении выключении питания самой клавиатуры.
За работу bluetooth отвечает демон bluetoothd.
Для проверки корректности настроек, будет ли bluetooth клавиатура автоматически подключаться при перезагрузке перезапустим bluetoothd демон.
invoke-rc.d bluetooth restart invoke-rc.d bluetooth status
Нажмите на bluetooth клавитуре любую кнопку для инициализации bluetooth подключения. Подождите 5~10 секунд и снова выполните команду:
Мы должны увидеть сообщение:
CC:DD:AA:AA:00:11 Bluetooth Keyboard [0a5c:8502] connected
Настройка init
Настроим автоматическую загрузку демона bluetoothd на втором уровне init (Debian и Ubuntu по умолчанию запускаются на втором уровне инициализии).
sudo update-rc.d -f bluetooth remove sudo sysv-rc-conf --level 2 bluetooth on sudo sysv-rc-conf --list bluetooth