site  contact  subhomenews

Success sending a file from PC to phone

October 22, 2020 — BarryK

There has been discussion on the forum about this not working in Easy Dunfell:

https://easyos.org/forum/showthread.php?tid=190

I found out why it was failing: the 'obexd' daemon, in the bluez package, must be running. Which can be done:

# /usr/libexec/bluetooth/obexd

There should have been a script in /etc/init.d to start it. I wondered why the bluez5 package did not install such a script, and found a patch for OE to do that:

https://www.openembedded.org/pipermail/openembedded-core/2015-May/222919.html

...odd, it isn't in the latest bluez5 recipe in OE Dunfell release.

11pm, want to relax in front of the TV for awhile, will look at this again tomorrow. Well no, visiting relatives tomorrow, but will get onto it in the afternoon. Good that there is progress.

EDIT 2020-10-23:
Got it figured out! The above link has a patch to create /etc/init.d/bluez-obexd, to explicitly start 'obexd' at bootup. However, from online reading I got to understand that it is supposed to start automatically, via dbus.

This was not happening. When ran 'bluetooth-sendto' to send a file to my phone, got this error message:

# bluetooth-sendto
Acquiring proxy failed: Error calling StartServiceByName for org.bluez.obex: Failed to execute program org.bluez.obex: No such file or directory

I got a hint how to fix it here:

https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-wireless/bluez/files/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch?revision=1.1&view=markup

So much online information is about systemd, it is becoming increasingly difficult to find out to configure without systemd. Anyway, the solution is two files:

/etc/dbus-1/system.d/obexd.conf
/usr/share/dbus-1/services/org.bluez.obex.service

obex.conf:

<!-- This configuration file specifies the required security policies
for Obex core daemon to work. -->

<!DOCTYPE busconfig PUBLIC "-//freedesktop/DTD D-BUS Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.bluez.obex"/>
<allow send_destination="org.bluez.obex"/>
<allow send_interface="org.bluez.obex"/>
</policy>
</busconfig>

org.bluez.obex.service:

[D-BUS Service]
Name=org.bluez.obex
Exec=/usr/sbin/obexd
SystemdService=dbus-org.bluez.obex.service

Note, 'obexd' is actually at /usr/libexec/bluetooth/obexd, and /usr/sbin/obexd is a symlink to it. The actual location of 'obexd' differ on other distros.

Now, 'bluetooth-sendto' automatically starts 'obexd' -- actually, I think that it is 'bluetoothd' that starts 'obexd' -- whatever, it now starts and file transfer successful. Expect fix in 0.94 coming soon.   

Tags: easy