-
Notifications
You must be signed in to change notification settings - Fork 65
Setting up Headunit Desktop on embedded systems
Viktor Verebelyi edited this page Apr 12, 2022
·
14 revisions
The following guide is mainly targeted at Raspberry Pi OS Lite, but most of these steps are applicable to most Linux systems one-way or another
/lib/systemd/system/dbus-launch.service
[Unit]
Description=D-Bus daemon launch service
After=bluetooth.target
[Service]
Type=simple
ExecStartPre=mkdir -p /run/user/1000
ExecStartPre=chown pi:pi /run/user/1000
ExecStart=sudo -u pi dbus-daemon --session --nofork --address=unix:path=/run/user/1000/user_bus_socket --systemd-activation
Restart=always
RestartSec=0
[Install]
WantedBy=multi-user.target
/lib/systemd/system/pulseaudio.service
[Unit]
Description=PulseAudio Sound System
Before=sound.target
[Service]
Type=idle
# ExecStart=/usr/bin/pulseaudio -v
ExecStart=/usr/bin/pulseaudio
User=pi
Group=pi
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
/lib/systemd/system/obex.service
[Unit]
Description=Bluetooth OBEX service
After=dbus-launch.service
[Service]
Type=idle
User=pi
Group=pi
BusName=org.bluez.obex
Environment=DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/user_bus_socket" XDG_RUNTIME_DIR=/run/user/1000
ExecStart=/usr/lib/bluetooth/obexd -d -n
[Install]
Alias=dbus-org.bluez.obex.service
WantedBy=multi-user.target
/lib/systemd/system/headunit.service
[Unit]
Description=Viktorgino's Headunit Desktop Service
After=local-fs.target
[Service]
Type=idle
User=pi
Group=pi
Environment="QT_QPA_PLATFORM=eglfs"
Environment="QT_QPA_EGLFS_ALWAYS_SET_MODE=1"
Environment="QT_QPA_EGLFS_KMS_ATOMIC=1"
Environment=DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/user_bus_socket"
WorkingDirectory=/home/pi/hud
ExecStart=/home/pi/hud/headunit-app
Restart=always
[Install]
WantedBy=sysinit.target
sudo systemctl enable headunit.service dbus-launch.service pulseaudio.service obex.service
/etc/dbus-1/system.d/headunit.conf
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy group="bluetooth">
<allow own="org.ofono"/>
<allow send_destination="org.ofono"/>
<allow send_interface="org.ofono.SimToolkitAgent"/>
<allow send_interface="org.ofono.PushNotificationAgent"/>
<allow send_interface="org.ofono.SmartMessagingAgent"/>
<allow send_interface="org.ofono.PositioningRequestAgent"/>
<allow send_interface="org.ofono.HandsfreeAudioAgent"/>
<allow send_interface="org.ofono.NetworkMonitorAgent"/>
</policy>
<policy group="bluetooth">
<allow own="org.bluez"/>
<allow send_destination="org.bluez"/>
<allow send_interface="org.bluez.Agent1"/>
<allow send_interface="org.bluez.MediaEndpoint1"/>
<allow send_interface="org.bluez.MediaPlayer1"/>
<allow send_interface="org.bluez.Profile1"/>
<allow send_interface="org.bluez.GattCharacteristic1"/>
<allow send_interface="org.bluez.GattDescriptor1"/>
<allow send_interface="org.bluez.LEAdvertisement1"/>
<allow send_interface="org.freedesktop.DBus.ObjectManager"/>
<allow send_interface="org.freedesktop.DBus.Properties"/>
</policy>
<policy user="bluetooth">
<allow own="org.bluez.obex"/>
<allow send_destination="org.bluez.obex"/>
<allow send_interface="org.bluez.obex"/>
<allow send_interface="org.bluez.obex.Agent1"/>
<allow send_interface="org.bluez.obex.Client1"/>
<allow send_interface="org.bluez.obex.Session1"/>
<allow send_interface="org.bluez.obex.Transfer1"/>
<allow send_interface="org.bluez.obex.ObjectPush1"/>
<allow send_interface="org.bluez.obex.FileTransfer1"/>
<allow send_interface="org.bluez.obex.PhonebookAccess1"/>
<allow send_interface="org.bluez.obex.Synchronization1"/>
<allow send_interface="org.bluez.obex.MessageAccess1"/>
<allow send_interface="org.bluez.obex.Message1"/>
</policy>
</busconfig>
/etc/udev/rules.d/99-headunit.rules
SUBSYSTEM=="backlight", RUN+="/bin/chmod 0666 /sys/class/backlight/%k/brightness /sys/class/backlight/%k/bl_power"
SUBSYSTEM=="usb" GROUP="plugdev", MODE="0660"
Comment out the dtparam=audio=on
with a #
and add the overlay for the choice of your DAC (refer to their respective manuals)
amixer sset 'Master' 50%