Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-16 Thread Neil Bird
Around about 15/02/05 15:04, Simon Kenyon typed ...
i believe you are using my version of the software for the redremote
the Makefile documents the various timeouts
sorry if this caused you problems
  Yep, but don't apologise, it's my fault for not bothering to look at 
the code :)

  That did the trick;  I'm flummoxed as to how you can make it work 
with a 1-second final delay though!

  I've a 2 s. final delay, plus 20 ms. nanosleep() power-up delay 
(instead of sleep(1)), and channel change is now /smooth/.

  With a 'mutex'd wrapper script that does channel Sky sleep 
channelagainifnotcalledsince (allows repeated cslls to change channel 
without interferences, and copes with having to possibly turn the box 
on) it's all working a dream.

  I may tinker with making it a single perl script (parsing, delays  
serial control build in) with proper 'flock'ing, but as they say:  if it 
ain't broke ...

  If anyone's interested in my wrapper, email me.
--
[EMAIL PROTECTED] ~]# rm -f .signature
[EMAIL PROTECTED] ~]# ls -l .signature
ls: .signature: No such file or directory
[EMAIL PROTECTED] ~]# exit
___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-16 Thread Simon Kenyon
On Wednesday 16 February 2005 13:09, Neil Bird wrote:
 Around about 15/02/05 15:04, Simon Kenyon typed ...

  i believe you are using my version of the software for the redremote
  the Makefile documents the various timeouts
  sorry if this caused you problems

Yep, but don't apologise, it's my fault for not bothering to look at
 the code :)

That did the trick;  I'm flummoxed as to how you can make it work
 with a 1-second final delay though!
well it doesn't work every time - so there you go!
post your wrapper and i'll give it a whirl
also, post your changes to use nanosleep()
--
simon
___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-16 Thread Neil Bird
Around about 16/02/05 14:34, Simon Kenyon typed ...
well it doesn't work every time - so there you go!
  :-)

post your wrapper and i'll give it a whirl
also, post your changes to use nanosleep()
  Here goes;  cat'd over SSH and reformatted in case there's anything 
odd in there :-)

  Not sure the locking functions (purloined) are really as tidy as I'd 
want [hence the possibility of rolling it all into one perl script using 
flock()] but it seems to suffice, and be nice  reliable, so for the 
time being, it stays.

--
[EMAIL PROTECTED] ~]# rm -f .signature
[EMAIL PROTECTED] ~]# ls -l .signature
ls: .signature: No such file or directory
[EMAIL PROTECTED] ~]# exit
#include unistd.h
#include stdio.h  /* Standard input/output definitions */
#include string.h /* String function definitions */
#include unistd.h /* UNIX standard function definitions */
#include fcntl.h  /* File control definitions */
#include errno.h  /* Error number definitions */
#include asm/ioctls.h
#include asm/termios.h/* POSIX terminal control definitions */
#include time.h

#ifndef COM_PORT
# define COM_PORT   /dev/ttyS0
#endif

#ifndef WAIT_TIME
# define WAIT_TIME  2
#endif

#ifndef DEBUG
# define DEBUG  0
#endif

static int debug = DEBUG;

/* the RTS line is actually the DTR line in linux */
#ifdef linux
# define BIT_TO_TWIDDLE TIOCM_DTR
#else
# define BIT_TO_TWIDDLE TIOCM_RTS
#endif

/*
 * open_port() - Open serial port
 * returns the file descriptor on success or -1 on error
 */
int open_port(char *com_port)
{
  int fd;   /* file descriptor for the port */
  struct termios options;

  fd = open (com_port, O_WRONLY | O_NOCTTY | O_NDELAY);
  if (fd == -1)
  {
/* Could not open the port. */
perror (open_port(): unable to open com port);
exit (-1);
  }
  else
  {
fcntl (fd, F_SETFL, 0);
  }

  /* get the current options for the port */
  tcgetattr (fd, options);

  /* Set the baud rates to 9600 */
  cfsetispeed (options, B9600);
  cfsetospeed (options, B9600);

  /* enable the receiver and set local mode */
  options.c_cflag |= (CLOCAL);
  options.c_cflag = ~PARENB;
  options.c_cflag = ~CSTOPB;
  options.c_cflag = ~CSIZE;
  options.c_cflag |= CS8;
  options.c_cflag = ~CREAD;
  options.c_cflag = ~CRTSCTS;
  options.c_iflag = ~(IXON | IXOFF | IXANY);

  /* set the new options for the port */
  tcsetattr (fd, TCSANOW, options);
  return (fd);
}

