LinHES Forums
http://forum.linhes.org/

R7.2 lirc not starting at boot-up
http://forum.linhes.org/viewtopic.php?f=21&t=22610
Page 1 of 1

Author:  bobmyth [ Mon Apr 30, 2012 9:15 pm ]
Post subject:  R7.2 lirc not starting at boot-up

When I reboot my system, my remote control does not work. I've traced the problem to the "run" script in /etc/sv/lircd, the execution halts on this line:
Code:
in_kernel_support "disable"

I have the same problem when I try to turn lircd off using "sv" because in the finish script there is a similar line:
Code:
in_kernel_support "enable"


I do have 2 devices in /sys/class/rc:
Code:
# cat /sys/class/rc/rc0/protocols
rc-5 nec [rc-6] jvc sony [lirc]
# cat /sys/class/rc/rc1/protocols
other


I'd appreciate any suggestions.

Author:  brfransen [ Mon Apr 30, 2012 10:14 pm ]
Post subject:  Re: R7.2 lirc not starting at boot-up

The in_kernel_support function is in /usr/MythVantage/bin/install_functions.sh. Try copying it to a test file and run it to see where the error may be.

Author:  bobmyth [ Wed May 02, 2012 9:10 pm ]
Post subject:  Re: R7.2 lirc not starting at boot-up

brfransen wrote:
The in_kernel_support function is in /usr/MythVantage/bin/install_functions.sh. Try copying it to a test file and run it to see where the error may be.


Thanks for your response. The execution stops at the first echo that is executed. As you can see, I am running this as root:
Code:
# bash -x in_kernel_support.sh
+ in_kernel_support disable
+ '[' -d /sys/class/rc ']'
++ ls -A /sys/class/rc
+ '[' 'rc0
rc1' ']'
++ find /sys/class/rc/rc0/ /sys/class/rc/rc1/ -name protocols
+ for file in '`find /sys/class/rc/*/ -name protocols`'
+ '[' disable = disable ']'
+ echo lirc
+ for file in '`find /sys/class/rc/*/ -name protocols`'
+ '[' disable = disable ']'
+ echo lirc

I think the problem is LCDd is already running and we are "switching" protocols on it. After doing all the echo commands, my VFD was messed-up and I had to reboot. One fix would be to have these run before LCDd starts, not sure if that is possible.

Author:  brfransen [ Wed May 02, 2012 10:17 pm ]
Post subject:  Re: R7.2 lirc not starting at boot-up

What do rc0 and rc1 look like after you manually echo lirc?

Author:  bobmyth [ Thu May 03, 2012 9:10 pm ]
Post subject:  Re: R7.2 lirc not starting at boot-up

brfransen wrote:
What do rc0 and rc1 look like after you manually echo lirc?


I cannot echo to rc1 when is LCDd is running. When LCDd is not running, rc1 is always "other" (iMon). The rc0 (MCE usb) can be changed and appears to work properly:
Code:
$ cat /sys/class/rc/rc0/protocols
rc-5 nec rc-6 jvc sony [lirc]
$ cat /sys/class/rc/rc1/protocols
other


To work around this, I've created a /etc/runit/lirc.sh file for my system:
Code:
#!/bin/bash

LOG=/tmp/lirc.log
LCMD="/usr/sbin/lircd -r -n -d /dev/lirc0 --output /var/run/lirc/lircd"

for file in `find /sys/class/rc/*/ -name protocols`; do
  if grep -q lirc $file ; then
    echo lirc > $file
  fi
done

exec $LCMD >>$LOG 2>>$LOG

shamelessly stolen from LinHes scripts.

Author:  brfransen [ Thu May 03, 2012 11:06 pm ]
Post subject:  Re: R7.2 lirc not starting at boot-up

bobmyth,

Would you mind testing to see if this fixes it? Replace function in_kernel_support() in /usr/MythVantage/bin/install_functions.sh with:
Code:
function in_kernel_support() {
    #lifted from mythbuntu
    #For disabling other protocols, adjust to the new location in 2.6.37.    91
    if [ -d /sys/class/rc ] && [ "$(ls -A /sys/class/rc)" ]
    then
        SVSTOP=0
        if [ -d /service/lcdd ]; then
            sv stop lcdd
            SVSTOP=1
        fi
        for file in `find /sys/class/rc/*/ -name protocols`
        do
            if [ "$1" = "disable" ]
            then
                echo "lirc" > $file
            else
                echo "none" > $file
                for protocol in `cat $file`; do
                echo "+${protocol}" > $file
                done
            fi
        done
        if [ $SVSTOP -eq 1 ]; then
            sv start lcdd
        fi
    fi
}

Author:  bobmyth [ Mon May 07, 2012 9:00 pm ]
Post subject:  Re: R7.2 lirc not starting at boot-up

I will report back.

Author:  bobmyth [ Wed May 09, 2012 10:24 pm ]
Post subject:  Re: R7.2 lirc not starting at boot-up

@brfransen: the new function worked great. Thanks.

One suggestion related to lirc, in /etc/sv/lircd/run around line 29 it reads:
Code:
if [ -f /etc/runit/lirc.sh ]
then
    #program must not terminate.

    stat_runit "Starting lirc"

    /etc/runit/lirc.sh

Could this be changed to:
Code:
if [ -x /etc/runit/lirc.sh ]

This will allow a user to turn off execute and then use the standard boot-up script. If the script is not executable in the first place it wouldn't get executed anyway. Thanks.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/