I have got a Raspberry Pi4 last week and setup Lakka. I also purchased a DualShock 4 wireless controller. It is not PS4/Xbox, but I was able to pair and connect it. My trouble is that everytime I reboot the Pi, I have to SSH into it to repair and connect the controller. I was looking information on this and I know that after every reboot, the controller is not paired with the Pi, even though it is trusted. So I have to manually pair it, every time, and then connect it. I have also tried to create a simple script where it automatically pairs and connects with the controller.
Here is the script;
echo -e 'pair <Controller MAC>\nconnect <Controller MAC>' | bluetoothctl
I tested this and it works My problem is, is trying to get this to run whenever the Pi boots. Again doing my homework online, I have to create a .service in the /etc/systemd/system directory. But I am falling at the hurdle of creating the system directory as it says it is read-only. I don’t understand this as I have logged into the terminal as root user and the permissions is 644 and the owner is root.
Is there something I am missing or is there any other way that I can get my simple script to run at startup?