You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.2 KiB
59 lines
1.2 KiB
--- transmit.c 2007/07/29 18:20:13 5.27
|
|
+++ transmit.c 2008/05/11 13:29:47 5.28
|
|
@@ -1,4 +1,4 @@
|
|
-/* $Id: transmit.c,v 5.27 2007/07/29 18:20:13 lirc Exp $ */
|
|
+/* $Id: transmit.c,v 5.28 2008/05/11 13:29:47 lirc Exp $ */
|
|
|
|
/****************************************************************************
|
|
** transmit.c **************************************************************
|
|
@@ -116,6 +116,34 @@
|
|
return(0);
|
|
}
|
|
|
|
+static int check_send_buffer(void)
|
|
+{
|
|
+ int i;
|
|
+
|
|
+ if (send_buffer.wptr == 0)
|
|
+ {
|
|
+ LOGPRINTF(1, "nothing to send");
|
|
+ return(0);
|
|
+ }
|
|
+ for (i = 0; i < send_buffer.wptr; i++)
|
|
+ {
|
|
+ if(send_buffer.data[i] == 0)
|
|
+ {
|
|
+ if(i%2)
|
|
+ {
|
|
+ LOGPRINTF(1, "invalid space: %d", i);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ LOGPRINTF(1, "invalid pulse: %d", i);
|
|
+ }
|
|
+ return 0;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return 1;
|
|
+}
|
|
+
|
|
static inline void flush_send_buffer(void)
|
|
{
|
|
if(send_buffer.pendingp>0)
|
|
@@ -500,5 +528,13 @@
|
|
goto init_send_loop;
|
|
}
|
|
LOGPRINTF(3, "transmit buffer ready");
|
|
- return(1);
|
|
+ if(!check_send_buffer())
|
|
+ {
|
|
+ logprintf(LOG_ERR, "invalid send buffer");
|
|
+ logprintf(LOG_ERR,
|
|
+ "this remote configuration cannot be used "
|
|
+ "to transmit");
|
|
+ return 0;
|
|
+ }
|
|
+ return 1;
|
|
}
|