Skip to content

Commit 213a326

Browse files
committed
Add custom printer-state-reasons keyword support, add support for web forms, and document the simple web/REST interface (Issue #142)
1 parent 8e9fdb5 commit 213a326

4 files changed

Lines changed: 182 additions & 67 deletions

File tree

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ v3.0.1 - YYYY-MM-DD
1010
returns "localhost" for a non-loopback address.
1111
- Updated `cupsFileGetConf` and `cupsFilePutConf` to escape more characters.
1212
- Updated `cupsRasterReadHeader` to validate more of the page header values.
13+
- Updated `ippeveprinter` to support custom "printer-state-reasons" keyword
14+
values (Issue #142)
1315
- Fixed a bug when the `ippFindXxx` and `ippSetXxx` functions were mixed
1416
(Issue #138)
1517
- Fixed error handling in the low-level TLS read/write functions.

doc/ippeveprinter.html

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ <h2 id="ippeveprinter-1.options">Options</h2>
187187
Show program usage.
188188
</p>
189189
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>--no-web-forms</strong><br>
190-
Disable the web interface forms used to update the media and supply levels.
190+
Disable the web interface forms used to update the media, state, and supply levels.
191+
See the &quot;WEB INTERFACE FORMS&quot; section for more information.
191192
</p>
192193
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>--pam-service </strong><em>SERVICE</em><br>
193194
Set the PAM service name.
@@ -369,6 +370,29 @@ <h2 id="ippeveprinter-1.command-output">Command Output</h2>
369370
</p>
370371
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>STATE: +</strong><em>keyword[,keyword,...]</em><br>
371372
Adds the listed keywords to the printer's &quot;printer-state-reasons&quot; attribute.
373+
</p>
374+
<h2 id="ippeveprinter-1.web-interface-forms">Web Interface Forms</h2>
375+
<p><strong>ippeveprinter</strong>
376+
provides a simple web interface with forms for updating the current media, state, and supply levels of the printer.
377+
Since these forms offer no security restrictions, they can be disabled using the
378+
<strong>--no-web-forms</strong>
379+
option.
380+
HTTP &quot;GET&quot; requests can be used to update printer values programmatically:
381+
</p>
382+
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>GET /?reasons=</strong><em>KEYWORD[,...,KEYWORD]</em><br>
383+
</p>
384+
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>GET /?reasons=+</strong><em>KEYWORD[,...,KEYWORD]</em><br>
385+
</p>
386+
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>GET /?reasons=-</strong><em>KEYWORD[,...,KEYWORD]</em><br>
387+
Set, add, or remove the specified &quot;printer-state-reasons&quot; keywords.
388+
</p>
389+
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>GET /media?sizeN=</strong><em>SIZE-NAME</em><strong>&amp;typeN=</strong><em>TYPE-NAME</em><strong>&amp;levelN=</strong><em>NUM-SHEETS</em><br>
390+
Update the media size, type, and number of sheets for source N (starting at 0).
391+
Multiple sources can be updated in a single request by adding more sets of form values.
392+
</p>
393+
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>GET /supplies?supplyN=</strong><em>PERCENT</em><br>
394+
Update the current level of supply N (starting at 0).
395+
Multiple supplies can be updated in a single request by adding more form values.
372396
</p>
373397
<h2 id="ippeveprinter-1.examples">Examples</h2>
374398
<p>Run

man/ippeveprinter.1

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
.\" Licensed under Apache License v2.0. See the file "LICENSE" for more
88
.\" information.
99
.\"
10-
.TH ippeveprinter 1 "CUPS" "2026-01-07" "OpenPrinting"
10+
.TH ippeveprinter 1 "CUPS" "2026-03-11" "OpenPrinting"
1111
.SH NAME
1212
ippeveprinter \- an ipp everywhere printer application for cups
1313
.SH SYNOPSIS
@@ -96,7 +96,8 @@ The following options are recognized by
9696
Show program usage.
9797
.TP 5
9898
.B \-\-no\-web\-forms
99-
Disable the web interface forms used to update the media and supply levels.
99+
Disable the web interface forms used to update the media, state, and supply levels.
100+
See the "WEB INTERFACE FORMS" section for more information.
100101
.TP 5
101102
\fB\-\-pam\-service \fISERVICE\fR
102103
Set the PAM service name.
@@ -267,6 +268,28 @@ Removes the listed keywords from the printer's "printer-state-reasons" attribute
267268
.TP 5
268269
\fBSTATE: +\fIkeyword[,keyword,...]\fR
269270
Adds the listed keywords to the printer's "printer-state-reasons" attribute.
271+
.SH WEB INTERFACE FORMS
272+
.B ippeveprinter
273+
provides a simple web interface with forms for updating the current media, state, and supply levels of the printer.
274+
Since these forms offer no security restrictions, they can be disabled using the
275+
.B \-\-no\-web\-forms
276+
option.
277+
HTTP "GET" requests can be used to update printer values programmatically:
278+
.TP 5
279+
\fBGET /?reasons=\fIKEYWORD[,...,KEYWORD]\fR
280+
.TP 5
281+
\fBGET /?reasons=+\fIKEYWORD[,...,KEYWORD]\fR
282+
.TP 5
283+
\fBGET /?reasons=-\fIKEYWORD[,...,KEYWORD]\fR
284+
Set, add, or remove the specified "printer-state-reasons" keywords.
285+
.TP 5
286+
\fBGET /media?sizeN=\fISIZE-NAME\fB&typeN=\fITYPE-NAME\fB&levelN=\fINUM-SHEETS\fR
287+
Update the media size, type, and number of sheets for source N (starting at 0).
288+
Multiple sources can be updated in a single request by adding more sets of form values.
289+
.TP 5
290+
\fBGET /supplies?supplyN=\fIPERCENT\fR
291+
Update the current level of supply N (starting at 0).
292+
Multiple supplies can be updated in a single request by adding more form values.
270293
.SH EXAMPLES
271294
Run
272295
.B ippeveprinter

0 commit comments

Comments
 (0)