Author |
Message |
Greg Frost
|
Posted: Wed Mar 29, 2006 3:36 am |
|
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location:
Adelaide, Australia
|
EDIT: The information in this thread has been made largely redundant with the release of R5C7. The irblaster stuff in R5C7 should just work. Please feel free to continue to contrubute new blaster codes in this thread for inclusion in future versions of knoppmyth
Moving forward with KnoppMyth, one of the aims is to provide out of the box support for IRBlasters. Some of you may have noticed the question about whether you have an IR blaster during install of R5B7 (and which com port it is on if you answered yes). Unfortunately there was a problem with the startup script for some people (those whose remotes use the /dev/lirc device).I have investigated the problem and have found what I believe to be a good solution.
One thing that is not done automatically however is to install the lircd configuration file that defines the remote codes. What we would like is to be able to offer a menu that enables you to select the device you want to control with your blaster, but to do this, we need people to provide the configuration files they use.
So let's have em! Please provide a good descriptive name with the configuration file (such as the make and model number of the device the file pertains to).
Also, if anyone has a channel change script that they think is particularly good, please post it. I myself do not use a channel change script. My blaster is only used to relay remote command from my tuner card remote to control my TV.
If you also want to help by testing the proposed method for configuring the blaster, read and follow the steps in the second post of this thread below:
Last edited by Greg Frost on Tue Jun 20, 2006 1:48 am, edited 6 times in total.
|
|
Top |
|
|
Greg Frost
|
Posted: Wed Mar 29, 2006 3:53 am |
|
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location:
Adelaide, Australia
|
First, you need to make sure that the irblaster script runs after the lirc script at boot time. If you have a symbolic link by the name of /etc/rc5.d/s20irblaster, you need to run the following two commands: Code: update-rc.d -f irblaster remove update-rc.d irblaster defaults 21 Replace /etc/init.d/irblaster with the following: Code: #! /bin/bash # # Author: Greg Frost
if [ ! -f /usr/sbin/irblasterd ] ; then cp -fpv /usr/sbin/lircd /usr/sbin/irblasterd fi
if [ -f /etc/irblaster/hardware.conf ];then source /etc/irblaster/hardware.conf else echo "##################################################" echo "## IRBLASTER IS NOT CONFIGURED ##" echo "## Place the an irblaster configuration file at:##" echo "## /etc/irblaster/hardware.conf ##" echo "##################################################" exit 1 fi
if [ ! -f /etc/irblaster/irblasterd.conf ] || \ grep -q "^#UNCONFIGURED" /etc/irblaster/irblasterd.conf ; then echo "##################################################" echo "## IRBLASTER IS NOT CONFIGURED ##" echo "## Place the lircd config file at: ##" echo "## /etc/irblaster/irblasterd.conf ##" echo "##################################################" exit 1 fi
case "$1" in start) SERIAL_PORT="" if [ "$IRBLASTER_SERIAL_PORT" = "COM1" ] ; then SERIAL_PORT=/dev/ttyS0 fi if [ "$IRBLASTER_SERIAL_PORT" = "COM2" ] ; then SERIAL_PORT=/dev/ttyS1 fi
if [ -z "$SERIAL_PORT" ] ; then echo "##################################################" echo "## IRBLASTER SERIAL PORT NOT CONFIGURED ##" echo "## Define IRBLASTER_SERIAL_PORT in: ##" echo "## /etc/irblaster/hardware.conf ##" echo "##################################################" exit 1 fi
setserial $SERIAL_PORT uart none
# If the KnoppMyth modprobe file is not already including # /etc/mythtv/modules/lirc_serial, make it include it.
if ! grep -q lirc_serial /etc/modprobe.d/KnoppMyth ; then echo "include /etc/mythtv/modules/lirc_serial" >> \ /etc/modprobe.d/KnoppMyth fi
# Based on the serial port specified in the hardware.conf file, set the # determine what the lirc_serial module options need to be.
if [ $SERIAL_PORT == "/dev/ttyS0" ] ; then IRQ="4" IO="0x3f8" else IRQ="3" IO="0x2f8" fi
# Create the file /etc/mythtv/modules/lirc_serial to specify the # lirc_serial module options.
echo "alias char-major-61 lirc_serial options lirc_serial irq=$IRQ io=$IO" > /etc/mythtv/modules/lirc_serial
# Before loading the lirc_serial module, examine the /sys file system # to determine the lirc devices that are already being used (probably by # your tv tuner card's remote control).
ls -1 /sys/class/lirc 2> /dev/null > /tmp/sys_class_lirc_before_lirc_serial
modprobe lirc_serial
# Now examine the /sys file system again to see the additional lirc # device. This will be the one used by lirc_serial.
ls -1 /sys/class/lirc 2> /dev/null > /tmp/sys_class_lirc_after_lirc_serial
BLASTER_CLASS=$(diff /tmp/sys_class_lirc_before_lirc_serial \ /tmp/sys_class_lirc_after_lirc_serial | grep "^> " | cut -d " " -f 2)
if [ -z "$BLASTER_CLASS" ] ; then echo "##################################################" echo "## UNABLE TO DETERMINE WHICH DEVICE lirc_serial ##" echo "## is using. ##" echo "##################################################" exit 1 fi
BLASTER_MAJOR=$(cat /sys/class/lirc/$BLASTER_CLASS/dev | cut -d ":" -f 1) BLASTER_MINOR=$(cat /sys/class/lirc/$BLASTER_CLASS/dev | cut -d ":" -f 2)
#echo BLASTER_CLASS=$BLASTER_CLASS #echo BLASTER_MAJOR=$BLASTER_MAJOR #echo BLASTER_MINOR=$BLASTER_MINOR
# Create the /dev/blaster device node with the major and minor device # number used by the lirc_serial module.
rm -f /dev/irblaster mknod /dev/irblaster c $BLASTER_MAJOR $BLASTER_MINOR
echo -n "Starting irblaster daemon:" start-stop-daemon --start \ --startas /usr/sbin/irblasterd --pidfile /var/run/irblasterd.pid \ -- --driver=default --device=/dev/irblaster \ --pidfile=/var/run/irblasterd.pid --output=/dev/irblasterd \ /etc/irblaster/irblasterd.conf < /dev/null echo "." ;; stop) echo -n "Stopping irblaster daemon:" echo -n " irblasterd" start-stop-daemon --stop --pidfile /var/run/irblasterd.pid if lsmod | grep -q lirc_serial ; then rmmod lirc_serial fi echo "." ;; reload|force-reload) start-stop-daemon --stop --signal 1 --pidfile /var/run/irblasterd.pid ;; restart) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/irblaster {start|stop|reload|restart|force-reload}" exit 1 esac
exit 0 You no longer need to specify the irblaster device in /etc/irblaster/hardware.conf, so it can look something like this: Code: # /etc/irblaster/hardware.conf # # Author: Greg Frost
# The COM Port used by the IRBlaster. Set it to "COM1" "COM2" or "".
IRBLASTER_SERIAL_PORT="COM2"
Place your lircd.conf file (The file that contains the remote codes for the device that you want to control with your blaster) in /etc/irblaster/irblasterd.conf Then, irsend must be called something like this (notice /dev/irblasterd is used, not /dev/irblaster any more): Code: /usr/local/bin/irsend -d /dev/irblasterd SEND_ONCE lg.conf power
Last edited by Greg Frost on Tue Apr 04, 2006 5:25 pm, edited 1 time in total.
|
|
Top |
|
|
mattshaw
|
Posted: Fri Mar 31, 2006 5:53 pm |
|
Joined: Wed Jul 14, 2004 3:32 pm
Posts: 142
|
Excuse me if I make a fool of myself here, but am I wrong in thinking that the IRBlaster option in the lirc-config script in the R5B7 install is the option to take for using a serial port infra red (homebrew) receiver ????
If so, can anyone advise if this option is going to be included soon, or if there is an option already, but not easily recognisable ?? Or do we still have to go down the manual install route as in previous Knoppmyth versions ???
Regards
Matt Shaw
matt@shagshaw.com
|
|
Top |
|
|
Greg Frost
|
Posted: Fri Mar 31, 2006 7:38 pm |
|
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location:
Adelaide, Australia
|
The instance of lirc (actually run as irblasterd) that handles the irblaster will also handle an ir receiver on the same serial port. However, If you use irxevent or irexec, you will need to run them specifying that the /dev/irblasterd device is to be used to communicate with the irblasterd daemon instead of the default /dev/lircd to communicate with the lircd daemon.
This is a bit of a grey area for configuration, because you could go either way (support the hombrew receiver with lirc, or support ir with the blaster stuff). If you have a blaster as well, the second option is the obvious choice. Let us know how you get on, and we may be able to get it to confugure out of the box to support your setup.
|
|
Top |
|
|
iscraigh
|
Posted: Fri Mar 31, 2006 8:41 pm |
|
Joined: Mon Mar 21, 2005 1:43 pm
Posts: 388
Location:
Nanaimo BC
|
Greg this is my channel change script.
#!/bin/sh
STB_NAME=DCT2000
for digit in $(echo $1 | sed -e 's/./& /g'); do
irsend --device=/dev/irblaster SEND_ONCE $STB_NAME $digit
sleep 0.7
done
irsend --device=/dev/irblaster SEND_ONCE $STB_NAME OK
I did not have any luck with your new script but i will try it on a fresh install of the latest build
Craig
|
|
Top |
|
|
Greg Frost
|
Posted: Fri Mar 31, 2006 9:42 pm |
|
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location:
Adelaide, Australia
|
What do you mean by no luck? Your channel change script will need to replace /dev/irblaster with /dev/irblasterd to work with the new /etc/init.d/irblaster script.
|
|
Top |
|
|
daggo
|
Posted: Fri Mar 31, 2006 10:51 pm |
|
Joined: Wed Oct 05, 2005 9:41 am
Posts: 16
|
|
Top |
|
|
iscraigh
|
Posted: Sat Apr 01, 2006 1:46 am |
|
Joined: Mon Mar 21, 2005 1:43 pm
Posts: 388
Location:
Nanaimo BC
|
Sorry for not being more specific Greg. I meant even using irsend It did not work but I will do a new instal and substitute your modified script and see what happens. Hopefully this weekend if I get time.
Craig
|
|
Top |
|
|
MrRoboto
|
Posted: Sat Apr 01, 2006 5:43 pm |
|
Joined: Thu Oct 27, 2005 11:09 am
Posts: 18
|
Works like a charm! Was getting this error after upgrading to R5B7:
/usr/bin/irsend: could not connect to socket
/usr/bin/irsend: Connection refused
Once I made the changes above, the channels change great to my hughes reciever on directv. I am using this channel script:
#!/bin/bash
echo "changing to $1"
REMOTE_NAME=HUGHES_DSS_GAEBO
for digit in $(echo $1 | sed -e 's/./& /g'); do
sleep 0.2
/usr/bin/irsend --device=/dev/irblasterd SEND_ONCE $REMOTE_NAME $digit
sleep 0.5
done
Many Thanks
_________________ Pentium 4 2.8
ECS 648FX-A Socket 478 SIS 648FX
2 x Kreton 512MB400 (PC 3200)
4 x Seagate 300GB
XFX PVT35LNA Geforce FX5900XT 128MB
2 x Hauppauge PVR-150
NEC Black IDE DVD Burner Model ND-1300A
|
|
Top |
|
|
Greg Frost
|
Posted: Sat Apr 01, 2006 5:46 pm |
|
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location:
Adelaide, Australia
|
Hoo-bloody-ray. At least it works for someone. I just hope we can iron out the problems that some others are having.
|
|
Top |
|
|
tcalderone
|
Posted: Sun Apr 02, 2006 9:07 am |
|
Joined: Sun Jan 23, 2005 11:13 am
Posts: 9
Location:
Mishawaka, IN
|
Woo-Hoo!
Mine works great with this now!
I wiped my box clean and started over and used this. I must have been messing with stuff so much before this that I messed something up.
This is great!
Thanks a million Greg Frost for all of your hard work on this!
|
|
Top |
|
|
mac
|
Posted: Sun Apr 02, 2006 10:42 am |
|
Joined: Tue Feb 21, 2006 7:24 am
Posts: 396
Location:
Dushanbe, Tajikistan
|
|
Top |
|
|
iscraigh
|
Posted: Mon Apr 03, 2006 10:41 am |
|
Joined: Mon Mar 21, 2005 1:43 pm
Posts: 388
Location:
Nanaimo BC
|
Greg
Finally got time to do an upgrade.
SSH'd in before the script ran the first time and replaced it with your new one.
Commented out the irblaster device in the hardware.conf
put in my irblasterd.conf file
tested it with irsend and get
root@mythtv:~# /usr/local/bin/irsend -d /dev/irblasterd SEND_ONCE DCT2000 3
/usr/local/bin/irsend: could not connect to socket
/usr/local/bin/irsend: Connection refused
any ideas?
Craig
|
|
Top |
|
|
mac
|
Posted: Mon Apr 03, 2006 11:01 am |
|
Joined: Tue Feb 21, 2006 7:24 am
Posts: 396
Location:
Dushanbe, Tajikistan
|
does a: "/etc/inid.d/irblaster restart" show any errors?
do a:
grep -A1 lirc_serial: /var/log/messages
Code: lirc_serial: auto-detected active high receiver lirc_dev: lirc_register_plugin: sample_rate: 0
Are you seeing these lines?
If so, make sure that Greg's script picked up the correct comm port.
what do you see from a:
grep ttyS[0-1] /var/log/messages
|
|
Top |
|
|
Greg Frost
|
Posted: Mon Apr 03, 2006 8:50 pm |
|
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location:
Adelaide, Australia
|
iscraig: what mac said, and also, is irblasterd running?
|
|
Top |
|
|