summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Lagendijk <louis.lagendijk@gmail.com>2017-01-06 23:28:31 +0100
committerLouis Lagendijk <louis.lagendijk@gmail.com>2017-01-06 23:28:31 +0100
commit6c439bce791522aa9cd3fc04cf62087bdd6c6875 (patch)
tree7f96014af01f37d05f48a252d758bc7e9ec915ff
parent06b4b27ecfad1aa30c772fa0fac15d1c144c1e7a (diff)
Revert "pixma_mp150.c: replace multiple if statements with case statement in handle_interrupt"
This reverts commit 28dcd0aef4ac91b87527c17c8aa89e879f39f20d.
-rw-r--r--backend/pixma_mp150.c76
1 files changed, 35 insertions, 41 deletions
diff --git a/backend/pixma_mp150.c b/backend/pixma_mp150.c
index 5aba2de..e815d59 100644
--- a/backend/pixma_mp150.c
+++ b/backend/pixma_mp150.c
@@ -956,47 +956,41 @@ handle_interrupt (pixma_t * s, int timeout)
* tt: target
* rr: scan resolution
* poll event with 'scanimage -A' */
- switch (s->cfg->pid)
- {
- case MG6200_PID:
- case MG6300_PID:
- case MX520_PID:
- case MX720_PID:
- case MX920_PID:
- case MB5000_PID:
-
- /* button no. in buf[7]
- * size in buf[10] 01=A4; 02=Letter; 08=10x15; 09=13x18; 0b=auto
- * format in buf[11] 01=JPEG; 02=TIFF; 03=PDF; 04=Kompakt-PDF
- * dpi in buf[12] 01=75; 02=150; 03=300; 04=600
- * target = format; original = size; scan-resolution = dpi */
-
- if (buf[7] & 1)
- s->events = PIXMA_EV_BUTTON1 | buf[11] | buf[10]<<8 | buf[12]<<16; /* color scan */
- if (buf[7] & 2)
- s->events = PIXMA_EV_BUTTON2 | buf[11] | buf[10]<<8 | buf[12]<<16; /* b/w scan */
- break;
-
- default:
-
- /* button no. in buf[0]
- * original in buf[0]
- * target in buf[1] */
-
- /* More than one event can be reported at the same time. */
- if (buf[3] & 1)
- /* FIXME: This function makes trouble with a lot of scanners
- send_time (s);
- */
- PDBG (pixma_dbg (1, "WARNING:send_time() disabled!\n"));
- if (buf[9] & 2)
- query_status (s);
- if (buf[0] & 2)
- s->events = PIXMA_EV_BUTTON2 | buf[1] | ((buf[0] & 0xf0) << 4); /* b/w scan */
- if (buf[0] & 1)
- s->events = PIXMA_EV_BUTTON1 | buf[1] | ((buf[0] & 0xf0) << 4); /* color scan */
- break;
- }
+ if (s->cfg->pid == MG6200_PID
+ || s->cfg->pid == MG6300_PID
+ || s->cfg->pid == MX520_PID
+ || s->cfg->pid == MX720_PID
+ || s->cfg->pid == MX920_PID
+ || s->cfg->pid == MB5000_PID)
+ /* button no. in buf[7]
+ * size in buf[10] 01=A4; 02=Letter; 08=10x15; 09=13x18; 0b=auto
+ * format in buf[11] 01=JPEG; 02=TIFF; 03=PDF; 04=Kompakt-PDF
+ * dpi in buf[12] 01=75; 02=150; 03=300; 04=600
+ * target = format; original = size; scan-resolution = dpi */
+ {
+ if (buf[7] & 1)
+ s->events = PIXMA_EV_BUTTON1 | buf[11] | buf[10]<<8 | buf[12]<<16; /* color scan */
+ if (buf[7] & 2)
+ s->events = PIXMA_EV_BUTTON2 | buf[11] | buf[10]<<8 | buf[12]<<16; /* b/w scan */
+ }
+ else
+ /* button no. in buf[0]
+ * original in buf[0]
+ * target in buf[1] */
+ {
+ /* More than one event can be reported at the same time. */
+ if (buf[3] & 1)
+ /* FIXME: This function makes trouble with a lot of scanners
+ send_time (s);
+ */
+ PDBG (pixma_dbg (1, "WARNING:send_time() disabled!\n"));
+ if (buf[9] & 2)
+ query_status (s);
+ if (buf[0] & 2)
+ s->events = PIXMA_EV_BUTTON2 | buf[1] | ((buf[0] & 0xf0) << 4); /* b/w scan */
+ if (buf[0] & 1)
+ s->events = PIXMA_EV_BUTTON1 | buf[1] | ((buf[0] & 0xf0) << 4); /* color scan */
+ }
return 1;
}