void set_rts(int fd)
{
  int status;
  int bitset = BIT_TO_TWIDDLE;
  ioctl (fd, TIOCMGET, status);
  if (debug)
  {
if (status  bitset)
{
  printf(RTS bit is set\n);
}
else
{
  printf(RTS bit is unset\n);
}
  }
  status |= bitset;
  ioctl (fd, TIOCMSET, status);
  ioctl (fd, TIOCMGET, status);
  if (status  bitset)
  {
if (debug) printf(RTS bit set ok\n);
  }
  else
  {
perror(set_rts(): failed to set RTS bit);
exit(-1);
  }
}

int main (int argc, char **argv)
{
  int fd;
  char *com_port = COM_PORT;
  int n;
  char *data;
  int wait_time = WAIT_TIME;

  if (argc == 1 || argc  4)
  {
  printf(usage: digibox codestring [waittime [device]]\n);
  return -1;
  }

  data = argv[1];
  if (argc  2)
  wait_time = atoi(argv[2]);
  if (argc  3)
  com_port = argv[3];

  if (debug) printf(opening port for %s and setting RTS\n, com_port);
  fd = open_port(com_port);
  set_rts (fd);

  /* needed to power up the IR system */
  {
int done = 0;
struct timespec poweruptime;
poweruptime.tv_sec = 0;
poweruptime.tv_nsec = 2000;
while (!done)
{
  int status = nanosleep(poweruptime,poweruptime);
  if (status == 0)
  {
done = 1;
  }
  else if (status == -1)
  {
if (errno != EINTR)
{
  sleep(1);
  done = 1;
}
  }
}
  }

  if (debug) printf(writing data (\%s\) now\n,data);
  n = write (fd, data, strlen (data));
  if (n  0)
  {
perror(main(): write failed);
exit(-1);
  }
  if (debug) printf(data written\n);
  tcdrain (fd);
  if (wait_time  0)
  {
if (debug) printf(sleeping for %d seconds\n,wait_time);
sleep (wait_time);
  }
  if (debug) printf(start close\n);
  close (fd);
  if (debug) printf(finished\n);

  return 0;
}
# irfunctions from skychannel.tar.bz2
# http://www.nexusuk.org/projects/mythtv/lirc/

lockir() {
declare -i count=0
while [ $count -lt 10 ]; do
if mktemp /tmp/irlock 21 /dev/null; then
echo $$  /tmp/irlock
return 0
fi
if ! kill -0 `cat /tmp/irlock` 21 /dev/null; then
rm /tmp/irlock
if mktemp /tmp/irlock 21 /dev/null; then
echo $$  /tmp/irlock
return 0
fi
fi
sleep 1
count=$count+1

Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-15 Thread Neil Bird
Around about 14/02/05 15:13, Steven Christall typed ...
Edit the Makefile and increase the WAIT_TIME to two seconds.  I found it 
was cutting the power to the device before it managed to send the three 
digits
  Dagnabbit, that'll be it.  Yes, the digibox 'tidied' version of 
red_eye has that hard-coded to '1' instead of being argv[2].  I only 
really looked at it for the first time yesterday, and you only just let 
me twig what that delay's for!

  I'll try that later ...
--
[EMAIL PROTECTED] ~]# rm -f .signature
[EMAIL PROTECTED] ~]# ls -l .signature
ls: .signature: No such file or directory
[EMAIL PROTECTED] ~]# exit
___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-15 Thread Simon Kenyon
On Tuesday 15 February 2005 08:33, Neil Bird wrote:
 Around about 14/02/05 15:13, Steven Christall typed ...

  Edit the Makefile and increase the WAIT_TIME to two seconds.  I found it
  was cutting the power to the device before it managed to send the three
  digits

Dagnabbit, that'll be it.  Yes, the digibox 'tidied' version of
 red_eye has that hard-coded to '1' instead of being argv[2].  I only
 really looked at it for the first time yesterday, and you only just let
 me twig what that delay's for!

I'll try that later ...

i believe you are using my version of the software for the redremote
the Makefile documents the various timeouts
sorry if this caused you problems

regards
--
simon
___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-14 Thread Neil Bird
Around about 11/02/05 20:45, scamp typed ...
For changing the channels, I use an IR transmitter from Red Remote -
http://www.redremote.co.uk/serial/
  Ah, *please* tell me ... do you have to play silly wotsits to make it 
