tags 352106 + patch thanks Alex Henry Ribeiro dos Santos <[EMAIL PROTECTED]> writes:
> Package: escputil > Version: 4.3.99+cvs20060121.dfsg.1-1 > Severity: normal > > I have an Epson Stylus C42SX and I'm using CUPS and cupsys-bsd. > I get the following output when trying to align heads using the -P option > (All output was manually translated from > brazilian portuguese to english by myself): > > # escputil -a -P C42SX -m escp2-c42sx > Wasn't able to open (null) read/write: Invalid Adress The following patch is intended to fix this with a more informative error. I'm just waiting for upstream approval. Regards, Roger Index: escputil.c =================================================================== RCS file: /cvsroot/gimp-print/print/src/escputil/escputil.c,v retrieving revision 1.86 diff -u -r1.86 escputil.c --- escputil.c 28 May 2006 16:59:03 -0000 1.86 +++ escputil.c 30 May 2006 16:59:26 -0000 @@ -424,7 +424,7 @@ exit(0); } -void +static void print_debug_data(const char *buf, size_t count) { int i; @@ -737,6 +737,28 @@ alarm_interrupt = 1; } +static int +open_raw_device(void) +{ + int fd; + + if (!raw_device) + { + fprintf(stderr, _("Please specify a raw device\n")); + exit(1); + } + + fd = open(raw_device, O_RDWR, 0666); + if (fd == -1) + { + fprintf(stderr, _("Cannot open %s read/write: %s\n"), raw_device, + strerror(errno)); + exit(1); + } + + return fd; +} + static const stp_printer_t * initialize_printer(int quiet, int fail_if_not_found) { @@ -757,13 +779,7 @@ quiet = 0; - fd = open(raw_device, O_RDWR, 0666); - if (fd == -1) - { - fprintf(stderr, _("Cannot open %s read/write: %s\n"), raw_device, - strerror(errno)); - exit(1); - } + fd = open_raw_device(); if (!printer_model) { @@ -1349,13 +1365,7 @@ printer_model, printer ? "" : "(Unknown model)")); - fd = open(raw_device, O_RDWR, 0666); - if (fd == -1) - { - fprintf(stderr, _("Cannot open %s read/write: %s\n"), raw_device, - strerror(errno)); - exit(1); - } + fd = open_raw_device(); if (isnew) { @@ -1463,13 +1473,7 @@ "Warning! Printer %s is not known; information may be incomplete or incorrect\n", printer_model); - fd = open(raw_device, O_RDWR, 0666); - if (fd == -1) - { - fprintf(stderr, _("Cannot open %s read/write: %s\n"), raw_device, - strerror(errno)); - exit(1); - } + fd = open_raw_device(); if (isnew) { -- Roger Leigh Printing on GNU/Linux? http://gutenprint.sourceforge.net/ Debian GNU/Linux http://www.debian.org/ GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
pgp6ApuqmdGCj.pgp
Description: PGP signature