Usb bluetooth linux driver

Подключаем Bluetooth устройства к Linux

В данной публикации я расскажу о своем опыте подключения USB Bluetooth стика к серверу на Linux. Основная мысль «поспешишь-людей насмешишь». Работы было на 2 строки в терминале, но я ее превратил в незабываемый квест.

Translation to English is here . Также основной канал в telegram .

В первой части этой «трилогии» я рассказал про USB стик, ссылку на данную статью можно найти ниже:

Я думал, что смогу просто подключить стик в сервер и все чудесным образом заработает, но ничего не произошло. Причин этому было много, и неверная интеграция, и отсутствие необходимого ПО на сервере.

Во-первых, я установил стик в сервер. Далее я выполнил команду ls /dev/

Я не увидел ничего особенного в списке устройств, а также извлечение стика из сервера не давало никакой разницы. Ок, я начал свои поиски и набрел на команду lsusb . Результатом ее выполнения стал список устройств, среди которых был мой Bluetooth

Второй волшебной командой стала usb-devices

Результатом второй команды стала полная информация о стике. Ок, значит стик в системе, но что с этой информацией делать — непонятно.

Вначале я нарвался на 2 интеграции в Home Assistant: Bluetooth LE Tracker и Bluetooth Tracker . Но позже нашлось то, что мне было действительно нужно Xiaomi Mijia BLE Temperature and Humidity Sensor . Не смотря на то, что интеграция у меня не заработала и пользоваться ей я так и не стал, в ее описании есть важные слова, которые я сразу не заметил:

Preferred solution: Install the bluepy and btlewrap library (via pip). When using a virtual environment, make sure to use install the library in the right one.

Fallback solution: Install btlewrap library (via pip) and gatttool via your package manager. Depending on the distribution, the package name might be: bluez, bluetooth or bluez-deprecated.

Если бы я обратил внимание на это, то все бы заработало на пару часов раньше. Я же пошел ложным путем, перемотав страницы в самый конец — настроил конфиг в HA и ничего не заработало. Я начал читать с пункта Configuration.

Читайте также:  Генератор помех блютуз своими руками

Нужно выполнить команду sudo hcitool lescan или команду bluetoothctl в зависимости от конфигурации используемой ОС. В результате получим MAC адрес нашего термометра. Но я знал MAC адрес термометра и не выполнил эти пункты, зря.

Уже попозже, когда я немного подкрепился, я начал искать проблемы. Наконец я додумался почитать описание интеграции, но почему-то начать читать с первой строчки мне в голову не пришло. Я все же выполнил команды и получил отрицательный ответ на каждую:

Наконец я начал думать, а как вообще работает bluetooth в Linux? Я в процессе чтения нашел сайт , где описано как происходит настройка bluetooth. Вот цитата:

Устройства Bluetooth встречаются довольно часто в наше время. Это простой и дешевый способ добавить поддержку беспроводных технологий для смартфона или любого другого гаджета. Система Linux может использовать различные протоколы: OBEX, A2DP, DUN, HID и другие для взаимодействия с различными устройствами.

Большинство Bluetooth адаптеров выполнены в виде USB и могут быть настроены с помощью утилит HCL. Некоторые устройства, такие как Atheros, требуют для своей работы установленных прошивок в системе.

Далее приводились команды:
sudo apt-get install bluetooth bluez bluez-tools rfkill rfcomm и sudo service bluetooth start. Если бы я прочитал описание к интеграции, то сразу бы и установил все как следует. Т.к. на приставке я пока работаю из под root, то моя команда выгледела так: apt-get install bluetooth bluez bluez-tools. О пакетах rfkill и rfcomm мой сервер ничего не знал. Пакеты установились

Источник

Bluetooth: Using USB bluetooth adapters

The default Linux Debian distribution has the Bluetooth driver already installed so plugging a Bluetooth USB adapter and typing dmesg you will obtain the following messages:

debarm:~# dmesg . usb 1-1: new full speed USB device using at91_ohci and address 2 Bluetooth: Core ver 2.15 NET: Registered protocol family 31 Bluetooth: HCI device and connection manager initialized Bluetooth: HCI socket layer initialized Bluetooth: Generic Bluetooth USB driver ver 0.6 usbcore: registered new interface driver btusb debarm:~# lsusb Bus 002 Device 002: ID 1131:1004 Integrated System Solution Corp. Bluetooth Device Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub debarm:~#

Install Bluez

