[mythtv-users] Recording LED almost working.
Rick St.Pierre
rsp at idcomm.com
Thu Jun 10 21:48:12 EDT 2004
I have 2 LEDs working, one for each of my PVR-250s. I built a
parallel port cable based on a design I found on the web (I can't
remember where, but it was a very simple circuit).
I then have cron run this simple script every minute. I have always
wanted to see if there was a way mythtv could run this script
automatically when it starts/stops recording, but haven't had the time
to look into it. The script is:
#! /bin/sh
if [ `fuser /dev/video0 | grep -cv grep` == "0" ]
then
if [ `fuser /dev/video1 | grep -cv grep` == "0" ]
then
/usr/local/bin/lpt_light 0
else
/usr/local/bin/lpt_light 2
fi
else
if [ `fuser /dev/video1 | grep -cv grep` == "0" ]
then
/usr/local/bin/lpt_light 1
else
/usr/local/bin/lpt_light 3
fi
fi
the lpt_light program is a simple little program I wrote myself. A
parameter of 1 turns on the first light, 2 the second, and 3 both
lights. The code is:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/io.h>
#define base 0x378
main (int argc, char **argv)
{
int value;
if (argc != 2)
fprintf(stderr, "ERROR - Wrong number of input arguments.\n"), exit(1);
if (sscanf(argv[1],"%i",&value)!=1)
fprintf(stderr, "ERROR - Parameter is not a number.\n"), exit(1);
if ((value<0) || (value>255))
fprintf(stderr, "ERROR - Invalid numeric value.\n"), exit(1);
if (ioperm(base,1,1))
fprintf(stderr, "ERROR - Could not access printer port.\n"), exit(1);
outb((unsigned char)value, base);
}
Hopefully this helps some people out. The only down side is the light
will only change when the script is run. I am hoping to find time to
get working on the mythtv code soon, and maybe integrate this better.
Rick.
Thursday, June 10, 2004, 5:35:17 PM, you wrote:
DT> Garry wrote:
>> Something seems to be spewing stuff to the parallel port.
>>
DT> I noticed the same thing when I created my parallel port LED device. It
DT> seems that on some motherboards the interrupt status is reflected on
DT> various parallel port lines. The only solution that I found was to buy
DT> an add-in parallel port PCI card and disable the port on the motherboard.
DT> -Dave
--
Rick St.Pierre
rsp Acoustics
mailto:rick at rspacoustics.com
More information about the mythtv-users
mailing list