diff --git a/include/ptouch.h b/include/ptouch.h index bb199be..1e5c21b 100644 --- a/include/ptouch.h +++ b/include/ptouch.h @@ -62,6 +62,10 @@ struct _pt_dev_info { Brother "Software Developer's Manual - Raster Command Reference, PT-P900/P900W/P950NW", section 2.3.5 "Raster line". 0 = centred. */ int pin_offset; + /* Seconds to wait for a status response when the user did not ask for a + particular --timeout. 0 means use the global default; a printer only + needs an entry here if the global default is too short for it. */ + int min_timeout; }; typedef struct _pt_dev_info *pt_dev_info; diff --git a/src/libptouch.c b/src/libptouch.c index 212214b..4847bb9 100644 --- a/src/libptouch.c +++ b/src/libptouch.c @@ -107,7 +107,7 @@ struct _pt_dev_info ptdevs[] = { /* 3,5/6/9/12/18 mm TZe Tapes, 12mm and 18mm tested */ /* 5,2/9/11,2 mm HSe heat shrink tubes not tested, probably requiring extension of struct _pt_tape_info */ {0x04f9, 0x2201, "PT-E310BT", 128, 180, FLAG_P700_INIT|FLAG_USE_INFO_CMD|FLAG_D460BT_MAGIC, 0}, - {0x04f9, 0x2203, "PT-E560BT", 128, 180, FLAG_P700_INIT|FLAG_USE_INFO_CMD|FLAG_D460BT_MAGIC, 0}, + {0x04f9, 0x2203, "PT-E560BT", 128, 180, FLAG_P700_INIT|FLAG_USE_INFO_CMD|FLAG_D460BT_MAGIC, 0, 10}, {0,0,"",0,0,0,0} }; diff --git a/src/ptouch-print.c b/src/ptouch-print.c index 54a4feb..c1dff6e 100644 --- a/src/ptouch-print.c +++ b/src/ptouch-print.c @@ -108,7 +108,7 @@ static struct argp_option options[] = { { "writepng", 'w', "", OPTION_ALIAS, "alias for write-png", 1}, { "force-tape-width", 6, "", 0, "Set tape width in pixels, use together with --writepng without a printer connected", 1}, { "copies", 7, "", 0, "Sets the number of identical prints", 1}, - { "timeout", 8, "", 0, "Set timeout waiting for finishing previous job. Default:1, 0 means infinity", 1}, + { "timeout", 8, "", 0, "Set timeout waiting for finishing previous job. Default:1, or a per-printer minimum where one is known. 0 means infinity", 1}, { 0, 0, 0, 0, "print commands:", 2}, { "image", 'i', "", 0, "Print the given image which must be a 2 color (black/white) png", 2}, @@ -141,7 +141,7 @@ struct arguments arguments = { .forced_tape_width = 0, .save_png = NULL, .verbose = 0, - .timeout = 1 + .timeout = -1 /* -1 = not given; 0 is already "infinity" */ }; job_t *jobs = NULL; @@ -751,6 +751,12 @@ int main(int argc, char *argv[]) if (ptouch_init(ptdev) != 0) { printf(_("ptouch_init() failed\n")); } + /* Resolve the timeout only now, because it can depend on which + printer answered. An explicit --timeout always wins. */ + if (arguments.timeout < 0) { + arguments.timeout = ptdev->devinfo->min_timeout > 0 + ? ptdev->devinfo->min_timeout : 1; + } if (ptouch_getstatus(ptdev, arguments.timeout) != 0) { printf(_("ptouch_getstatus() failed\n")); return 1;