Code Monkey home page Code Monkey logo

balena-pulseaudio's People

Contributors

janvda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

balena-pulseaudio's Issues

can't set card profile of bluetooth device to a2dp_sink

This problem is currently seen on my branch no_alpine_pulseaudio_image

The commands:

root@ba7c427:/# pactl list cards
xcb_connection_has_error() returned true
Card #0
        Name: bluez_card.A0_E9_DB_09_CF_FF
        Driver: module-bluez5-device.c
        Owner Module: 28
        Properties:
                device.description = "GEAR4 SPW"
                device.string = "A0:E9:DB:09:CF:FF"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "headset"
                bluez.path = "/org/bluez/hci0/dev_A0_E9_DB_09_CF_FF"
                bluez.class = "0x240404"
                bluez.alias = "GEAR4 SPW"
                device.icon_name = "audio-headset-bluetooth"
                device.intended_roles = "phone"
        Profiles:
                headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 30, available: yes)
                a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 40, available: no)
                off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
        Active Profile: headset_head_unit
        Ports:
                headset-output: Headset (priority: 0, latency offset: 0 usec)
                        Part of profile(s): headset_head_unit, a2dp_sink
                headset-input: Headset (priority: 0, latency offset: 0 usec)
                        Part of profile(s): headset_head_unit
root@ba7c427:/# pactl set-card-profile 0 a2dp_sink
xcb_connection_has_error() returned true
Failure: Input/Output error
root@ba7c427:/# 

The following is seen in the log file:

02.09.19 08:30:59 (+0200)  pulseaudio-server  I: [pulseaudio] protocol-native.c: Application "pactl" requests card profile change. card = bluez_card.A0_E9_DB_09_CF_FF, profile = a2dp_sink
02.09.19 08:30:59 (+0200)  pulseaudio-server  W: [pulseaudio] module-bluez5-device.c: Refused to switch profile to a2dp_sink: Not connected
02.09.19 08:30:59 (+0200)  pulseaudio-server  I: [pulseaudio] client.c: Freed 8 "pactl"
02.09.19 08:30:59 (+0200)  pulseaudio-server  I: [pulseaudio] protocol-native.c: Connection died.

bluetooth speaker is humming at low volume.

Today I connected to my gear4 bluetooth speaker with profile headset_head_unit and it is constantly humming at low volume.

The humming stopped when issueing the command: pactl set-card-profile 0 off

disconnect bluetooth device is not working

Today I had the problem that I couldn't disconnect the bluetooth device using `bluetoothctl``

[GEAR4 SPW]# disconnect
Attempting to disconnect from A0:E9:DB:09:CF:FF
[GEAR4 SPW]# info 
Device A0:E9:DB:09:CF:FF (public)
        Name: GEAR4 SPW
        Alias: GEAR4 SPW
        Class: 0x00240404
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
[GEAR4 SPW]# 

Create a pulseaudio client test service

This service is a pulseaudio client application that is used to test / demonstrate the functionality of the pulseaudio-server service.

This application allows to run a number of test scenarios. The actual test scenario to execute can be specified by setting the device service variable test_id.

test_id =

  • 0 or not set then it will just print all the sinks and sources and ...
  • 1 : play an audio file
  • 2 : record an audio and play recorded audio file

auto reconnect bluetooth devices

The goal is to automatically connect to specific bluetooth devices instead of manually having to enter the command in connect <mac address> in bluetoothctlsession.

pulseaudio-server is logging mount errors before starting pulseaudio

This error happened in branch no_alpine_pulseaudio_image

The following is logged

02.09.19 08:46:37 (+0200) Supervisor starting
02.09.19 08:46:27 (+0200)  pulseaudio-server  mount: /tmp/tmpmount: permission denied.
02.09.19 08:46:27 (+0200)  pulseaudio-server  mount: /tmp/tmpmount/shm: permission denied.
02.09.19 08:46:27 (+0200)  pulseaudio-server  mount: /tmp/tmpmount/mqueue: permission denied.
02.09.19 08:46:27 (+0200)  pulseaudio-server  mount: /tmp/tmpmount/pts: permission denied.
02.09.19 08:46:27 (+0200)  pulseaudio-server  mount: /tmp/tmpmount/console: mount point is not a directory.
02.09.19 08:46:27 (+0200)  pulseaudio-server  umount: /dev: must be superuser to unmount.
02.09.19 08:46:27 (+0200)  pulseaudio-server  mount: /dev: permission denied.
02.09.19 08:46:27 (+0200)  pulseaudio-server  mount: /sys/kernel/debug: permission denied.
02.09.19 08:46:27 (+0200)  pulseaudio-server  starting pulseaudio ...

