kopia lustrzana https://gitlab.com/sane-project/backends
Rewrote indirect "adf_mode" code to be more direct
Replaced the clever, yet totally confusing, code using the "adf_mode" variable. This variable was used with a complex interaction of bit shifts and subtraction indirectly influnced by the value of s->source_mode. The replacement code direct references s->source_mode instead, simplifying things greatly. This change is functionally identical. As a side note, the adf_mode code allowed "ADF Rear" scanners, in addition to "ADF Duplex" scanners, to enter the section of code normally used for (HP) duplex scanners. It's not clear if this was the intended effect, or if, as the comments suggest, this was an unnoticed side effect caused by the confusing code. The point is moot, however, because prior in the code, the ADF Duplex flag is set anytime the ADF Rear flag is set. As long as all ADF Rear scanners are duplex scanners this shouldn't be a problem.merge-requests/1/head
rodzic
8bd4e454ca
commit
046441ad6c
|
@ -5549,40 +5549,29 @@ set_window (Avision_Scanner* s)
|
|||
/* ADF scan? */
|
||||
DBG (3, "set_window: source mode %d source mode dim %d\n",
|
||||
s->source_mode, s->source_mode_dim);
|
||||
{
|
||||
int adf_mode = 0; /* offset by 1 to save a is_adf bool */
|
||||
switch (s->source_mode) {
|
||||
case AV_ADF:
|
||||
adf_mode = 1;
|
||||
break;
|
||||
case AV_ADF_REAR:
|
||||
adf_mode = 2;
|
||||
break;
|
||||
case AV_ADF_DUPLEX:
|
||||
adf_mode = 3;
|
||||
break;
|
||||
default:
|
||||
; /* silence GCC */
|
||||
}
|
||||
if (adf_mode) {
|
||||
|
||||
if (s->source_mode == AV_ADF ||
|
||||
s->source_mode == AV_ADF_REAR ||
|
||||
s->source_mode == AV_ADF_DUPLEX) {
|
||||
DBG (3, "set_window: filling ADF bits\n");
|
||||
SET_BIT (cmd.window.avision.bitset1, 7);
|
||||
adf_mode--;
|
||||
|
||||
/* normal, interlaced duplex scanners */
|
||||
if (dev->inquiry_duplex_interlaced) {
|
||||
DBG (3, "set_window: interlaced duplex type\n");
|
||||
cmd.window.avision.type.normal.bitset3 |= (adf_mode << 3);
|
||||
if (s->source_mode == AV_ADF_REAR) {
|
||||
SET_BIT(cmd.window.avision.type.normal.bitset3, 3); /* 0x08 */
|
||||
}
|
||||
else /* HP 2-pass duplex */
|
||||
{
|
||||
if (adf_mode) /* if duplex */
|
||||
if (s->source_mode == AV_ADF_DUPLEX) {
|
||||
SET_BIT(cmd.window.avision.type.normal.bitset3, 4); /* 0x10 */
|
||||
}
|
||||
}
|
||||
else if (s->source_mode == AV_ADF_DUPLEX) /* HP 2-pass duplex */
|
||||
{
|
||||
DBG (3, "set_window: non-interlaced duplex type (HP)\n");
|
||||
/* MIRR 0x04 | FLIP 0x02 | DPLX 0x01 ... */
|
||||
cmd.window.avision.type.normal.bitset3 |= 7;
|
||||
}
|
||||
}
|
||||
SET_BIT(cmd.window.avision.type.normal.bitset3, 0); /* DPLX 0x01 */
|
||||
SET_BIT(cmd.window.avision.type.normal.bitset3, 1); /* FLIP 0x02 */
|
||||
SET_BIT(cmd.window.avision.type.normal.bitset3, 2); /* MIRR 0x04 */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue