[pulseaudio-discuss] Issues with Python Bluetooth sockets

Matthias Mirbeth matthias.mirbeth at expleogroup.com
Fri Oct 25 12:31:21 UTC 2019


Hi,

I'm currently trying simulate a SCO connection for the bluetooth module of pulseaudio, without any BT device connected.
Therefore I have recreated a part of ofonos DBus API in Python. The DBus communication is working and I can pass a file descriptor to pulseaudio as return value of "Acquire".
But I still have some issues with the setup of the bluetooth socket.

I create the socket like:
self.soc = socket.socket(socket.AF_BLUETOOTH,
                                                           socket.SOCK_SEQPACKET | socket.SOCK_CLOEXEC | socket.SOCK_NONBLOCK,
                                                           socket.BTPROTO_SCO) #These params are taken from ofono
self.soc.bind(self.address)
fd = self.soc.fileno() #fd will be sent to Pulseaudio

But then calling accept() or connect() on the socket (in my script) will result in an Error.
Only when i don't set the socket to non-blocking, connect() does not throw an error, but it blocks endlessly.

>From Pulseaudio I the following Log messages:

without calling connect():
319 D: [bluetooth] module-bluez5-device.c: Stream properly set up, we're ready to roll! (libpulsecommon-12.0.so(pa_log_levelv_meta+0x8b7) [0x7f915c40cf67])
320 E: [bluetooth] module-bluez5-device.c: Failed to write data to SCO socket: Transport endpoint is not connected (libpulsecommon-12.0.so(pa_log_levelv_meta+0x8b7) [0x7f915c40cf67])
321 D: [bluetooth] module-bluez5-device.c: IO thread failed (libpulsecommon-12.0.so(pa_log_levelv_meta+0x8b7) [0x7f915c40cf67])

or
306 D: [bluetooth] module-bluez5-device.c: Stream properly set up, we're ready to roll! (libpulsecommon-12.0.so(pa_log_levelv_meta+0x8b7) [0x7f5d8303ff67])
307 I: [bluetooth] module-bluez5-device.c: FD error: POLLHUP  (libpulsecommon-12.0.so(pa_log_levelv_meta+0x8b7) [0x7f5d8303ff67])
308 D: [pulseaudio] sink.c: bluez_sink.B8_27_EB_FF_15_F9.headset_head_unit: state: INIT -> IDLE (libpulsecommon-12.0.so(pa_log_levelv_meta+0x8b7) [0x7f5d8303ff67])
309 D: [bluetooth] module-bluez5-device.c: Audio stream torn down (libpulsecommon-12.0.so(pa_log_levelv_meta+0x8b7) [0x7f5d8303ff67])
when my program is stuck in socket.connect()

I have also tried to use a BluetoothSocket from PyBluez with similar results.
Can someone please help me to set the socket up properly?

Best regards
Matthias Mirbeth

Mit freundlichen Grüßen * Best regards

Matthias Mirbeth
Bachelorand
T. +49 (0)841 88390-5169
Expleo Germany GmbH * Despagstraße 4 * 85055 Ingolstadt * Germany

[cid:image001.png at 01D58B40.037B2EB0]

expleogroup.com<http://www.expleogroup.com/>

Assystem Technologies ist jetzt Expleo

_____________________________________________________________________________________

Expleo Germany GmbH
Sitz der Gesellschaft | Corporate Headquarters: München
Handelsregister | Commercial Register: Amtsgericht München HRB 83252
Geschäftsführung | Management: Ralph Gillessen, Josef Mitterhuber

This message contains information that may be privileged or confidential. It is intended only for the person to whom it is addressed.
If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof.
If you receive this message in error, please notify the sender immediately and delete all copies of this message.
_________________________________________________________

EMAIL LEGAL MENTION / DISCLAIMER

This message contains information that may be privileged or confidential and is the property of the Expleo Services SAS, RCS Versailles 831 178 348, located, 3 avenue des Prés, 78180 Montigny Le Bretonneux - France. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

Ce message contient des informations qui peuvent être privilégiées ou confidentielles et elles sont de la propriété d'Expleo Services SAS, RCS Versailles 831 178 348, situé, 3 avenue des Prés, 78180 Montigny le Bretonneux-France. Il est destiné uniquement à la personne à qui est adressé. Si vous n'êtes pas le destinataire visé, vous n'êtes pas autorisé à lire, imprimer, conserver, copier, diffuser, distribuer ou utiliser ce message ou toute partie de celui-ci. Si vous recevez ce message par erreur, veuillez en avertir immédiatement l'expéditeur et supprimer toutes les copies de ce message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20191025/54805d60/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5713 bytes
Desc: image001.png
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20191025/54805d60/attachment-0001.png>


More information about the pulseaudio-discuss mailing list