pavucontrol X Window System error "The error was 'BadIDChoice (invalid resource ID chosen for this connection)'"

After the upgrade to balena host os version 2.43.0+rev1: the service pulseaudio-client-tcp reported the following error for test_id = 3 (= pavucontrol)

05.10.19 17:01:28 (+0200)  pulseaudio-client-tcp  launching pavucontrol ...
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp  
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp  (pavucontrol:24): Gdk-ERROR **: 15:01:55.067: The program 'pavucontrol' received an X Window System error.
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp  This probably reflects a bug in the program.
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp  The error was 'BadIDChoice (invalid resource ID chosen for this connection)'.
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp    (Details: serial 24992 error_code 14 request_code 53 (core protocol) minor_code 0)
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp    (Note to programmers: normally, X errors are reported asynchronously;
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp     that is, you will receive the error a while after causing it.
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp     To debug your program, run it with the GDK_SYNCHRONIZE environment
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp     variable to change this behavior. You can then get a meaningful
05.10.19 17:01:55 (+0200)  pulseaudio-client-tcp     backtrace from your debugger if you break on the gdk_x_error() function.)
05.10.19 17:01:58 (+0200)  pulseaudio-client-tcp  ./start.sh: line 43:    24 Trace/breakpoint trap   (core dumped) DISPLAY=$remote_display pavucontrol
05.10.19 17:01:58 (+0200)  pulseaudio-client-tcp  sleeping forever ...

pulseaudio-rest-api: raises error when receiving multiple requests at the same time

[2019-10-17 17:02:22,992] ERROR in app: Exception on /server_info [GET]
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/jan/Documents/15_iot/balena/active/balena-pulseaudio/pulseaudio-rest-api/app.py", line 33, in getServerInfo
    pulsectlObject=pulse.server_info()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pulsectl/pulsectl.py", line 525, in _decorator_or_method
    return _wrapper(func_or_self, index)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pulsectl/pulsectl.py", line 512, in _wrapper
    pulse_func(self._ctx, *([index, cb, None] if index is not None else [cb, None]))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 119, in __exit__
    next(self.gen)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pulsectl/pulsectl.py", line 480, in _pulse_op_cb
    while self.connected and self._actions[act_id] is None: self._pulse_iterate()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pulsectl/pulsectl.py", line 470, in _pulse_iterate
    with self._pulse_loop() as loop: c.pa.mainloop_iterate(loop, int(block), self._ret)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pulsectl/pulsectl.py", line 454, in _pulse_loop
    'Running blocking pulse operations from pulse eventloop callbacks'
pulsectl.pulsectl.PulseError: Running blocking pulse operations from pulse eventloop callbacks or other threads while loop is running is not supported by this python module. Supporting this would require threads or proper asyncio/twisted-like async code. Workaround can be to stop the loop (raise PulseLoopStop in callback or event_loop_stop() from another thread), doing whatever pulse calls synchronously and then resuming event_listen() loop.
127.0.0.1 - - [17/Oct/2019 17:02:22] "GET /sink_list HTTP/1.1" 200 -

pulseaudio-server service is not automatically recognizing all connected audio sources/sinks

Although module module-udev-detectis loaded at startup only the raspberry audio jack is recognized as sink.

The connected USB microphone and the hdmi audio are not automatically recognized by the pulseaudio-service although they are properly configured as alsa device as can be checked by executing command aplay -l and arecord -l in an pulseaudio-serverterminal window as you can see below.

bash-5.0# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/7
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
bash-5.0# arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: CameraB409241 [USB Camera-B4.09.24.1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

buetoothctl : Failed to connect: org.bluez.Error.NotReady

I tried to manually connect to my bluetooth speaker by means of the pulseaudio-server terminal window but I got the error Failed to connect: org.bluez.Error.NotReady.

Here below the full log:

[bluetooth]# info A0:E9:DB:09:CF:FF
Device A0:E9:DB:09:CF:FF (public)
        Name: GEAR4 SPW
        Alias: GEAR4 SPW
        Class: 0x00240404
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: no
        LegacyPairing: no
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
[bluetooth]# connect A0:E9:DB:09:CF:FF
Attempting to connect to A0:E9:DB:09:CF:FF
Failed to connect: org.bluez.Error.NotReady
[bluetooth]# 

bluetoothctl info command doesn't show device name

Within bluetoothctl session (running in a balena terminal window for the pulseaudio-server service): using the command info <mac address> gives information on the bluetooth device, but it doesn't show the device name - instead it shows again its MAC address.

Strange enough when successfully connecting/pairing/trusting the device, from then onwards (also after reboot of balena device) the info command is always correctly showing the device name.

The below log file shows both an example of a device for which info didn't return a name and one for which info did return a name.

root@ba7c427:/# bluetoothctl
Agent registered
[NEW] Device 7F:36:E3:B5:C6:A6 7F-36-E3-B5-C6-A6
[bluetooth]# scan off
Failed to stop discovery: org.bluez.Error.Failed
[CHG] Device 00:1A:22:0F:07:67 RSSI: -86
[bluetooth]# devices
Device 71:6F:23:53:51:43 71-6F-23-53-51-43
Device 58:FF:EB:97:37:C8 58-FF-EB-97-37-C8
Device 43:3F:2B:61:1E:38 43-3F-2B-61-1E-38
Device D0:58:C7:3A:D3:41 D0-58-C7-3A-D3-41
Device 64:D7:5F:A1:F1:82 64-D7-5F-A1-F1-82
Device 70:C6:D0:A7:67:50 70-C6-D0-A7-67-50
Device 62:5D:CD:CB:AA:1B 62-5D-CD-CB-AA-1B
Device 4C:3E:7D:97:41:9C 4C-3E-7D-97-41-9C
Device 77:33:9E:DA:D4:76 77-33-9E-DA-D4-76
Device 42:11:53:8F:EB:3A 42-11-53-8F-EB-3A
Device 57:92:5E:A4:9F:B3 57-92-5E-A4-9F-B3
Device 7F:96:F1:2C:65:0A 7F-96-F1-2C-65-0A
Device 6B:9A:59:6C:F7:7B 6B-9A-59-6C-F7-7B
Device 5D:B1:7E:24:24:6F 5D-B1-7E-24-24-6F
Device 75:C8:98:AE:DD:D9 75-C8-98-AE-DD-D9
Device 7B:DE:E0:D4:F7:EE 7B-DE-E0-D4-F7-EE
Device 40:B2:B9:B2:0D:1B 40-B2-B9-B2-0D-1B
Device 56:C5:83:2C:F9:93 56-C5-83-2C-F9-93
Device 72:5E:21:EF:4E:19 72-5E-21-EF-4E-19
Device 00:80:25:C9:33:53 ASG_BLE 33
Device 71:1F:71:78:CB:B4 71-1F-71-78-CB-B4
Device 42:86:C7:E5:FA:0F 42-86-C7-E5-FA-0F
Device 60:BA:E0:7E:DA:51 60-BA-E0-7E-DA-51
Device 63:9A:A5:01:AA:3D 63-9A-A5-01-AA-3D
Device 7A:FF:F6:B3:6F:8D 7A-FF-F6-B3-6F-8D
Device 7F:25:91:0F:8D:50 7F-25-91-0F-8D-50
Device 5A:E7:A9:C0:18:80 5A-E7-A9-C0-18-80
Device 4E:EB:71:C6:2D:A1 4E-EB-71-C6-2D-A1
Device 60:23:E6:CD:AF:1B 60-23-E6-CD-AF-1B
Device 76:9C:51:B2:24:FF 76-9C-51-B2-24-FF
Device 4B:5C:93:FF:82:7C 4B-5C-93-FF-82-7C
Device 7C:7A:53:88:59:A5 7C-7A-53-88-59-A5
Device 6D:78:40:A8:CE:94 6D-78-40-A8-CE-94
Device 44:1D:51:95:86:B6 44-1D-51-95-86-B6
Device 62:9B:0C:1A:48:8C 62-9B-0C-1A-48-8C
Device 71:41:AB:0D:E8:E0 71-41-AB-0D-E8-E0
Device 5A:DD:F9:55:D9:7D 5A-DD-F9-55-D9-7D
Device 7D:84:11:D9:06:7F 7D-84-11-D9-06-7F
Device 62:B1:34:57:A3:27 62-B1-34-57-A3-27
Device 64:4B:AF:B7:67:53 64-4B-AF-B7-67-53
Device 4C:CD:F6:F5:1F:8E 4C-CD-F6-F5-1F-8E
Device 45:1C:64:67:02:F1 45-1C-64-67-02-F1
Device 00:80:25:1C:43:12 SMA001d SN: 2100453275 SN2100453275
Device 4B:E0:81:32:C7:86 4B-E0-81-32-C7-86
Device 00:1A:22:0F:07:67 CC-RT-BLE
Device A0:E9:DB:09:CF:FF GEAR4 SPW
Device F0:18:98:39:D5:C4 Jan’s MacBook Pro
Device 8C:DE:52:B4:EA:40 SRS-X11
Device 7F:36:E3:B5:C6:A6 7F-36-E3-B5-C6-A6
[bluetooth]# info  4B:E0:81:32:C7:86
Device 4B:E0:81:32:C7:86 (random)
        Alias: 4B-E0-81-32-C7-86
        Paired: no
        Trusted: no
        Blocked: no
        Connected: no
        LegacyPairing: no
        RSSI: -85
        AdvertisingFlags:
  02                                               .               
