Linux bluetooth гарнитура микрофон

Настройка bluetooth стерео-наушников в Ubuntu Linux (8.04 & 7.10)

Привет!
Решил написать небольшую инструкцию, чтобы помочь нуждающимся в настройке bluetooth-наушников под Linux. Описанный способ гарантированно работает в Ubuntu 7.10 и 8.04. В других системах не должно возникнуть особых проблем, если имеются все необходимые компоненты (bluez, alsa, python).

В прошлом году я купил себе bluetooth стерео-наушники (+гарнитура) Plantronics 590A. Отличные наушники — хорошее качество звука и полная свобода от проводов. После перехода с Windows XP на Ubuntu возник вопрос использования наушников, как в качестве обычных наушников для вывода звука, так и полноценной гарнитуры для общения в играх и в Skype.

Хотя стандартный bluetooth-менеджер Ubuntu, вроде как, подразумевает использование Audio Service для соответствующих bt-устройств, но я не смог быстро найти внятную инструкцию, как же организовать вывод звука на наушники.

Вскоре мне на глаза попалась замечательная программа BlueMan bluetooth manager (screenshots). Эта программа достойна отдельной статьи, так как у неё очень много возможностей и она очень облегчает жизнь любому, кому потребуется работа с различными устройствами через протокол bluetooth. Программа работает «поверх» стандартного Ubuntu-овского bt-стека bluez и практически не тянет за собой зависимостей (программа написана на python`e).
Перечислять все возможности программы я не стану, ограничусь только тем, что программа поддерживает bt-устройства с профилем A2DP

Всё что необходимо сделать в BlueMan — «спарить» ваши bt-наушники с программой. После «спаринга» я дополнительно активировал в параметрах программы использование службы звука.

В настройках службы звука я активировал использовал служб Headset, Sink, Control для своих наушников. Для обычного вывода звука вполне достаточно службы Headset. Остальные службы присутствуют, я так думаю, для поддержки работы bt-профиля AVRCP. Я не проверял работу профиля ни в одной программе в Ubuntu, так что о его работоспособности сказать ничего не могу.

Последним шагом необходимо подправить файлик

/.asoundrc. Я не большой коппенгаген в конфигурационном файле ALSA, все правки были подсмотрены из статей:

  1. http://alfa2linux.blogspot.com/2008/03/my-jabra-finally-working-with-bluez.html
  2. http://wiki.bluez.org/wiki/HOWTO/AudioDevices

Я не ставил никаких дополнительных пакетов, которые были упомянуты в статьях — bluetooth-alsa, btsco и др.

В файл .asoundrc я добавил такие строки:

Источник

Arch Linux

You are not logged in.

#1 2016-03-10 17:40:59

How do I get a bluetooth headset with microphone to work ?

Currently, Arch Linux supports the A2DP profile (Audio Sink) for remote audio playback with the default installation.

And I can listen to audio without too much of a problem but I can’t figure out how to use the microphone as an audio source.

As far as I can tell, I need the «HSP/HFP» profile and that seems to only be available with the combination of PulseAudio and Bluez4.

The problem I have is that I need BTLE for the development work I am doing and that is only available with Bluez5.

I don’t know why the telephony profile was dropped in Bluez5 but there must have been a massive reason to drop support completely :-/

Does the latest and greatest PulseAudio and Bluez5 out of the AUR do it? Is there another module/package/product that can be added to enable it?

Is there any reasonable way to get a Bluetooth headset microphone working together with Bluez5 ?

Doing it the Linux way since 1997 and Arch way since 2015 (and loving it!)
Platforms: Intel, ARMv6 (Raspberry Pi), ARMv7 (BeagleBone Black)
Languages: C, C++, ASM, Pascal & Java

Читайте также:  Не устанавливается nvidia geforce experience для windows 10 64 bit

#2 2017-02-18 11:17:39

Re: How do I get a bluetooth headset with microphone to work ?

I have now analysed my problem a bit more and have found out some interesting details about PulseAudio and my headset, even though I still can’t get it to work

PulseAudio >= 6.0 supports Bluetooth Headset Profile

HSP/HFP are 2 distinct profiles, PulseAudio doesn’t natively support the Bluetooth Handsfree Profile

HFP support should be available by using oFono

HSP and HFP are currently mutually exclusive in PulseAudio

It still doesn’t work as a headset

The developers reintroduced support for bluetooth headsets in PulseAudio 6.0, Arch is currently at 10.0 (see: PulseAudio 6.0 Release Notes).

Now looking at my system I thought that is great news, there must be something that I missed.

$ pacmd list-cards
3 card(s) available.
index: 0
.
index: 1
.
index: 2
name:
driver:
owner module: 26
properties:
device.description = «H800 Logitech Headset»
device.string = «00:0D:44:DE:0B:1F»
device.api = «bluez»
device.class = «sound»
device.bus = «bluetooth»
device.form_factor = «headset»
bluez.path = «/org/bluez/hci0/dev_00_0D_44_DE_0B_1F»
bluez.class = «0x240404»
bluez.alias = «H800 Logitech Headset»
device.icon_name = «audio-headset-bluetooth»
device.intended_roles = «phone»
profiles:
a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: unknown)
headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: no )
off: Off (priority 0, available: yes)
active profile:
sinks:
bluez_sink.00_0D_44_DE_0B_1F.a2dp_sink/#2: H800 Logitech Headset
sources:
bluez_sink.00_0D_44_DE_0B_1F.a2dp_sink.monitor/#3: Monitor of H800 Logitech Headset
ports:
headset-output: Headset (priority 0, latency offset 0 usec, available: unknown)
properties:

headset-input: Headset (priority 0, latency offset 0 usec, available: no)
properties:

So my headset is being detected but the HSP/HFP is not available??

I checked out the bluetooth information to see if everything is right there:

$ bluetoothctl
[NEW] Controller 00:15:00:EC:B4:35 turbine [default]
[NEW] Device 00:0D:44:DE:0B:1F H800 Logitech Headset
[NEW] Device F0:65:DD:A4:34:3F HP Bluetooth Mouse X4000b
[H800 Logitech Headset]# info 00:0D:44:DE:0B:1F
Device 00:0D:44:DE:0B:1F
Name: H800 Logitech Headset
Alias: H800 Logitech Headset
Class: 0x240404
Icon: audio-card
Paired: yes
Trusted: no
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
[H800 Logitech Headset]#

There it is, Handsfree, so why isn’t it working.

I have now found out that the «HSP/HFP profile» is not one profile but actually they are actually two profiles:

HSP — Headset Protocol (UUID=00001108-0000-1000-8000-00805F9B34FB)

HFP — Handsfree Protocol (UUID=0000111E-0000-1000-8000-00805F9B34FB)

That is the core problem with my headset, PulseAudio only added HSP support and my headset only provides Handsfree.

Now that I know the problem the question is how can I get it to work?

Going back to the PulseAudio 6 release notes I now read (und understood) this:

BlueZ 5 native HSP (headset) support

BlueZ 5 HFP (hands-free) profile support via oFono

Notes for Packagers

When building PulseAudio, it’s possible to choose between «native» and «ofono» BlueZ 5 headset backends. They can be both enabled, but only one can be used at runtime. If you only need to support a bluetooth audio stack with oFono, then it’s advisable to disable the native backend when building PulseAudio. Similarly, if you don’t need to support oFono, then it’s best to disable the oFono backend. If you need to support both alternatives, then you have to enable both. The runtime decision which to use is done via the «headset» argument of module-bluetooth-discover.

The native HSP backend for BlueZ 5 depends on libbluetooth. It’s a header dependency only, so the actual library doesn’t need to be present at runtime.

The oFono HFP backend for BlueZ 5 naturally introduces a runtime dependency on oFono. The minimum supported oFono version is 1.13.

Читайте также:  Application data windows 10 где находится

Good news, oFono 1.19 is available in the AUR (the page says 1.18-1 but the build currently delivers 1.19-1).

oFono built and installed, ofono.service enabled and started but still no success.

The journal shows that it is registering the HFP profile:

Feb 18 10:53:14 turbine ofonod[803]: plugins/hfp_hf_bluez5.c:connect_handler() Registering External Profile handler .
Feb 18 10:53:14 turbine ofonod[803]: plugins/bluez5.c:bt_register_profile() Bluetooth: Registering 0000111e-0000-1000-8000-00805f9b34fb (hfp_hf) profile

I then rebuilt pulseaudio with the abs and adding «—enable-bluez5-ofono-headset» to the configure call but it still doesn’t work.

PulseAudio depends on BlueZ for all Bluetooth functionality, and additionally oFono is required for HFP support.

HFP

PulseAudio supports HFP only in the hands-free unit role (opposite to the situation with HSP), so PulseAudio can connect to a mobile phone, but not to headsets and other hands-free devices. With the «Headset Audio Gateway (HSP/HFP)» card profile selected, PulseAudio will create a sink and a source that applications can use to play back and record audio — or more commonly, the bluetooth sink and source will be connected with module-loopback to speakers and a microphone device. Note that the «Headset Audio Gateway (HSP/HFP)» card profile is typically automatically activated by module-bluetooth-policy when the phone initiates audio streaming.

As mentioned in the HSP section, support for HFP and HSP are currently mutually exclusive. HFP support is enabled by passing argument «headset=ofono» to module-bluetooth-discover in /etc/pulse/default.pa.

The audio gateway role will hopefully be supported too in the future, as well as simultaneous support for HSP and HFP. Simon Fels has done some work on both of these things: https://github.com/morphis/pulseaudio/c … r-bt-fixes. Those patches have not yet been submitted to upstream, however.

James Bottomley submitted different patches for supporting HFP headsets, which don’t use oFono: https://www.mail-archive.com/pulseaudio … 16443.html. The patches need some work, but nothing has happened for a long time. Someone else could relatively easily finish off the work — just read the review discussion, and address the points raised.

I don’t have/need another headset so I added the above «headset=ofono» option and . I still can’t get it to work.

Doing it the Linux way since 1997 and Arch way since 2015 (and loving it!)
Platforms: Intel, ARMv6 (Raspberry Pi), ARMv7 (BeagleBone Black)
Languages: C, C++, ASM, Pascal & Java

Источник

PulseAudio + Bluetooth-наушники: не используется микрофон

Lenovo V510, Calculate Linux, PulseAudio, JBL E45BT. При Bluetooth-подключении (профиль «Гарнитура HSP/HFP») микрофон не воспринимается, т.е. Audacity не начинает запись вовсе — не просто тишина, а линия времени не удлиняется.

Что делать? Спасибо.

Обматерить поттеринга с его пульсаудио и авторов bluez заодно. Блюпуп-наушники в линуксе работают как попало.

Потом выложи выхлоп pactl list sources

Уже много раз обсуждали. Значит твоя гарнитура поддерживает только один из профилей (hsp или hpf, я забыл какой именно). А pulseaudio на данный момент поддерживает только другой из них.

Самый лёгкий способ — сменить наушники (если есть возможность в магазине проверить). Либо искать костыльные решения (не знаю, насколько они работоспособны, у меня в своё время получилось завести, но очень коряво).

Хотя конкретно твоя модель, если верить офсайту, поддерживает и hsp, и hfp. По логике должна работать.

pavucontrol что показывает? Ты в нём переключаешь на hsp/hfp?

Проверить что микрофон точно работает.

Покрутить всё что можно при включении соответствующего профиля в pavucontrol.

96%, что вопрос решится.

Ну и да, что-то такое, надеюсь, у тебя уже установлено pulseaudio-bluetooth.

Читайте также:  Qemu linux установить windows

А вообще, гуглить. Проблема стара как мир, никто и не собирается её нормально решать в ближайшее время. Кучи инструкций и доков в Сети.

Микрофон работает: при использовании с Windows. Со смартфоном. В pavucontrol «Гарнитура HSP/HFP».

А где смотреть ошибки в данном случае?

В pavucontrol «Гарнитура HSP/HFP».

А где смотреть ошибки в данном случае?

Для начала посмотри, что на вкладке Input devices.

Завтра сделаю скриншоты, но, как я уже сказал, в устройствах ввода наушники есть (вместе с качелькой уровня усиления, но без индикации уровня входящего звука), а во вкладке «Конфигурация» режим «Гарнитура HSP/HFP».

А ты поставил это устройство как устройство по умолчанию?

Да. Для верности даже, в последствии отключил все остальные устройства вообще.

А в других приложениях, кроме audacity, проверял? Желательно тех, у кого нативная поддержка pulseaudio (если правильно помню, в audacity только через маршрутизацию в alsa).

Нет, только ещё в Скайпе. Спасибо, погуглю, посмотрю.

Что-то я ничего не добился.

Учитывая, что у меня еще шум вместо звука с микрофона ноутбука, то решил попытаться перейти на Alsa.

В дополнение к моему комментарию. Документация ещё говорит, что ofono добавляет в pulseaudio поддержку HFP, но как-то у меня оно не добавило. Т.е. профиль так и остался недоступен, хотя пульса ofono вроде как признала.

UPD: а нет, шума с микрофона ноутбука нет.

Думаю проблема в том, что он цепляет не тот профиль. У меня такая же проблема, но я забил, т.к. микрофон на компе не особо нужен, а с телефоном оно работает.

О, спасибо, а я оригинальные пытался портировать. Может с этими более удачно выйдет. Возможно, что надо «headset» option of module-bluetooth-discover подправить. Эффектом от патча должно быть «available: yes» в выводе (при подключенном устройстве):

Напротив headset_head_unit: (или аналогичное название).

надо «headset» option of module-bluetooth-discover подправить

А это как сделать? 🙂

Кстати, у меня там были ошибки в /var/log/messages , которых, кажется, раньше не было… Кажется, kernel: Bluetooth: unknown opcode .

А не подскажите, как/где смотреть более подробный логи bluetoothd и bluealsa?

P.S. А еще не подскажите, где в коде поменять написание версии ( pulseaudio —version )? Чтобы мне понимать, что патчи точно применились…

Та у меня 9.0, т.е. это бэкпорт и оригиналы мне и нужны. Я думал, что патчи старее. Может поэтому с трудом накладывается.

как/где смотреть более подробный логи bluetoothd и bluealsa?

Если запускать руками в консоли, то bluealsa всё туда и выводит. bluetoothd надо для этого передать -nd . Я так делал.

Найти строчку с module-bluetooth-discover в /etc/pulse/defaults.pa и дописать headset=native в конец. Хотя, может оно и не надо, вроде патчи меняют значение этой опции по умолчанию.

kernel: Bluetooth: unknown opcode

У меня hci0: hardware error какой-то есть, но я игнорирую.

где в коде поменять написание версии

Вообще оно там генерируется (в configure.ac прописан вызов git-version-gen ), но можно попробовать в src/pulse/version.h после конфигурирования.

как/где смотреть более подробный логи bluetoothd и bluealsa ?

Если запускать руками в консоли, то bluealsa всё туда и выводит. bluetoothd надо для этого передать -nd . Я так делал.

Ой, имел ввиду PulseAudio, а не Bluealsa 🙂 Ну оно log-level в /etc/pulse/daemon.conf .

Эх, так ничего и не вышло…

Ну, A2DP работает, как и раньше. Но не HSP, HFP…

  1. Без патча, headset=native .
  2. Без патча, headset=ofono .
  3. С патчем.
  4. С патчем, headset=ofono .
  5. С патчем, headset=native .
  6. С патчем, отключенным при компиляции ofono, headset=native . Это добавляет режим Headset (HFP) . При подключении — ошибка (полный лог):

Источник

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