I want to “power on” the bluetooth interface when the Ubuntu Core boot up. I tried the https://wiki.archlinux.org/index.php/bluetooth “auto power-on after boot” tutorial but it not worked. What I have to do? The command “sudo hciconfig hci0 up” worked fine, but I want to do this automatically.
I am working with: - RaspberryPi 3 - Ubuntu Core 16 - USB Dongle Bluetooth CSR 4.0
I think in Ubuntu Core this is done via systemd service units. Try this:
Create a script file in ~/bin/blueup.sh and put the following script in that file:
#!/bin/bash
#blueup
sudo hciconfig hci0 up
Create a Systemd service unit file in /etc/systemd/system/bluetooth-interface.service and put the following script into that file (replace <username.> with your username):
# bluetooth-interface.service
[Unit]
Description= Powers on the bluetooth interface
Documentation= https://forum.snapcraft.io/t/power-on-bluetooth-in-ubuntu-core-when-boot/7751/2
[Service]
Type= simple
User= <username>
ExecStart= /home/<username>/bin/blueup.sh
ExecStop= /bin/kill -2 $MAINPID
[Install]
WantedBy= multi-user.target
Enable a unit to be started on bootup and Start immediately:
Also, I have a question for the more initiated.
How would I go about snapping this or similar systemd unit together with the relevant bash scripts? Do tools like hciconfig or bluez have to be included also?