Подключить bluetooth клавиатуру ubuntu

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.

Читайте также:  Чем отличается wifi от bluetooth

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 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.

Читайте также:  Драйвера блютуз адаптера дексп ат вт401

8.10 and newer

Beginning with Ubuntu Hardy, X uses Input Hotplug for automatically configuring input devices.

7.10 and 8.04

  1. Go to System > Preferences > Bluetooth or right-click on the Bluetooth applet and choose Preferences.
  2. Under «Mode of operation» choose «Visible and connectable for other devices»
  3. Change to the Services tab, there will be a list of Available services. On that list, click once on Input service.
  4. Put your input device in «pair» or «connect» mode. This is usually done with a physical button on or under the device.
  5. In the Input Devices section, click «Add». A new window will appear with the input devices visible (in this example, a mouse).
    1. Mouse: Click on the mouse to choose it and click «Connect». A confirmation message will appear and the device should be connected.
    2. 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.

    Screenshot-CreateDevice.png

    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

    1. Edit the file /etc/default/bluetooth: sudo sensible-editor /etc/default/bluetooth
    2. Set the variable HIDD_ENABLED=1.
    3. Restart the bluetooth service with the command: sudo /etc/init.d/bluetooth restart

    Ubuntu Versions Older than 6.10

    1. sudo apt-get install bluez-utils
    2. Edit the file /etc/default/bluez-utils: sudo sensible-editor /etc/default/bluez-utils
    3. Set the variable HIDD_ENABLED=1.
    4. 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 клавиатуру ubuntu

    Для начала установим софт для работы с 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

    Источник

Оцените статью
Adblock
detector