pali / hsphfpd-prototype

Prototype of Bluetooth HSP/HFP daemon
135 stars 16 forks source link

audio_client.pl could not started (ubuntu server 18.04) #5

Closed smikesmike closed 4 years ago

smikesmike commented 4 years ago

Hi,

I try to setup a minimal server system using bluetooth. I've taken Ubuntu Server 18.04 LTS and installed the following packages:

sudo apt-get install libnet-dbus-perl bluetooth blueman bluez bluez-tools rfkill
sudo apt install openjdk-8-jre-headless

Now, I am able to pair a bluetooth device via bluetoothctl and register it as Headset device via hsphfpd.

But now I am not able to register an audio application:

marc@btserver1804:~/pocs/hsphfpd-prototype$ ./audio_client.pl
Registering application failed: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.46" (uid=1000 pid=3826 comm="/usr/bin/perl ./audio_client.pl " label="unconfined") interface="org.hsphfpd.ApplicationManager" member="RegisterApplication" error name="(unset)" requested_reply="0" destination="org.hsphfpd" (uid=0 pid=3820 comm="/usr/bin/perl ./hsphfpd.pl " label="unconfined")

Do you have an idea, what is going wrong here?

BR Marc

pali commented 4 years ago

Have you installed dbus config file?

smikesmike commented 4 years ago

Yes. Otherwise hsphfpd wouldn't start correctly.

smikesmike commented 4 years ago

Ah, ok got it. I have to join the group bluetooth. Looks like that the policy:

  <policy at_console="true">
    <allow send_destination="org.hsphfpd"/>
  </policy>

doesn't work properly.

BR Marc

pali commented 4 years ago

Ah, I think answer is on these lines: https://github.com/pali/hsphfpd-prototype/blob/prototype/org.hsphfpd.conf#L12-L17

Your marc needs to be either in bluetooth group or match dbus at_console policy.

Basically dbus daemon does not allow for your user to use audio_client.pl script.

smikesmike commented 4 years ago

BTW: Are "blueman bluez bluez-tools" required for a minimal installation?

pali commented 4 years ago

Looks like that at_console dbus option is deprecated and maybe on your system is already removed/non-working.

pali commented 4 years ago

only /usr/sbin/bluetoothd daemon is required (I do not know in which package it is)

but beware that for bluetooth pairing or connecting you need some other tool. Basically those tools use just /usr/sbin/bluetoothd dbus API, so technically you could do all that stuff also via dbus-send.