work OK?

  I have the obligatory wrapper script 'skychannel' (with some noddy 
locking code I found somewhere to prevent multiple channel changes at 
once) calling 'digibox' (a slightly modified version of red_eye IIRC 
that, again, I found somewhere :) ).

  But I have grief making it work in one go;  if I run 'digibox 101' to 
change to BBC1, only the initial '10' comes out.  Ditto any channel: 
'digibox 123' just does '12' and then the digibox times out waiting for 
the third digit!  I've tried 'digibox 12!!!3' and all manner of variants.

  I resorted to three sep. commands (digibox 1; digibox 2; digibox 3) 
but this takes an age [in fact I now do 'digibox 12; digibox3' with some 
extra no-delay */= codes in there as well].

  I currently send:
12  # first 2 digits in case box is already on for immediate change
3K  # third digit then power-on in case it's off
sleep a second to give box chance to come up before entering channel
12  # again
3
  .. with the sends blocked by the 'lock' thing change process ID so 
that channel hopping works without delays/interference.

  Your 'TK$1 5';  you always power cycle the box upon channel change? 
What's the '5'?  And then a double 'K' [sky button?]?  My 'digibox.c' 
must be more modified from the red_eye.c than I thought ...

--
[EMAIL PROTECTED] ~]# rm -f .signature
[EMAIL PROTECTED] ~]# ls -l .signature
ls: .signature: No such file or directory
[EMAIL PROTECTED] ~]# exit
___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-14 Thread MythTV
Neil Bird wrote:
Around about 11/02/05 20:45, scamp typed ...
For changing the channels, I use an IR transmitter from Red Remote -
http://www.redremote.co.uk/serial/

  Ah, *please* tell me ... do you have to play silly wotsits to make 
it work OK?

  I have the obligatory wrapper script 'skychannel' (with some noddy 
locking code I found somewhere to prevent multiple channel changes at 
once) calling 'digibox' (a slightly modified version of red_eye IIRC 
that, again, I found somewhere :) ).

  But I have grief making it work in one go;  if I run 'digibox 101' 
to change to BBC1, only the initial '10' comes out.  Ditto any 
channel: 'digibox 123' just does '12' and then the digibox times out 
waiting for the third digit!  I've tried 'digibox 12!!!3' and all 
manner of variants.

  I resorted to three sep. commands (digibox 1; digibox 2; digibox 3) 
but this takes an age [in fact I now do 'digibox 12; digibox3' with 
some extra no-delay */= codes in there as well].

  I currently send:
12  # first 2 digits in case box is already on for immediate change
3K  # third digit then power-on in case it's off
sleep a second to give box chance to come up before entering channel
12  # again
3
  .. with the sends blocked by the 'lock' thing change process ID so 
that channel hopping works without delays/interference.

  Your 'TK$1 5';  you always power cycle the box upon channel change? 
What's the '5'?  And then a double 'K' [sky button?]?  My 
'digibox.c' must be more modified from the red_eye.c than I thought ...

Hi,
Not sure why the need for all the scripts. I have a script called 
change_channel.csh that does this

#!/bin/csh
/home/mythtv/red_eye /dev/ttyS0 T 1
/home/mythtv/red_eye /dev/ttyS0 $1 1
The red_eye command is available from the redremote site 
http://www.redremote.co.uk/serial/red_eye.tgz

Let me know if you need any more info.
Matt
___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-14 Thread gary dawes
I'm using a sir dongle which plugs into the ir header on my motherboard 
with no problems. The particular one I'm using is an asus, but I have 
another which also works. I've seen adaptors available on the net for 
most MBs.

I'm using lirc 0.7pre, I learnt the codes from my sky remote, as all the 
ones I found on the net did not work. I'm also calling the channel.pl 
file directly from myth rather than the wrapper shell script.
If you are having a problem, try using lirc (irrecord) to learn your 
particular remote.

The header is atached to the PC via a lead salvaged from a scrap ps/2 
mouse, and I'm using a ps/2 port on a slot plate again liberated from a 
scrap PC. Granted, it does not look nice, but it works.

BTW I'm thinking about moving my backend out of the living room. My sky 
box is connected presently via svideo. If I set the frequency ID on each 
sky channel to the uhf channel on the tuner, and change the input to the 
tuner, does anybody know if it will use the channel ID to send the 
commands to change, and select the correct rf channel on the tuner?

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 10/02/2005
___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-14 Thread Steven Christall
Neil Bird wrote:
  Ah, *please* tell me ... do you have to play silly wotsits to make 