Bluez is the Official Linux Bluetooth protocol stack (http://www.bluez.org/) and you need to install it to do any further action with Bluetooth. This stack is available as standard Debian package with the name bluez-utils so to install it simply type:

debarm:~# apt-get update . debarm:~# apt-get install bluez .
debarm:~# dmesg . Bluetooth: L2CAP ver 2.15 Bluetooth: L2CAP socket layer initialized Bluetooth: RFCOMM TTY layer initialized Bluetooth: RFCOMM socket layer initialized Bluetooth: RFCOMM ver 1.11 Bluetooth: BNEP (Ethernet Emulation) ver 1.3 Bridge firewalling registered Bluetooth: SCO (Voice Link) ver 0.6 Bluetooth: SCO socket layer initialized

Discover the Bluetooth devices in range

Turn on you mobile phone and enable on it the Bluetooth features.

Читайте также:  Bluetooth phone and mac

On the FOX command line type hcitool scan to discover the Bluetooth devices visible from your board:

debarm:~# hcitool scan Scanning . 00:25:48:FC:98:6D Sergio

On this list Sergio is my own mobile phone name and 00:25:48:FC:98:6D is its Bluetooth unique address (learn more about hcitool. ).

Let’s try to check which services are available on my mobile phone typing:

debarm:~# sdptool search OPUSH 00:25:48:FC:98:6D Inquiring . Searching for OPUSH on 00:25:48:FC:98:6D . Service Name: OBEX Object Push Service RecHandle: 0x1000a Service Class ID List: "OBEX Object Push" (0x1105) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 6 "OBEX" (0x0008) Language Base Attr List: code_ISO639: 0x454e encoding: 0x6a base_offset: 0x100 Profile Descriptor List: "OBEX Object Push" (0x1105) Version: 0x0100

OBEX is the first service we’ll use to do the first experiment and it is on the Channel 6.

OBEX (abbreviation of OBject EXchange) is a communications protocol that facilitates the exchange of binary objects between devices. OpenOBEX, an open source implementation of the OBEX protocol, is used on the Debian Linux distribution.

Send an image to your mobile phone

Let’s try to use OBEX to send an image to our Bluetooth mobile phone.

Download on your FOX this image:

wget http://terzo.acmesystems.it/download/examples/tuxcase.jpg --2010-08-20 13:55:19-- http://terzo.acmesystems.it/download/examples/tuxcase.jpg Resolving www.acmesystems.it. 78.47.10.198 Connecting to terzo.acmesystems.it|78.47.10.198|:80. connected. HTTP request sent, awaiting response. 200 OK Length: 4710 (4.6K) [image/jpeg] Saving to: `tuxcase.jpg' 100%[======================================>] 4,710 --.-K/s in 0.07s 2010-08-20 13:55:20 (69.0 KB/s) - `tuxcase.jpg' saved [4710/4710] debarm:~#

Now install ObexFtp an utility to transfer files using the OBEX protocol (learn mode about ObexFtp. ).

debarm:~# apt-get install obexftp .

then send the Tux to your mobile phone typing:

debarm:~# obexftp --nopath --noconn --uuid none --bluetooth 00:25:48:FC:98:6D --channel 6 -p tuxcase.jpg Suppressing FBS. Connecting..\done Tried to connect for 628ms Sending "tuxcase.jpg". |done Disconnecting../done

Enable the Linux Kernel Bluetooth support on Aria G25

$ make ARCH=arm menuconfig [*] Networking support ---> Bluetooth subsystem support ---> --- Bluetooth subsystem support [*] L2CAP protocol support [ ] SCO links support (NEW) RFCOMM protocol support [ ] RFCOMM TTY support (NEW) < >BNEP protocol support (NEW) < >HIDP protocol support (NEW) Bluetooth device drivers ---> HCI USB driver < >HCI SDIO driver HCI UART driver [ ] UART (H4) protocol support (NEW) [ ] BCSP protocol support (NEW) [ ] Atheros AR300x serial support (NEW) [ ] HCILL protocol support (NEW) < >HCI BCM203x USB driver (NEW) < >HCI BPA10x USB driver (NEW) < >HCI BlueFRITZ! USB driver (NEW) < >HCI VHCI (Virtual HCI device) driver (NEW) < >Marvell Bluetooth driver support (NEW) < >Atheros firmware download driver (NEW)

Источник

Читайте также:  Sony ericsson гарнитура bluetooth mw600

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Linux Driver for USB Bluetooth 5.0 ORICO BTA-508 Adapter

mkopa/Linux-Driver-USB-Bluetooth-5.0-ORICO-BTA-508

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Linux Driver for USB Bluetooth 5.0 ORICO BTA-508 Adapter

cd ~/Downloads/ && wget https://mpow.s3-us-west-1.amazonaws.com/mpow_BH519A_driver+for+Linux.7z \ sudo apt-get install -y p7zip-full && D=/lib/firmware;N=rtl8761;G=config;E=.bin \ 7z x ./mpow_BH519A_driver+for+Linux.7z;cd 202*/rtkbt-firmware/$D/rtlbt;S=sudo;D=$D/rtl_bt/$N \ for C in a_ b_;do for L in fw $G;do F=$D$C$L$E;[ -f $F ]&&$S cp $F`date +%s`>;$S cp -f $N$C$L $F;done;done \ cd ~/Downloads/ && rm -r 20201202_LINUX_BT_DRIVER/

About

Linux Driver for USB Bluetooth 5.0 ORICO BTA-508 Adapter

Источник

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