Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Manual Duplex Mode (merge) #18

Merged
merged 2 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/canon-lbp.drv
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Copyright "(C)2020 Moses Chong"
ColorModel "Gray/Grayscale" k chunky 2
Filter application/vnd.cups-raster 1 rastertocapt
*Manufacturer "Canon Inc"
Version 0.1.3
Version 0.1.4
{
Font *

Expand All @@ -25,6 +25,10 @@ Version 0.1.3
*Choice False/Disabled "<</cupsInteger0 0>>setpagedevice"
Choice True/Enabled "<</cupsInteger0 1>>setpagedevice"

Option "captManualDuplex/Manual Duplex" Boolean AnySetup 10
*Choice False/Disabled "<</cupsInteger2 0>>setpagedevice"
Choice True/Enabled "<</cupsInteger2 1>>setpagedevice"

{
*Resolution k 1 70 592 0 "600dpi/600 DPI"

Expand Down
1 change: 1 addition & 0 deletions src/paper.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ void page_set_dims(struct page_dims_s *dims, const struct cups_page_header2_s *h
dims->paper_height = header->cupsHeight; //header->PageSize[1] * header->HWResolution[1] / 72;
dims->toner_save = header->cupsInteger[0];
dims->ink_k = header->cupsInteger[1];
dims->manual_duplex = header->cupsInteger[2];
dims->line_size = header->PageSize[0];
dims->num_lines = header->cupsHeight;
dims->band_size = header->cupsRowCount;
Expand Down
1 change: 1 addition & 0 deletions src/paper.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct page_dims_s {
unsigned paper_width;
unsigned paper_height;
unsigned toner_save;
unsigned manual_duplex;
unsigned ink_k;
unsigned margin_height;
unsigned margin_width;
Expand Down
6 changes: 4 additions & 2 deletions src/rastertocapt.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ static void send_page_data(struct printer_state_s *state, const struct cached_pa
static void do_cancel(int s)
{
(void) s;
fprintf(stderr, "DEBUG: CAPT: begin job cancellation cleanup\n");

if (ops)
ops->cancel_cleanup(state);
Expand All @@ -228,7 +227,6 @@ static void do_cancel(int s)
if (state)
free_state();

fprintf(stderr, "DEBUG: CAPT: job cancellation cleanup complete\n");
exit(1);
}

Expand Down Expand Up @@ -280,6 +278,10 @@ static void do_print(int fd)

fprintf(stderr, "DEBUG: CAPT: rastertocapt: start page %u\n", state->ipage);
if (ops->page_prologue) {
if (cached_page->dims.manual_duplex && state->ipage > 1) {
fprintf(stderr, "DEBUG: CAPT: rastertocapt: manual duplex: press button to continue\n");
ops->wait_user(state);
}
bool ok = ops->page_prologue(state, &cached_page->dims);
if (! ok) {
fprintf(stderr, "DEBUG: CAPT: rastertocapt: can't start page\n");
Expand Down