summaryrefslogtreecommitdiff
path: root/backend/xerox_mfp-usb.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-06-30 15:46:39 +0200
committerJörg Frings-Fürst <debian@jff.email>2024-06-30 15:46:39 +0200
commit73365252941d4053dca0e7fa06f4c205194cf1b8 (patch)
tree3eff4566f12e48cfee6b35955d262e46ee5a5da1 /backend/xerox_mfp-usb.c
parent52c7d661296d9efb9a51b52c38dda22516cf981a (diff)
parent3c9b873509b5c2278d4e345bf86a22c1ff26f3c0 (diff)
Merge branch 'release/debian/1.3.0-1'debian/1.3.0-1
Diffstat (limited to 'backend/xerox_mfp-usb.c')
-rw-r--r--backend/xerox_mfp-usb.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/backend/xerox_mfp-usb.c b/backend/xerox_mfp-usb.c
index 6ef1eea..519aba6 100644
--- a/backend/xerox_mfp-usb.c
+++ b/backend/xerox_mfp-usb.c
@@ -21,6 +21,21 @@
extern int sanei_debug_xerox_mfp;
+static int
+xerox_need_clear_halt()
+{
+ char *env;
+ int workaround = 0;
+
+ env = getenv("SANE_XEROX_USB_HALT_WORKAROUND");
+ if (env) {
+ workaround = atoi(env);
+ DBG(5, "xerox_need_clear_halt: workaround: %d\n", workaround);
+ return workaround;
+ }
+ return 0;
+}
+
int
usb_dev_request(struct device *dev,
SANE_Byte *cmd, size_t cmdlen,
@@ -70,7 +85,9 @@ usb_dev_open(struct device *dev)
dev->dn = -1;
return status;
}
- sanei_usb_clear_halt(dev->dn);
+ if (xerox_need_clear_halt()) {
+ sanei_usb_clear_halt(dev->dn);
+ }
return SANE_STATUS_GOOD;
}
@@ -92,7 +109,9 @@ usb_dev_close(struct device *dev)
ret_cancel(dev, 0);
}
- sanei_usb_clear_halt(dev->dn); /* unstall for next users */
+ if (xerox_need_clear_halt()) {
+ sanei_usb_clear_halt(dev->dn); /* unstall for next users */
+ }
sanei_usb_close(dev->dn);
dev->dn = -1;
}