Hello Toradex community,
I have a USB-Bluetooth module embedded on my baseboard. To bring the interface from the DOWN state to the UP state I have the following systemd script:
#bluetooth-up.service
[Unit]
Description=Bluetooth hci0 up
Requires=bluetooth.target
Before=bluetooth.service
[Service]
Type=oneshot
ExecStart = /usr/bin/hciconfig hci0 up
RemainAfterExit=yes
[Install]
WantedBy=bluetooth.target
Additionally, to start the bluez dbus daemon the following is started (this is just the default bluetooth.service config file as shipped by Toradex/Angstrom):
[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)
[Service]
Type=dbus
BusName=org.bluez
ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
[Install]
WantedBy=bluetooth.target
Alias=dbus-org.bluez.service
However when my system boots I get the following:
root@colibri:~# systemctl status bluetooth -l
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2016-05-24 11:59:45 UTC; 6min ago
Docs: man:bluetoothd(8)
Main PID: 669 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
└─669 /usr/lib/bluez5/bluetooth/bluetoothd
May 24 11:59:45 colibri systemd[1]: Starting Bluetooth service...
May 24 11:59:45 colibri bluetoothd[669]: Bluetooth daemon 5.33
May 24 11:59:45 colibri systemd[1]: Started Bluetooth service.
May 24 11:59:45 colibri bluetoothd[669]: Starting SDP server
May 24 11:59:45 colibri bluetoothd[669]: Bluetooth management interface 1.4 initialized
May 24 11:59:45 colibri bluetoothd[669]: Failed to obtain handles for "Service Changed" characteristic
May 24 11:59:45 colibri bluetoothd[669]: hci0 Load Connection Parameters failed: Unknown Command (0x01)
and the Bluetooth interface is brought to DOWN state even though the bluetooth-up script previously managed to bring it up (note that bluetooth-up.service should run before bluetooth.service):
root@colibri:~# hciconfig
hci0: Type: BR/EDR Bus: USB
BD Address: 00:07:80:06:27:E3 ACL MTU: 310:10 SCO MTU: 64:8
DOWN
RX bytes:2046 acl:0 sco:0 events:124 errors:0
TX bytes:3355 acl:0 sco:0 commands:112 errors:0
My question is twofold:
- My bluetooth-up.service seems an oddly home-made solution for a rather common problem. Am I going about this the wrong way?
- Do you know why the errors above appear and do you know how to fix them?
Thank you,
Gardar