From aadf66461fa7144680cc55ee77c4a2c7d26a4923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Voltz?= Date: Wed, 23 Oct 2002 05:55:14 +0000 Subject: [PATCH] * backend/umax_pp_low.c: added O_NONBLOCK to flags when opening ppdev character device, to get around hangs with 2.4.19 linux kernels in pure EPP mode. --- ChangeLog | 6 ++++++ backend/umax_pp_low.c | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12d8bded6..a1a7c5390 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-10-23 Stéphane Voltz + + * backend/umax_pp_low.c: added O_NONBLOCK to flags when opening ppdev + character device, to get around hangs with 2.4.19 linux kernels in + pure EPP mode. + 2002-10-20 Henning Meier-Geinitz * README.linux: Added comment about DEC cc on Linux Alpha. diff --git a/backend/umax_pp_low.c b/backend/umax_pp_low.c index bd391bdd7..97cf827c4 100644 --- a/backend/umax_pp_low.c +++ b/backend/umax_pp_low.c @@ -433,7 +433,7 @@ sanei_umax_pp_InitPort (int port, char *name) { /* ppdev opening and configuration */ found = 0; - fd = open (name, O_RDWR | O_NOCTTY); + fd = open (name, O_RDWR | O_NOCTTY | O_NONBLOCK); if (fd < 0) { switch (errno) @@ -609,11 +609,11 @@ sanei_umax_pp_InitPort (int port, char *name) #ifdef HAVE_IOPERM if (port < 0x400) { - if (ioperm (port, 8, 1) != 0) - { - DBG (1, "ioperm could not gain access to 0x%X\n", port); - return (0); - } + if (ioperm (port, 8, 1) != 0) + { + DBG (1, "ioperm could not gain access to 0x%X\n", port); + return (0); + } } /* ECP i/o range */ if (iopl (3) != 0) @@ -675,14 +675,14 @@ Outb (int port, int value) case 2: if (val & 0x20) { - rc = ioctl (fd, PPDATADIR, &val); + rc = ioctl (fd, PPDATADIR, &val); if (rc) DBG (0, "ppdev ioctl returned <%s> (%s:%d)\n", strerror (errno), __FILE__, __LINE__); } else { - rc = ioctl (fd, PPWCONTROL, &val); + rc = ioctl (fd, PPWCONTROL, &val); if (rc) DBG (0, "ppdev ioctl returned <%s> (%s:%d)\n", strerror (errno), __FILE__, __LINE__); @@ -7791,7 +7791,7 @@ sanei_umax_pp_StartScan (int x, int y, int width, int height, int dpi, 0x41, 0xA0, 0x0A, 0x8B, 0x49, 0x2A, 0xE9, 0x68, 0xDF, 0x33, 0x1A, 0x00, -1 }; -#define UMAX_PP_DANGEROUS_EXPERIMENT 666 + #ifdef UMAX_PP_DANGEROUS_EXPERIMENT FILE *f = NULL; char line[1024], *ptr; @@ -8204,9 +8204,9 @@ sanei_umax_pp_StartScan (int x, int y, int width, int height, int dpi, for (i = 0; (i < max) && ((ptr - line) < strlen (line)); i++) { if (ptr[0] != '-') - { - sscanf (ptr, "%X", base + i); - } + { + sscanf (ptr, "%X", base + i); + } ptr += 3; } }