aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-09-08 19:00:46 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-09-08 19:00:46 +0000
commit55c3aae4044ca2115ba12194faa4e834e7899909 (patch)
tree63f5cd5775c83cab4677938acbcfd09a5eb32936
parent940f0517d1272e195e7b14be567b9002811f6146 (diff)
downloadlcd4linux-55c3aae4044ca2115ba12194faa4e834e7899909.tar.gz
[lcd4linux @ 2006-09-08 19:00:46 by reinelt]
give up after 10 write errors to serial device git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@709 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--drv_Trefon.c8
-rw-r--r--drv_USBLCD.c9
-rw-r--r--drv_generic_serial.c35
3 files changed, 32 insertions, 20 deletions
diff --git a/drv_Trefon.c b/drv_Trefon.c
index 1dfb243..2e02977 100644
--- a/drv_Trefon.c
+++ b/drv_Trefon.c
@@ -1,4 +1,4 @@
-/* $Id: drv_Trefon.c,v 1.6 2006/01/30 06:25:54 reinelt Exp $
+/* $Id: drv_Trefon.c,v 1.7 2006/09/08 19:00:46 reinelt Exp $
*
* driver for TREFON USB LCD displays - http://www.trefon.de
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv_Trefon.c,v $
+ * Revision 1.7 2006/09/08 19:00:46 reinelt
+ * give up after 10 write errors to serial device
+ *
* Revision 1.6 2006/01/30 06:25:54 reinelt
* added CVS Revision
*
@@ -97,7 +100,6 @@ static usb_dev_handle *lcd;
static int interface;
extern int usb_debug;
-extern int got_signal;
/****************************************/
@@ -351,7 +353,7 @@ int drv_TF_init(const char *section, const int quiet)
int asc255bug;
int ret;
- info("%s: %s", Name, "$Revision: 1.6 $");
+ info("%s: %s", Name, "$Revision: 1.7 $");
/* display preferences */
XRES = 5; /* pixel width of one char */
diff --git a/drv_USBLCD.c b/drv_USBLCD.c
index f59ca8d..847a99a 100644
--- a/drv_USBLCD.c
+++ b/drv_USBLCD.c
@@ -1,4 +1,4 @@
-/* $Id: drv_USBLCD.c,v 1.24 2006/01/30 06:25:54 reinelt Exp $
+/* $Id: drv_USBLCD.c,v 1.25 2006/09/08 19:00:46 reinelt Exp $
*
* new style driver for USBLCD displays
*
@@ -26,6 +26,9 @@
*
*
* $Log: drv_USBLCD.c,v $
+ * Revision 1.25 2006/09/08 19:00:46 reinelt
+ * give up after 10 write errors to serial device
+ *
* Revision 1.24 2006/01/30 06:25:54 reinelt
* added CVS Revision
*
@@ -190,8 +193,6 @@ extern int usb_debug;
#endif
-extern int got_signal;
-
/****************************************/
@@ -504,7 +505,7 @@ int drv_UL_init(const char *section, const int quiet)
int asc255bug;
int ret;
- info("%s: %s", Name, "$Revision: 1.24 $");
+ info("%s: %s", Name, "$Revision: 1.25 $");
/* display preferences */
XRES = 5; /* pixel width of one char */
diff --git a/drv_generic_serial.c b/drv_generic_serial.c
index 4644903..b34d117 100644
--- a/drv_generic_serial.c
+++ b/drv_generic_serial.c
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_serial.c,v 1.17 2005/05/08 04:32:44 reinelt Exp $
+/* $Id: drv_generic_serial.c,v 1.18 2006/09/08 19:00:46 reinelt Exp $
*
* generic driver helper for serial and usbserial displays
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv_generic_serial.c,v $
+ * Revision 1.18 2006/09/08 19:00:46 reinelt
+ * give up after 10 write errors to serial device
+ *
* Revision 1.17 2005/05/08 04:32:44 reinelt
* CodingStyle added and applied
*
@@ -153,6 +156,8 @@
#include "drv_generic_serial.h"
+extern int got_signal;
+
static char *Section;
static char *Driver;
static char *Port;
@@ -412,33 +417,37 @@ int drv_generic_serial_read(char *string, const int len)
void drv_generic_serial_write(const char *string, const int len)
{
+ static int error = 0;
int run, ret;
-#if 0
- int i;
- for (i = 0; i < len; i++) {
- int c = string[i];
- debug("serial_write: %03d %03o 0x%02x %c", c, c, c, iscntrl(c) ? '*' : c);
- }
-#endif
-
- if (Device == -1)
+ if (Device == -1) {
+ error("%s: write to closed port %s failed!", Driver, Port);
return;
+ }
+
for (run = 0; run < 10; run++) {
ret = write(Device, string, len);
- if (ret >= 0 || errno != EAGAIN)
+ if (ret >= 0 || errno != EAGAIN) {
break;
- if (run > 0)
+ }
+ /* EAGAIN: retry 10 times, emit message after 2nd retry */
+ if (run > 0) {
info("%s: write(%s): EAGAIN #%d", Driver, Port, run);
+ }
usleep(1000);
}
if (ret < 0) {
error("%s: write(%s) failed: %s", Driver, Port, strerror(errno));
+ if (++error > 10) {
+ error("%s: too much errors, giving up", Driver);
+ got_signal = -1;
+ }
} else if (ret != len) {
error("%s: partial write(%s): len=%d ret=%d", Driver, Port, len, ret);
+ } else {
+ error = 0;
}
-
return;
}
les.git/commit/dvb-t/uk-Tacolneston?h=debian/0%2bgit20171226.07b18ec-1&id=00e9001c2022e3c2a9f6dbe9946cc8b0481228d4&follow=1'>Imported Upstream version 0+git20150208.f2053b3upstream/0+git20150208.f2053b3Jonathan McCrohan32-333/+483 2014-12-28Release 0+git20141218.b46a22c-1debian/0+git20141218.b46a22c-1Jonathan McCrohan1-2/+2 2014-12-28Updated AU DVB-T files; Thanks Brian Burch! (Closes LP: #1393280)Jonathan McCrohan1-0/+1 2014-12-28New Upstream Snapshot (commit b46a22c)Jonathan McCrohan1-0/+6 2014-12-28Imported Upstream version 0+git20141218.b46a22cupstream/0+git20141218.b46a22cJonathan McCrohan535-639/+317 2014-10-20Release 0+git20141009.d26b627-1debian/0+git20141009.d26b627-1Jonathan McCrohan1-2/+2 2014-10-20Fix up packaging to account for move to DVBv5Jonathan McCrohan2-2/+6 2014-10-20delete d/dtv-scan-files.install; Upstream now supplies a MakefileJonathan McCrohan2-4/+1 2014-10-15d/control: update Standards Version to 3.9.6Jonathan McCrohan2-1/+3 2014-10-15d/control: add Build-Depends on dvb-toolsJonathan McCrohan2-1/+2 2014-10-15New Upstream Snapshot (commit d26b627)Jonathan McCrohan1-0/+10 2014-10-15Imported Upstream version 0+git20141009.d26b627upstream/0+git20141009.d26b627Jonathan McCrohan2010-11120/+159271 2014-07-23Release 0+git20140611.14bd6c7-1debian/0+git20140611.14bd6c7-1Jonathan McCrohan1-2/+2 2014-07-23New Upstream Snapshot (commit 14bd6c7)Jonathan McCrohan1-2/+3 2014-07-23Imported Upstream version 0+git20140611.14bd6c7upstream/0+git20140611.14bd6c7Jonathan McCrohan7-11/+60 2014-05-13New Upstream Snapshot (commit 1246b27)Jonathan McCrohan1-0/+6 2014-05-13Imported Upstream version 0+git20140512.1246b27upstream/0+git20140512.1246b27Jonathan McCrohan391-301/+3983 2014-04-05Release 0+git20140326.cfc2975-1debian/0+git20140326.cfc2975-1Jonathan McCrohan1-2/+2 2014-04-05d/control: update Homepage (upstream has moved from Gitweb to cgit)Jonathan McCrohan2-1/+2 2014-04-05New Upstream Snapshot (commit cfc2975)Jonathan McCrohan1-0/+6 2014-04-05Imported Upstream version 0+git20140326.cfc2975upstream/0+git20140326.cfc2975Jonathan McCrohan118-656/+877 2014-01-16Release 0+git20140107.1850cf8-1debian/0+git20140107.1850cf8-1Jonathan McCrohan1-2/+2 2014-01-16Update Standards Version to 3.9.5Jonathan McCrohan2-1/+9