[sane-devel] [sane-commit] [SCM] SANE backends - scanner drivers branch, master, updated. RELEASE_1_0_22-382-g9ed65d3

m. allan noah kitno455 at gmail.com
Fri Aug 10 00:35:50 UTC 2012


I doubt this commit did what you wanted- it moved kodakaio.c to
kodakaio2.c, and it added a doc/missfont.log

allan

On Thu, Aug 9, 2012 at 11:35 AM, Paul Newall <quandry at ntlworld.com> wrote:
> The following commit has been merged in the master branch:
> commit 9ed65d3ea21f6627e4c28a08cebc8d27506cfaa9
> Author: Paul Newall <quandry at ntlworld.com>
> Date:   Thu Aug 9 16:33:41 2012 +0100
>
>     Tidy poll call in kodakaio
>
> diff --git a/ChangeLog b/ChangeLog
> index 972fb98..bcc9ab1 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2012-08-09 Paul Newall <quandry at ntlworld dot com>
> +       * /backend/kodakaio.c:
> +       calling of poll tidied up, may fix problems with repeated scans.
> +
>  2012-07-30 Stéphane Voltz <stef.dev at free.fr>
>         * doc/sane-genesys.man backend/genesys_low.h backend/genesys*.c:
>         rewrite lineart emulation du to bugs exhibited by the use of the
> diff --git a/backend/kodakaio.c b/backend/kodakaio.c
> index ee77de9..8833e3a 100644
> --- a/backend/kodakaio.c
> +++ b/backend/kodakaio.c
> @@ -18,7 +18,7 @@
>
>  /* convenient lines to paste
>  export SANE_DEBUG_KODAKAIO=40
> -./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var BACKENDS=kodakaio
> +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-latex BACKENDS=kodakaio
>  */
>
>  /* SANE-FLOW-DIAGRAM  Kodakaio commands in [] brackets
> @@ -114,7 +114,7 @@ export SANE_DEBUG_KODAKAIO=40
>
>  #define KODAKAIO_VERSION       02
>  #define KODAKAIO_REVISION      4
> -#define KODAKAIO_BUILD         2
> +#define KODAKAIO_BUILD         3
>
>  /* for usb (but also used for net). I don't know if this size will always work */
>  /* #define MAX_BLOCK_SIZE              32768 */
> @@ -186,9 +186,9 @@ normal levels. This system is a plan rather than a reality
>  #define min(x,y) (((x)<(y))?(x):(y))
>
>  /* I think these timeouts are defaults, overridden by any timeouts in the kodakaio.conf file */
> -static int MC_SNMP_Timeout = 2500;
> -static int MC_Scan_Data_Timeout = 40000;
> -static int MC_Request_Timeout = 5000;
> +static int K_SNMP_Timeout = 2500;
> +static int K_Scan_Data_Timeout = 40000;
> +static int K_Request_Timeout = 5000;
>
>  /* This file is used to store directly the raster returned by the scanner for debugging
>  If RawScanPath has no length it will not be created */
> @@ -635,30 +635,39 @@ kodakaio_net_read(struct KodakAio_Scanner *s, unsigned char *buf, size_t wanted,
>  {
>         size_t size, read = 0;
>         struct pollfd fds[1];
> +       int pollreply;
>
>         *status = SANE_STATUS_GOOD;
>
> -       /* poll for data-to-be-read (using MC_Request_Timeout) */
> +       /* poll for data-to-be-read (using K_Request_Timeout) */
>         fds[0].fd = s->fd;
>         fds[0].events = POLLIN;
> -       if (poll (fds, 1, MC_Request_Timeout) <= 0) {
> +       fds[0].revents = 0;
> +       if (pollreply = poll (fds, 1, K_Request_Timeout) <= 0) {
> +               if (pollreply ==0)
> +                       DBG(1, "poll timeout\n");
> +               else
> +                       DBG(1, "poll error\n");
>                 *status = SANE_STATUS_IO_ERROR;
>                 return read;
>         }
> +       else if(fds[0].revents & POLLIN) {
> +               while (read < wanted) {
> +                       size = sanei_tcp_read(s->fd, buf + read, wanted - read);
>
> -       while (read < wanted) {
> -               size = sanei_tcp_read(s->fd, buf + read, wanted - read);
> -
> -               if (size == 0)
> +                       if (size == 0)
>                         break;
>
> -               read += size;
> -       }
> +                       read += size;
> +               }
>
> -       if (read < wanted)
> -               *status = SANE_STATUS_IO_ERROR;
> -       DBG(32, "net read %d bytes:%x,%x,%x,%x,%x,%x,%x,%x\n",read,buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7]);
> -       return read;
> +               if (read < wanted)
> +                       *status = SANE_STATUS_IO_ERROR;
> +               DBG(32, "net read %d bytes:%x,%x,%x,%x,%x,%x,%x,%x\n",read,buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7]);
> +               return read;
> +       }
> +       else
> +               DBG(1, "Unknown problem with poll\n");
>  }
>
>  /* kodak does not pad commands like magicolor, so there's only a write_raw function */
> @@ -1157,15 +1166,15 @@ when you get the ackstring return EOF status
>  */
>         KodakAio_Scanner *s = (KodakAio_Scanner *) handle;
>         SANE_Status status;
> -       int oldtimeout = MC_Request_Timeout;
> +       int oldtimeout = K_Request_Timeout;
>         size_t bytecount;
>
>         /* DBG(8, "%s\n", __func__); */
>
>         /* Temporarily set the poll timeout long instead of short,
>          * because a color scan needs >5 seconds to initialize. Is this needed for kodak?*/
> -       MC_Request_Timeout = MC_Scan_Data_Timeout;
> -       sanei_usb_set_timeout (MC_Scan_Data_Timeout);
> +       K_Request_Timeout = K_Scan_Data_Timeout;
> +       sanei_usb_set_timeout (K_Scan_Data_Timeout);
>         bytecount = k_recv(s, buf, *len, &status);
>         *len = bytecount;
>         s->bytes_unread -= bytecount;
> @@ -1174,7 +1183,7 @@ when you get the ackstring return EOF status
>         only compare 4 bytes because we sometimes get escSS02.. or escSS00.. */
>         if (cmparray(buf,KodakEsp_Ack,4) == 0) status = SANE_STATUS_EOF;
>
> -       MC_Request_Timeout = oldtimeout;
> +       K_Request_Timeout = oldtimeout;
>         sanei_usb_set_timeout (oldtimeout);
>
>         if (status == SANE_STATUS_GOOD)
> @@ -2292,17 +2301,17 @@ attach_one_config(SANEI_Config __sane_unused__ *config, const char *line)
>         } else if (sscanf(line, "snmp-timeout %i\n", &timeout)) {
>                 /* Timeout for SNMP network discovery */
>                 DBG(50, "%s: SNMP timeout set to %d\n", __func__, timeout);
> -               MC_SNMP_Timeout = timeout;
> +               K_SNMP_Timeout = timeout;
>
>         } else if (sscanf(line, "scan-data-timeout %i\n", &timeout)) {
>                 /* Timeout for scan data requests */
>                 DBG(50, "%s: Scan data timeout set to %d\n", __func__, timeout);
> -               MC_Scan_Data_Timeout = timeout;
> +               K_Scan_Data_Timeout = timeout;
>
>         } else if (sscanf(line, "request-timeout %i\n", &timeout)) {
>                 /* Timeout for all other read requests */
>                 DBG(50, "%s: Request timeout set to %d\n", __func__, timeout);
> -               MC_Request_Timeout = timeout;
> +               K_Request_Timeout = timeout;
>
>         } else {
>                 /* TODO: Warning about unparsable line! */
> diff --git a/backend/kodakaio.c b/backend/kodakaio2.c
> similarity index 98%
> copy from backend/kodakaio.c
> copy to backend/kodakaio2.c
> index ee77de9..8833e3a 100644
> --- a/backend/kodakaio.c
> +++ b/backend/kodakaio2.c
> @@ -18,7 +18,7 @@
>
>  /* convenient lines to paste
>  export SANE_DEBUG_KODAKAIO=40
> -./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var BACKENDS=kodakaio
> +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-latex BACKENDS=kodakaio
>  */
>
>  /* SANE-FLOW-DIAGRAM  Kodakaio commands in [] brackets
> @@ -114,7 +114,7 @@ export SANE_DEBUG_KODAKAIO=40
>
>  #define KODAKAIO_VERSION       02
>  #define KODAKAIO_REVISION      4
> -#define KODAKAIO_BUILD         2
> +#define KODAKAIO_BUILD         3
>
>  /* for usb (but also used for net). I don't know if this size will always work */
>  /* #define MAX_BLOCK_SIZE              32768 */
> @@ -186,9 +186,9 @@ normal levels. This system is a plan rather than a reality
>  #define min(x,y) (((x)<(y))?(x):(y))
>
>  /* I think these timeouts are defaults, overridden by any timeouts in the kodakaio.conf file */
> -static int MC_SNMP_Timeout = 2500;
> -static int MC_Scan_Data_Timeout = 40000;
> -static int MC_Request_Timeout = 5000;
> +static int K_SNMP_Timeout = 2500;
> +static int K_Scan_Data_Timeout = 40000;
> +static int K_Request_Timeout = 5000;
>
>  /* This file is used to store directly the raster returned by the scanner for debugging
>  If RawScanPath has no length it will not be created */
> @@ -635,30 +635,39 @@ kodakaio_net_read(struct KodakAio_Scanner *s, unsigned char *buf, size_t wanted,
>  {
>         size_t size, read = 0;
>         struct pollfd fds[1];
> +       int pollreply;
>
>         *status = SANE_STATUS_GOOD;
>
> -       /* poll for data-to-be-read (using MC_Request_Timeout) */
> +       /* poll for data-to-be-read (using K_Request_Timeout) */
>         fds[0].fd = s->fd;
>         fds[0].events = POLLIN;
> -       if (poll (fds, 1, MC_Request_Timeout) <= 0) {
> +       fds[0].revents = 0;
> +       if (pollreply = poll (fds, 1, K_Request_Timeout) <= 0) {
> +               if (pollreply ==0)
> +                       DBG(1, "poll timeout\n");
> +               else
> +                       DBG(1, "poll error\n");
>                 *status = SANE_STATUS_IO_ERROR;
>                 return read;
>         }
> +       else if(fds[0].revents & POLLIN) {
> +               while (read < wanted) {
> +                       size = sanei_tcp_read(s->fd, buf + read, wanted - read);
>
> -       while (read < wanted) {
> -               size = sanei_tcp_read(s->fd, buf + read, wanted - read);
> -
> -               if (size == 0)
> +                       if (size == 0)
>                         break;
>
> -               read += size;
> -       }
> +                       read += size;
> +               }
>
> -       if (read < wanted)
> -               *status = SANE_STATUS_IO_ERROR;
> -       DBG(32, "net read %d bytes:%x,%x,%x,%x,%x,%x,%x,%x\n",read,buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7]);
> -       return read;
> +               if (read < wanted)
> +                       *status = SANE_STATUS_IO_ERROR;
> +               DBG(32, "net read %d bytes:%x,%x,%x,%x,%x,%x,%x,%x\n",read,buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7]);
> +               return read;
> +       }
> +       else
> +               DBG(1, "Unknown problem with poll\n");
>  }
>
>  /* kodak does not pad commands like magicolor, so there's only a write_raw function */
> @@ -1157,15 +1166,15 @@ when you get the ackstring return EOF status
>  */
>         KodakAio_Scanner *s = (KodakAio_Scanner *) handle;
>         SANE_Status status;
> -       int oldtimeout = MC_Request_Timeout;
> +       int oldtimeout = K_Request_Timeout;
>         size_t bytecount;
>
>         /* DBG(8, "%s\n", __func__); */
>
>         /* Temporarily set the poll timeout long instead of short,
>          * because a color scan needs >5 seconds to initialize. Is this needed for kodak?*/
> -       MC_Request_Timeout = MC_Scan_Data_Timeout;
> -       sanei_usb_set_timeout (MC_Scan_Data_Timeout);
> +       K_Request_Timeout = K_Scan_Data_Timeout;
> +       sanei_usb_set_timeout (K_Scan_Data_Timeout);
>         bytecount = k_recv(s, buf, *len, &status);
>         *len = bytecount;
>         s->bytes_unread -= bytecount;
> @@ -1174,7 +1183,7 @@ when you get the ackstring return EOF status
>         only compare 4 bytes because we sometimes get escSS02.. or escSS00.. */
>         if (cmparray(buf,KodakEsp_Ack,4) == 0) status = SANE_STATUS_EOF;
>
> -       MC_Request_Timeout = oldtimeout;
> +       K_Request_Timeout = oldtimeout;
>         sanei_usb_set_timeout (oldtimeout);
>
>         if (status == SANE_STATUS_GOOD)
> @@ -2292,17 +2301,17 @@ attach_one_config(SANEI_Config __sane_unused__ *config, const char *line)
>         } else if (sscanf(line, "snmp-timeout %i\n", &timeout)) {
>                 /* Timeout for SNMP network discovery */
>                 DBG(50, "%s: SNMP timeout set to %d\n", __func__, timeout);
> -               MC_SNMP_Timeout = timeout;
> +               K_SNMP_Timeout = timeout;
>
>         } else if (sscanf(line, "scan-data-timeout %i\n", &timeout)) {
>                 /* Timeout for scan data requests */
>                 DBG(50, "%s: Scan data timeout set to %d\n", __func__, timeout);
> -               MC_Scan_Data_Timeout = timeout;
> +               K_Scan_Data_Timeout = timeout;
>
>         } else if (sscanf(line, "request-timeout %i\n", &timeout)) {
>                 /* Timeout for all other read requests */
>                 DBG(50, "%s: Request timeout set to %d\n", __func__, timeout);
> -               MC_Request_Timeout = timeout;
> +               K_Request_Timeout = timeout;
>
>         } else {
>                 /* TODO: Warning about unparsable line! */
> diff --git a/doc/missfont.log b/doc/missfont.log
> new file mode 100644
> index 0000000..7e54df1
> --- /dev/null
> +++ b/doc/missfont.log
> @@ -0,0 +1 @@
> +mktextfm ptmr7t
>
> --
> SANE backends - scanner drivers
>
>
> _______________________________________________
> sane-commit mailing list
> sane-commit at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-commit



-- 
"The truth is an offense, but not a sin"



More information about the sane-devel mailing list