[mythtv-users] how to get Hauppauge gray remote (PVR-250) working under kernel 2.6.38

Mark Lord mythtv at rtr.ca
Tue Mar 29 02:56:38 UTC 2011


On 11-03-28 10:54 PM, Mark Lord wrote:
> On 11-03-28 10:50 PM, Mark Lord wrote:
> ..
>> I use the hauppauge.conf file below, which gets applied by a boot script
>> using this command:
>>
>>     inputkbd -f hauppauge.conf 6
>>
>> Where "6" is the "event" device number for the Hauppauge card,
>> found by parsing the output of "lsinput".
>
> Oh, also note that due to another bug in the IR/input drivers,
> that command sometimes has to be issued twice in succession,
> so my boot script just always does it twice, with exactly the
> same file and parameters.

Here (below) is the actual boot script I use.
I arrange for this to be called from /etc/rc.local on system startup:

#!/bin/bash
#set -x
#
# /usr/local/bin/enable_hauppauge_remote.sh
#
# This script must be run as root,
#
# Setup hauppauge remote

rmmod=yes
if [ "$1" == "--no-rmmod" ]; then
	shift
	rmmod=no
fi

reconfig=0
if [ "$1" = "--reconfig" ]; then
	reconfig=1
	shift
	if [ -e "$1" ]; then
		CONF="$1"
		shift
	fi
fi

CONF=/usr/local/bin/hauppauge.conf

LSINPUT="/usr/local/bin/lsinput"
INPUTKBD="/usr/local/bin/input-kbd"

protocol=hacked
$LSINPUT.$protocol 2>&1 | grep -q 'protocol version mismatch' &>/dev/null
[ $? -eq 0 ] && protocol=new
#echo "protocol=$protocol"
LSINPUT=$LSINPUT.$protocol
INPUTKBD=$INPUTKBD.$protocol

if [ ! -x $INPUTKBD ]; then
	echo "$INPUTKBD: not found (try: apt-get install input-utils)"
	exit 1
fi

if [ ! -x $LSINPUT ]; then
	echo "$LSINPUT: not found (try: apt-get install input-utils)"
	exit 1
fi

if [ ! -s $CONF ]; then
	echo "$CONF: not found (needed for button mappings)"
	exit 1
fi

if [ $reconfig -eq 0 ]; then
	logger -- "$0: reconfiguring driver"
	[ "$rmmod" = "yes" ] && /sbin/rmmod ir-kbd-i2c &>/dev/null
	sleep 0.2
	if ( ! grep ir.kbd.i2c /proc/modules &>/dev/null ) ; then
		/sbin/modprobe ir-common
		/sbin/modprobe ir-kbd-i2c || exit 1
		sleep 0.2
	fi

	logger -- "$0: waiting for device(s)"
	maxwait=20
	while [ "`$LSINPUT 2>&1 | grep -c 'Hauppauge\|Pinnacle'`" == "0" ]; do
		maxwait=$((maxwait - 1))
		[ $maxwait -le 0 ] && break
		sleep 0.5
	done
	sleep 0.5  ## ensure we have time to find *all* available I/R inputs
fi

DEVS=`$LSINPUT 2>&1 | awk '/^\/dev.input.event/{sub("[^0-9]*",""); d=$0}
/Hauppauge/{print d} /Pinnacle/{print d}'`

# configure the key mappings from the $CONF file:
for DEV in $DEVS ; do
	TMP=/tmp/haup.conf
	sed -e"s/[ 	]*#.*$//" < "$CONF" > $TMP
	logger -i -- $INPUTKBD -f "$TMP" "$DEV"
	$INPUTKBD -f "$TMP" "$DEV" &>/dev/null  ## Need to do this twice sometimes
	echo $INPUTKBD -f "$TMP" "$DEV" | grep -vi "scan:"
	$INPUTKBD -f "$TMP" "$DEV" | grep -vi "scan:"
	rm "$TMP"
done
exit 0


More information about the mythtv-users mailing list