qlcplus 20241101 img: sharing change I have done (fix a random crash issue with screen connected& working Audio Trigger)
Posted: Mon Dec 09, 2024 7:43 am
Hey,
I have spent some time this WE to fix some bugs that occurs on my PI4 with Rasberry image. (qlcplus_raspios_bookworm_20241101.7z)
1- Random issue when a screen is connected to the PI at boot
When a screen is connected via HDMI to the raspi 4 the dri card device can be either /dev/dri/card0 or /dev/dri/card1 (for me it is random after each reboot)... the original script don't update $HOME/.qlcplus/eglfs.json if the file already exist so I have modified the file /usr/sbin/qlcplus-start.sh:
from:
to:
2- Working Audio triggers
This part was a little more tricky as the main "issue" is related to QT and the way it interract with Alsa + systemctl rights + user env linked to the previous comment
I am using a simple mic usb seen by the system as :
"alsa_card.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00"
The "easy" way that works for me using a fresh install of the image :
alsamixer to set system volume of the mic device
pactl list sinks to list all devices & have a lot of info (if pulseaudio-utils is installed)
pw-record /tmp/audio.wav to test an audio record outside QLC
arecord -l to list record device
Very important : it only works with a screen attached meaning with "-platform eglfs" QLC start option, so if no screen is attached and qlc start in "-platform offscreen" the audio trigger doesn't work. I dont know why and I have tested vnc , linuxfb and so on and only eglfs works. (maybe QLC+ bug or another QT behavior ? ). Today as a workaround I will receive a simple HDMI dummy device to emulate a screen .
Hope that help
I have spent some time this WE to fix some bugs that occurs on my PI4 with Rasberry image. (qlcplus_raspios_bookworm_20241101.7z)
1- Random issue when a screen is connected to the PI at boot
When a screen is connected via HDMI to the raspi 4 the dri card device can be either /dev/dri/card0 or /dev/dri/card1 (for me it is random after each reboot)... the original script don't update $HOME/.qlcplus/eglfs.json if the file already exist so I have modified the file /usr/sbin/qlcplus-start.sh:
from:
Code: Select all
# detect DRI card
if [ ! -f $HOME/.qlcplus/eglfs.json ]; then
mkdir -p $HOME/.qlcplus
for i in {1..5}
do
GPUDEV=`find /dev/dri/by-path -name *gpu-card*`
if [ ! -z "$GPUDEV" ]; then
GPUDEV=`readlink -f $GPUDEV`
echo '{ "device": "'$GPUDEV'" }' > $HOME/.qlcplus/eglfs.json
break
else
sleep 2
fi
done
fi
Code: Select all
# qlc folder check
if [ ! -d $HOME/.qlcplus ]; then
mkdir -p $HOME/.qlcplus
fi
# detect DRI card
for i in {1..5}
do
GPUDEV=`find /dev/dri/by-path -name *gpu-card*`
if [ ! -z "$GPUDEV" ]; then
GPUDEV=`readlink -f $GPUDEV`
echo '{ "device": "'$GPUDEV'" }' > $HOME/.qlcplus/eglfs.json
break
else
sleep 2
fi
done
2- Working Audio triggers
This part was a little more tricky as the main "issue" is related to QT and the way it interract with Alsa + systemctl rights + user env linked to the previous comment
I am using a simple mic usb seen by the system as :
"alsa_card.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00"
The "easy" way that works for me using a fresh install of the image :
- install pulse audio:
Code: Select all
sudo apt-get install pipwire pipwire-audio pipwire-alsa
sudo apt-get install pulseaudio-utils (optional, for pactl tool that also works with pipewire)
sudo gpasswd -a pi pipewire
- Do a little change in the systemctl qlcplus.service
Code: Select all
[Unit]
Description=Q Light Controller Plus
Documentation=man:qlcplus(1)
After=basic.target
[Service]
Environment="XDG_RUNTIME_DIR=/run/user/1000"
Type=simple
User=pi
Restart=on-failure
RestartSec=3
ExecStart=/usr/sbin/qlcplus-start.sh
[Install]
WantedBy=multi-user.target
- Activate autologin
Code: Select all
sudo raspi-config
Choose option: 1 System Options
Choose option: S5 Boot / Auto Login
Choose option: B2 Console Autologin
Select Finish, and reboot the Raspberry Pi.
- Choose pipewire as audio input/output in your qlc project
alsamixer to set system volume of the mic device
pactl list sinks to list all devices & have a lot of info (if pulseaudio-utils is installed)
pw-record /tmp/audio.wav to test an audio record outside QLC
arecord -l to list record device
Very important : it only works with a screen attached meaning with "-platform eglfs" QLC start option, so if no screen is attached and qlc start in "-platform offscreen" the audio trigger doesn't work. I dont know why and I have tested vnc , linuxfb and so on and only eglfs works. (maybe QLC+ bug or another QT behavior ? ). Today as a workaround I will receive a simple HDMI dummy device to emulate a screen .
Hope that help