[CHG] Device 00:1A:22:0F:07:67 RSSI: -69
[NEW] Device 7F:09:35:97:89:00 7F-09-35-97-89-00
[NEW] Device 5A:B5:D2:54:40:9D 5A-B5-D2-54-40-9D
[CHG] Device 00:1A:22:0F:07:67 RSSI: -85
[bluetooth]# info 8C:DE:52:B4:EA:40
Device 8C:DE:52:B4:EA:40 (public)
        Name: SRS-X11
        Alias: SRS-X11
        Class: 0x00240414
        Icon: audio-card
        Paired: yes
        Trusted: no
        Blocked: no
        Connected: no
        LegacyPairing: no
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: bluetooth:v0039p13BFd2103
[NEW] Device 79:D0:BD:29:05:A9 79-D0-BD-29-05-A9
[bluetooth]# 

mqtt interface providing similar functionality as pavucontrol

The goal is to provide an mqtt interface that allows to do and see the same things as pavucontrol.

This includes the following features:

  1. Regarding input devices (audio capture devices)
    1. List input devices
    2. Specify active one
    3. Specify volume
    4. mute
    5. show current volume real-time
  2. Regarding output devices (playback devices)
    The same as for the input devices
  3. Regarding playback
  4. Regarding recording
  5. Regarding configuration

Raspberry pi headphone jack no longer recognized with BalenaOS 2.41.0+rev3

see forum topic: Raspberry pi headphone jack no longer works with latest OS

I have just upgraded my device to production balenaOS 2.41.0+rev3 on my raspberry pi and I can no longer play audio through the headphone jack.

The following command lists all alsa playback devices on my raspberry pi.

bash-5.0# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi [vc4-hdmi], device 0: MAI PCM vc4-hdmi-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
bash-5.0# 

When I executed the same command on another rapsberry pi 3 running development balenaOS 2.38.0+rev1 I get the following:

root@70c82e027ec4:/# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/7
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@70c82e027ec4:/# 

I am not specialist but it looks like the raspberry pi audio driver has changed when upgrading the OS and I don't know how I can play now audio through the headphone jack.

"xcb_connection_has_error() returned true" and it takes minutes to respond on commands

It is not clear what happened but since yesterday the application is almost unusable. Restarting/rebooting/purging/switching off bluetooth devices/disconnecting USB devices/ ... didn't make a difference.

Most pulseaudio commands (e.g. pactl list short) take minutes before they respond - even the aplay -l takes a very long time.

The first thing logged after minutes by the command is always the following message

xcb_connection_has_error() returned true

Here an extract of the aplay -l launched in the pulseaudio-server service.
So it took minutes bertween logging the line **** List of PLAY...and the next line = xcb_connection_has_error()...

root@ba7c427:/# aplay -l
**** List of PLAYBACK Hardware Devices ****
xcb_connection_has_error() returned true
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 6/7
  Subdevice #0: subdevice #0
...

another example (there were also minutes before launching the command the line xcb_connection_has_error() returned true is logged).

root@ba7c427:/# pactl info
xcb_connection_has_error() returned true
Server String: /tmp/pulse-mq2nofTFQMjS/native
Library Protocol Version: 32
Server Protocol Version: 32
Is Local: yes
Client Index: 8
Tile Size: 65496
User Name: root
Host Name: ba7c427
Server Name: pulseaudio
Server Version: 12.2
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.default
Default Source: alsa_input.hw_1_0
Cookie: 1446:fb41
root@ba7c427:/# 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.