@@ -11,25 +11,32 @@ if [ "$(id -u)" -ne 0 ]; then
1111 exit 1
1212fi
1313
14- # Check for LIRC device
15- if [ ! -e /dev/lirc0 ] ; then
16- echo " Warning: /dev/lirc0 not found. The daemon will fail to start without it. "
17- echo " Ensure your IR receiver is connected and the kernel module is loaded. "
14+ # Detect input mode — LIRC vs evdev
15+ HAS_LIRC=false
16+ if ls /dev/lirc * > /dev/null 2>&1 ; then
17+ HAS_LIRC=true
1818fi
1919
20- # Configure IR receiver for RC-6 only
21- RC_DIR=" /sys/class/rc/rc0"
22- if [ -d " $RC_DIR " ]; then
23- echo " Configuring IR receiver for RC-6 protocol..."
24- echo rc-6 > " $RC_DIR /protocols"
25- echo " Active protocols: $( cat " $RC_DIR /protocols" ) "
26-
27- # Persist via udev rule so it survives reboot
28- UDEV_RULE=" /etc/udev/rules.d/99-infrafid-rc6.rules"
29- echo ' ACTION=="add", SUBSYSTEM=="rc", ATTR{protocols}="rc-6"' > " $UDEV_RULE "
30- echo " Created udev rule: $UDEV_RULE "
20+ if [ " $HAS_LIRC " = true ]; then
21+ # Configure IR receiver for RC-6 + NEC (both supported via LIRC)
22+ RC_DIR=" /sys/class/rc/rc0"
23+ if [ -d " $RC_DIR " ]; then
24+ echo " Configuring IR receiver for RC-6 and NEC protocols..."
25+ echo " rc-6 nec" > " $RC_DIR /protocols"
26+ echo " Active protocols: $( cat " $RC_DIR /protocols" ) "
27+
28+ # Persist via udev rule so it survives reboot
29+ UDEV_RULE=" /etc/udev/rules.d/99-infrafid-rc6.rules"
30+ echo ' ACTION=="add", SUBSYSTEM=="rc", ATTR{protocols}="rc-6 nec"' > " $UDEV_RULE "
31+ echo " Created udev rule: $UDEV_RULE "
32+ else
33+ echo " Warning: $RC_DIR not found. You may need to configure protocols manually."
34+ fi
3135else
32- echo " Warning: $RC_DIR not found. You may need to configure RC-6 manually."
36+ echo " Warning: no /dev/lirc* device found."
37+ echo " If your device uses evdev (e.g. Squeezebox Touch), configure it via:"
38+ echo " echo 'INFRAFID_ARGS=\" --evdev /dev/input/event1\" ' > /etc/default/infrafid"
39+ echo " Then: systemctl restart infrafid"
3340fi
3441
3542# Build
0 commit comments