summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-02-16 09:32:02 -0500
committerSolomon Peachy <pizza@shaftnet.org>2018-02-16 09:37:47 -0500
commit4231ae1fec727fe599b92e4816b262383552fc7c (patch)
tree303056343967a1c3fa48812a369e6de9683c4e0d
parentddd39af7b8ebfb86a92d7558b1ef2a2a7cd9cc85 (diff)
downloadselphy_print-4231ae1fec727fe599b92e4816b262383552fc7c.tar.gz
selphy_print-4231ae1fec727fe599b92e4816b262383552fc7c.tar.bz2
selphy_print-4231ae1fec727fe599b92e4816b262383552fc7c.zip
common: Set the altsetting only if there's more than one option.
Make the errors a bit more meaningful.
-rw-r--r--backend_common.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/backend_common.c b/backend_common.c
index b79eda8..2b74383 100644
--- a/backend_common.c
+++ b/backend_common.c
@@ -71,7 +71,7 @@ static int backend_claim_interface(struct libusb_device_handle *dev, int iface,
} while (1);
if (ret)
- ERROR("Printer open failure (%d)\n", ret);
+ ERROR("Failed to claim interface %d (%d)\n", iface, ret);
return ret;
}
@@ -448,9 +448,12 @@ candidate:
goto abort_release;
}
- /* Use the appropriate altesetting! */
- if (altset != 0) {
+ /* Use the appropriate altesetting, but only if the
+ printer supports more than one. Some printers don't like
+ us unconditionally setting this. */
+ if (config->interface[iface].num_altsetting > 1) {
if (libusb_set_interface_alt_setting(dev, iface, altset)) {
+ ERROR("Failed to set alternative interface %d/%d\n", iface, altset);
found = -1;
goto abort_release;
}