[mythtv] [PATCH] dct-channel update

Jim Paris jim at jtan.com
Fri Oct 31 15:58:56 EST 2003


Just a small update; I noticed that sometimes my cable box would miss
keypresses, so now dct-channel increases the delay slightly after the
first failure.

Isaac, you can also remove dct-channel/test.c.

-jim
-------------- next part --------------
Index: dct-channel/Makefile
===================================================================
RCS file: /var/lib/mythcvs/mythtv/contrib/dct-channel/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- dct-channel/Makefile	28 Oct 2003 21:48:27 -0000	1.1
+++ dct-channel/Makefile	31 Oct 2003 20:41:24 -0000
@@ -22,8 +22,6 @@
 
 channel: channel.o crc.o opt.o packet.o serial.o
 
-test: test.o crc.o opt.o packet.o serial.o
-
 channel.1: channel.c version.h
 	make channel
 	if ! help2man -N --output=channel.1 ./channel ; then \
Index: dct-channel/NEWS
===================================================================
RCS file: /var/lib/mythcvs/mythtv/contrib/dct-channel/NEWS,v
retrieving revision 1.1
diff -u -r1.1 NEWS
--- dct-channel/NEWS	28 Oct 2003 21:48:27 -0000	1.1
+++ dct-channel/NEWS	31 Oct 2003 20:41:25 -0000
@@ -1,3 +1,7 @@
+1.6, 2003-10-31
+	Try 5 times instead of 4, and increase timeouts by 50% after
+	second failed attempt to change channel.
+
 1.5, 2003-10-26
 	Wait for extra status messages after changing channel; without
         it, clearing the OSD would usually fail because we wouldn't
Index: dct-channel/VERSION
===================================================================
RCS file: /var/lib/mythcvs/mythtv/contrib/dct-channel/VERSION,v
retrieving revision 1.1
diff -u -r1.1 VERSION
--- dct-channel/VERSION	28 Oct 2003 21:48:27 -0000	1.1
+++ dct-channel/VERSION	31 Oct 2003 20:41:25 -0000
@@ -1 +1 @@
-1.5
+1.6
Index: dct-channel/channel.1
===================================================================
RCS file: /var/lib/mythcvs/mythtv/contrib/dct-channel/channel.1,v
retrieving revision 1.1
diff -u -r1.1 channel.1
--- dct-channel/channel.1	28 Oct 2003 21:48:27 -0000	1.1
+++ dct-channel/channel.1	31 Oct 2003 20:41:25 -0000
@@ -1,7 +1,7 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.33.
-.TH DCT-CHANNEL "1" "October 2003" "dct-channel 1.5 (2003-10-26)" "User Commands"
+.TH DCT-CHANNEL "1" "October 2003" "dct-channel 1.6 (2003-10-31)" "User Commands"
 .SH NAME
-dct-channel \- manual page for dct-channel 1.5 (2003-10-26)
+dct-channel \- manual page for dct-channel 1.6 (2003-10-31)
 .SH SYNOPSIS
 .B channel
 [\fIoptions\fR] [\fIchannel\fR]
Index: dct-channel/channel.c
===================================================================
RCS file: /var/lib/mythcvs/mythtv/contrib/dct-channel/channel.c,v
retrieving revision 1.1
diff -u -r1.1 channel.c
--- dct-channel/channel.c	28 Oct 2003 21:48:27 -0000	1.1
+++ dct-channel/channel.c	31 Oct 2003 20:41:25 -0000
@@ -309,7 +309,7 @@
 		return 0;
 	}
 
-	while(tries < 4) {
+	while(tries < 5) {
 		tries++;
 		if(initialize()<0) {
 			verb("Initialization failed\n");
@@ -331,7 +331,9 @@
 				int i;
 
 				verb("Failed to set new channel\n");
-				if(tries==1 || tries==3) {
+				switch(tries) {
+				case 1:
+				case 3:
 					/* Try sending exit key a few
 					   times to make sure we're
 					   not in a menu or something */
@@ -339,18 +341,33 @@
 					for(i=0;i<4;i++)
 						if(send_keypress(KEY_EXIT)<0)
 							break;
-				} else if(tries==2 && !nopower) {
-					/* Try sending power button,
+					break;
+				case 2:
+					/* Try increasing timeouts by 50%,
+					   which will also increase the
+					   delay between keypresses */
+					timeout_scale *= 1.5;
+					verb("Increased timeout_scale to %f\n",
+					     timeout_scale);
+					break;
+				case 4:
+					/* After 4 unsuccessful tries,
+					   try sending power button,
 					   in case the box is turned
 					   off.  Need to wait for it
 					   to actually power on, and
 					   flush buffers since it will
 					   probably send garbage. */
+					if(nopower) 
+						break;
 					verb("Attempting to turn box on\n");
 					if(send_keypress(KEY_POWER)>=0) {
 						usleep(POWER_SLEEP*1000);
 					}
  					serial_flush();
+					break;
+				default:
+					break;
 				}
 				continue;
 			}
Index: dct-channel/version.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/contrib/dct-channel/version.h,v
retrieving revision 1.1
diff -u -r1.1 version.h
--- dct-channel/version.h	28 Oct 2003 21:48:27 -0000	1.1
+++ dct-channel/version.h	31 Oct 2003 20:41:25 -0000
@@ -1,2 +1,2 @@
 /* This file was automatically generated. */
-#define VERSION "1.5 (2003-10-26)"
+#define VERSION "1.6 (2003-10-31)"


More information about the mythtv-dev mailing list