it work OK?

  I have the obligatory wrapper script 'skychannel' (with some noddy 
locking code I found somewhere to prevent multiple channel changes at 
once) calling 'digibox' (a slightly modified version of red_eye IIRC 
that, again, I found somewhere :) ).

  But I have grief making it work in one go;  if I run 'digibox 101' 
to change to BBC1, only the initial '10' comes out.  Ditto any 
channel: 'digibox 123' just does '12' and then the digibox times out 
waiting for the third digit!  I've tried 'digibox 12!!!3' and all 
manner of variants.

  I resorted to three sep. commands (digibox 1; digibox 2; digibox 3) 
but this takes an age [in fact I now do 'digibox 12; digibox3' with 
some extra no-delay */= codes in there as well].
snip
Edit the Makefile and increase the WAIT_TIME to two seconds.  I found it 
was cutting the power to the device before it managed to send the three 
digits

HTH's
Steve
___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


[mythtv-users] UK - Controlling Sky boxes

2005-02-11 Thread Craig Tinson
Hey Guys
Have been looking at this:
http://www.cornelius.demon.co.uk/lirc-sky-rflink-howto.html
Which effectively shows how to control a Sky (or Sky+) Digibox from the 
serial port..

I've looked at the link for the RFLink thats mentioned and given them a 
call to ask if they can provide one that already has a serial port on 
the end (the one they make is for Tivo's) but they don't.

I know I could modify one myself but I don't really have the time or 
patience to be cutting things up and soldering them back together - so I 
was wondering if anyone knows of a UK supplier that makes this type of 
item ready-made..

I'd prefer to use this method rather than a IR approach as this seems a 
bit tidier and means I don't have to go taping bits to the IR reciever 
on the front of the Sky box..

Up till this point (have been running a Myth box for over a year now) 
I've been setting schedules up in myth and then setting the Sky box to 
autoview/series link .. but this isn't perfect.. and effectively 
makes MythWeb pointless.. am wanting to be able to set recordings 
remotely... and unless the Sky box happens to already be on the channel 
I want to record on.. I can't do this..

Any ideas/links would be appreciated
Craig
___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


Re: [mythtv-users] UK - Controlling Sky boxes

2005-02-11 Thread scamp
Hi Craig

I've not played with this myself, but would love to hear how you get
on with it if you try.
I use the RF extender on the Sky box so that I can control it from
another room, so that works well.

For changing the channels, I use an IR transmitter from Red Remote -
http://www.redremote.co.uk/serial/

I'm absolutely delighted with it, and it works very well indeed.  The
only problem I found was that I needed to use a Windoze machine to
program it for the Sky box.  That wasn't a great hassle though.

If you're interested, the script I wrote for changing channels is quite simply:

#!/bin/sh

/usr/share/mythtv/red_eye /dev/ttyS0 TK$1 2
/usr/share/mythtv/red_eye /dev/ttyS0 KK 5


Anyway, I look forward to hearing how you get on.
Steve



On Fri, 11 Feb 2005 15:25:07 +, Craig Tinson [EMAIL PROTECTED] wrote:
 Hey Guys
 
 Have been looking at this:
 
 http://www.cornelius.demon.co.uk/lirc-sky-rflink-howto.html
 
 Which effectively shows how to control a Sky (or Sky+) Digibox from the
 serial port..
 
 I've looked at the link for the RFLink thats mentioned and given them a
 call to ask if they can provide one that already has a serial port on
 the end (the one they make is for Tivo's) but they don't.
 
 I know I could modify one myself but I don't really have the time or
 patience to be cutting things up and soldering them back together - so I
 was wondering if anyone knows of a UK supplier that makes this type of
 item ready-made..
 
 I'd prefer to use this method rather than a IR approach as this seems a
 bit tidier and means I don't have to go taping bits to the IR reciever
 on the front of the Sky box..
 
 Up till this point (have been running a Myth box for over a year now)
 I've been setting schedules up in myth and then setting the Sky box to
 autoview/series link .. but this isn't perfect.. and effectively
 makes MythWeb pointless.. am wanting to be able to set recordings
 remotely... and unless the Sky box happens to already be on the channel
 I want to record on.. I can't do this..
 
 Any ideas/links would be appreciated
 
 Craig
 
 ___
 mythtv-users mailing list
 mythtv-users@mythtv.org
 http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

___
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users