-
Notifications
You must be signed in to change notification settings - Fork 205
Add tutorial: setting-up Bluetooth - PulseAudio #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
271d3ff
50787e9
e18a9f1
5565cd7
ef8c418
7a9d658
658a202
9e7d34e
7376b2b
3087253
ac0439b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| --- | ||
| title: Setting Up Bluetooth audio with PulseAudio - A2DP only | ||
| subject: Bluetooth | ||
| --- | ||
|
|
||
| ### Overview | ||
| Debian jessie is using BlueZ 5 and PluseAudio 5, which are fairly new. | ||
| There were major breaking changes in these versions. | ||
| Most stuff you find on the Internet will be for BlueZ 4 and PulseAudio 4, | ||
| so watch out, those configurations may not work. | ||
|
|
||
| [PulseAudio 5 only supports the A2DP profile and not Headset profile (HSP) or Hands-free profile (HFP)](http://www.freedesktop.org/wiki/Software/PulseAudio/Notes/5.0/), | ||
| although it is under development see [note 2]. | ||
|
|
||
| The A2DP profile supports: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should say that running PulseAudio provides these two profiles and that the device we are connecting to needs to have at least one of these profiles. |
||
| `UUID: Audio Source` | ||
| `UUID: Audio Sink` | ||
|
|
||
| ### How to get PulseAudio working with Bluetooth | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please put blank line after all heading lines.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| **This should all be done as root** | ||
|
|
||
| 1. Install pulseaudio: | ||
| apt-get install --no-install-recommends pulseaudio pulseaudio-module-bluetooth | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, you need a blank line between the line that starts with |
||
|
|
||
| 2. Create a systemd service for running pulseaudio as the pulse user. | ||
| Save the following lines as `/etc/systemd/system/pulseaudio.service` | ||
| [Unit] | ||
| Description=Pulse Audio | ||
| [Service] | ||
| Type=simple | ||
| ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disable-shm | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need blank lines before and after the "code"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That indeed helps a lot, thanks |
||
| and reload systemd with `systemctl daemon-reload` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indenting this 4 spaces will keep it as part of the |
||
|
|
||
| 3. Give the `pulse` user permission to use Bluetooth. | ||
| Save [this file: pulseaudio-bluetooth.conf](https://gist.github.com/dlech/7e9d28bccac9632cbc50#file-pulseaudio-bluetooth-conf) to `/etc/dbus-1/system.d/pulseaudio-bluetooth.conf` | ||
|
|
||
| 4. Paste the following lines to the **end** of `/etc/pulse/system.pa`: | ||
| ### Automatically load driver modules for Bluetooth hardware | ||
| .ifexists module-bluetooth-policy.so | ||
| load-module module-bluetooth-policy | ||
| .endif | ||
| .ifexists module-bluetooth-discover.so | ||
| load-module module-bluetooth-discover | ||
| .endif | ||
|
|
||
| 5. Start the systemd service: `systemctl start pulseaudio.service` | ||
|
|
||
| 6. Run `bluetoothctl` to connect the device. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of this can be done in brickman now, so we don't need the bit about |
||
| You only need to do the pairing stuff once. | ||
| Be sure to substitute the address of the actual device your are connecting to. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In brickman, we see the name of the device, so we don't have to worry about the address.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hihi :-) |
||
| Here are the commands: | ||
| agent on | ||
| default-agent | ||
| scan on | ||
| pair 11:11:11:11:11:11 | ||
| trust 11:11:11:11:11:11 | ||
| connect 11:11:11:11:11:11 | ||
|
|
||
| 7. Now, you should be able to play sound from a remote device on your EV3 without any further configuration. | ||
|
|
||
| 8. To play sound from the EV3 on a remote device, there are a few more steps. | ||
| * add `root` and your own non-root user(s) to the `audio` and `pulse-access` groups: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather not encourage people to be using the root user. Let's just say add "add your user".
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs blank line between |
||
| usermod -a -G pulse-access,audio root | ||
| usermod -a -G pulse-access,audio myuser | ||
| * Run `pactl list cards`. | ||
| The end of the output should look something like this: | ||
|
|
||
| ``` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indent, not code fence. |
||
| Card #1 | ||
| Name: bluez_card.00_17_E7_BD_1C_8E | ||
| Driver: module-bluez5-device.c | ||
| Owner Module: 14 | ||
| Properties: | ||
| device.description = "BlueZ 5.23" | ||
| device.string = "00:17:E7:BD:1C:8E" | ||
| device.api = "bluez" | ||
| device.class = "sound" | ||
| device.bus = "bluetooth" | ||
| bluez.path = "/org/bluez/hci0/dev_00_17_E7_BD_1C_8E" | ||
| bluez.class = "0x0c0000" | ||
| bluez.alias = "BlueZ 5.23" | ||
| device.icon_name = "audio-card-bluetooth" | ||
| Profiles: | ||
| a2dp_source: High Fidelity Capture (A2DP Source) (sinks: 0, sources: 1, priority: 10, available: yes) | ||
| a2dp: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes) | ||
| off: Off (sinks: 0, sources: 0, priority: 0, available: yes) | ||
| Active Profile: a2dp | ||
| Ports: | ||
| unknown-output: Bluetooth Output (priority: 0, latency offset: 0 usec) | ||
| Part of profile(s): a2dp | ||
| unknown-input: Bluetooth Input (priority: 0, latency offset: 0 usec) | ||
| Part of profile(s): a2dp_source | ||
| ``` | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indent this paragraph 4 spaces to prevent numbering from restarting. |
||
| The active profile probably doesn't say `a2dp`, although in the output above it already has been set. | ||
| So set it by running: `pactl set-card-profile 1 a2dp` | ||
| The "1" in this command is the number of the BT card from the output above. | ||
|
|
||
| 9. Now you can play sound using paplay. | ||
| Example: `paplay -d bluez_sink.00_17_E7_BD_1C_8E /usr/share/sounds/alsa/Front_Center.wav` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put the command on its own line and indented so that it displays as a larger code block.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and blanks lines before and after. |
||
| Possibly error messages like `xcb_connection_has_error() returned true` have been seen and not explained. | ||
| There seems to be no ill effect on BT audio. | ||
| Using my simple non-root user I get: | ||
| Failed to create secure directory (/run/user/0/pulse): Permission denied | ||
| but playback **does** work. | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| [note 1]: http://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=4ff9b99292eca193dc0c149722328cb0b1ab0818 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are not notes, they are just links. |
||
| [note 2]: http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=1f0de01bfc85f92785fcd2f0e863e471af7e6ace | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| title: Setting Up Bluetooth keyboard | ||
| subject: Bluetooth | ||
| --- | ||
|
|
||
| ### Needs to be created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of trailing spaces to prevent line breaks. This applies to the whole file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On some places it's a matter of taste, but you are right. will do.