Version 26 (modified by 10 months ago) ( diff ) | ,
---|
Network Printing CUPS (Graphics Allowed)
825gen2 has CUPS (Common Unix Printing System)
lpinfo -v shows printers that are detected on the network in additional to local USB printers.
card825gen2:/mnt/nfs/arm825_nand/bin$ /usr/sbin/lpinfo -v network socket network lpd network ipp network http direct usb://SANEI/SK1-311%20Presenter%20(STR-001) network dnssd://Canon%20TX-3000._ipp._tcp.local/?uuid=00000000-0000-1000-8000-001832104e5a network dnssd://Canon%20iPR%20Svr%20G250%20V2.1%20US(64%3A59%3AA5)._printer._tcp.local/ network dnssd://HP%20Designjet%20T520%2024in%20%5BD50233%5D._ipp._tcp.local/?uuid=abcd9e8e-4886-85c2-2167-b143d1c2344a network dnssd://HP%20LaserJet%20P2055dn%20%5B82FCF4%5D._pdl-datastream._tcp.local/ network dnssd://Lexmark%20C2240._ipp._tcp.local/?uuid=584bdd81-d230-49f3-a210-d39ac56492d0
To just show any dnssd printers
Many network printers support a protocol known as Bonjour. Bonjour is a combination of zero-configuration networking ("ZeroConf"), multicast DNS (mDNS), and DNS service discovery (DNS-SD) standards published by the Internet Engineering Task Force (IETF), the same group that defined TCP/IP and all of the networking we use today.
card825gen2:~$ /usr/sbin/lpinfo --include-schemes dnssd -v network dnssd://Canon%20TX-3000._ipp._tcp.local/?uuid=00000000-0000-1000-8000-001832104e5a network dnssd://Canon%20iPR%20Svr%20G250%20V2.1%20US(64%3A59%3AA5)._printer._tcp.local/ network dnssd://HP%20Designjet%20T520%2024in%20%5BD50233%5D._ipp._tcp.local/?uuid=abcd9e8e-4886-85c2-2167-b143d1c2344a network dnssd://HP%20LaserJet%20P2055dn%20%5B82FCF4%5D._pdl-datastream._tcp.local/ network dnssd://Lexmark%20C2240._ipp._tcp.local/?uuid=584bdd81-d230-49f3-a210-d39ac56492d0 network dnssd://Lexmark%20C2240%20(3)._ipp._tcp.local/?uuid=925cc9ab-7f13-479a-9a82-d9d01aea2472 network dnssd://Lexmark%20C2240%20(4)._ipp._tcp.local/?uuid=1fb63094-a36c-42e5-885e-ce8ebf5c7e0d network dnssd://Lexmark%20C2240%20(5)._ipp._tcp.local/?uuid=1cf2ae75-abe6-4bf3-b009-375e604a00a2 network dnssd://Lexmark%20C2240%20(6)._ipp._tcp.local/?uuid=04698d71-023d-4da8-a3f5-97d428aea12b network dnssd://Lexmark%20C2240%20(7)._ipp._tcp.local/?uuid=1b72d98c-8ea0-4b33-a08d-78a89dc256e3 network dnssd://Lexmark%20M3150%20(2)._ipp._tcp.local/?uuid=4b9218da-71a9-42cb-858c-e478817ceb19 network dnssd://Lexmark%20M3250._ipp._tcp.local/?uuid=d672042b-7909-47a2-9077-968f58ad923b network dnssd://Lexmark%20M3250%20(10)._ipp._tcp.local/?uuid=29fa91fd-eada-4cbe-bd5d-87fdb24dd92d network dnssd://Lexmark%20M3250%20(14)._ipp._tcp.local/?uuid=67390cc9-aad3-4041-b32d-d5a235d89a39 network dnssd://Lexmark%20M3250%20(2)._ipp._tcp.local/?uuid=876e7e06-54ab-4ca6-a4a6-a80e70f602b5 network dnssd://Lexmark%20M3250%20(3)._ipp._tcp.local/?uuid=50249be5-e50d-4f1a-8739-38ee1f618bd8 network dnssd://Lexmark%20M3250%20(34)._ipp._tcp.local/?uuid=fd53b6a6-3442-4613-921c-2e439ce37d33 network dnssd://Lexmark%20M3250%20(4)._ipp._tcp.local/?uuid=86020859-dbe1-45ad-bdf7-e82dc489e1d5 network dnssd://Lexmark%20M3250%20(5)._ipp._tcp.local/?uuid=e9bc03ef-9a4c-4d84-ad46-8c627e414175 network dnssd://Lexmark%20M3250%20(6)._ipp._tcp.local/?uuid=802f250b-fa5b-43a3-a843-1e8ba23189fa network dnssd://Lexmark%20M3250%20(8)._ipp._tcp.local/?uuid=b56cbbbe-2d78-4ef3-9b7a-297a6237f84d network dnssd://Lexmark%20MS510dn._ipp._tcp.local/?uuid=badd5f81-578d-4e6e-8aa0-715bf8e224b3 network dnssd://Lexmark%20MS510dn%20(10)._ipp._tcp.local/?uuid=588460cb-d756-4d87-9239-9d8e910784e2 network dnssd://Lexmark%20MS510dn%20(12)._ipp._tcp.local/?uuid=22ef395a-2897-4d8d-87de-061f52436e50 network dnssd://Lexmark%20MS510dn%20(13)._ipp._tcp.local/?uuid=127f7806-f38e-497d-b053-f4e3137d11e0 network dnssd://Lexmark%20MS510dn%20(5)._ipp._tcp.local/?uuid=7736e5dc-2015-417e-a637-7bc3c023ebb5 network dnssd://Lexmark%20MS510dn%20(8)._ipp._tcp.local/?uuid=279c0534-9d92-4a33-afb5-8df038e3aa63 network dnssd://Lexmark%20MX811._ipp._tcp.local/?uuid=13ffc623-6864-4b67-8ab0-c8e8d827ebd8 network dnssd://Lexmark%20MX811%20(2)._ipp._tcp.local/?uuid=c9b81317-aa68-45b6-a702-09fab9d329d0 network dnssd://Lexmark%20XM3250%20(2)._ipp._tcp.local/?uuid=641a82cd-4fcf-4b91-9a7a-de09460059f7 network dnssd://Lexmark%20XM3250%20(3)._ipp._tcp.local/?uuid=c0bf69ec-fc3e-43e8-9b9c-61711fecbd34 network dnssd://Lexmark%20XM5365._ipp._tcp.local/?uuid=d0c8af1e-9fd8-4c37-8ba1-b9419d1087d0 network dnssd://SERVER-59A5._ipp._tcp.local/ network dnssd://SHARP%20MX-C304W%20(9300735300)._printer._tcp.local/ network dnssd://VS-300i%40RDG7F157A%20(92)._printer._tcp.local/
CUPS management web pages.
To allow access to the management pages on local network the cupsd.conf file must be edited.
nano /etc/cups/cupsd.conf
# # Configuration file for the CUPS scheduler. See "man cupsd.conf" for a # complete description of this file. # # Log general information in error_log - change "warn" to "debug" # for troubleshooting... LogLevel warn PageLogFormat # Specifies the maximum size of the log files before they are rotated. The value "0" disables log rotation. MaxLogSize 1m # Default error policy for printers ErrorPolicy stop-printer # Only listen for connections from the local machine. #Listen localhost:631 Port 631 Listen /run/cups/cups.sock # Show shared printers on the local network. Browsing Yes BrowseLocalProtocols dnssd # Default authentication type, when authentication is required... DefaultAuthType Basic # Web interface setting... WebInterface Yes # Timeout after cupsd exits if idle (applied only if cupsd runs on-demand - with -l) IdleExitTimeout 60 # Restrict access to the server... <Location /> Order allow,deny Allow @local </Location> # Restrict access to the admin pages... <Location /admin> Order allow,deny Allow @local </Location> # Restrict access to configuration files... <Location /admin/conf> AuthType Default Require user @SYSTEM Order allow,deny Allow @local </Location> # Restrict access to log files... <Location /admin/log> AuthType Default Require user @SYSTEM Order allow,deny Allow @local </Location> # Set the default printer/job policies... <Policy default> # Job/subscription privacy... JobPrivateAccess default JobPrivateValues default SubscriptionPrivateAccess default SubscriptionPrivateValues default # Job-related operations must be done by the owner or an administrator... <Limit Create-Job Print-Job Print-URI Validate-Job> Order deny,allow </Limit> <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document> Require user @OWNER @SYSTEM Order deny,allow </Limit> # All administration operations require an administrator to authenticate... <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices> AuthType Default Require user @SYSTEM Order deny,allow </Limit> # All printer operations require a printer operator to authenticate... <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs> AuthType Default Require user @SYSTEM Order deny,allow </Limit> # Only the owner or an administrator can cancel or authenticate a job... <Limit Cancel-Job CUPS-Authenticate-Job> Require user @OWNER @SYSTEM Order deny,allow </Limit> <Limit All> Order deny,allow </Limit> </Policy> # Set the authenticated printer/job policies... <Policy authenticated> # Job/subscription privacy... JobPrivateAccess default JobPrivateValues default SubscriptionPrivateAccess default SubscriptionPrivateValues default # Job-related operations must be done by the owner or an administrator... <Limit Create-Job Print-Job Print-URI Validate-Job> AuthType Default Order deny,allow </Limit> <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document> AuthType Default Require user @OWNER @SYSTEM Order deny,allow </Limit> # All administration operations require an administrator to authenticate... <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default> AuthType Default Require user @SYSTEM Order deny,allow </Limit> # All printer operations require a printer operator to authenticate... <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs> AuthType Default Require user @SYSTEM Order deny,allow </Limit> # Only the owner or an administrator can cancel or authenticate a job... <Limit Cancel-Job CUPS-Authenticate-Job> AuthType Default Require user @OWNER @SYSTEM Order deny,allow </Limit> <Limit All> Order deny,allow </Limit> </Policy> # Set the kerberized printer/job policies... <Policy kerberos> # Job/subscription privacy... JobPrivateAccess default JobPrivateValues default SubscriptionPrivateAccess default SubscriptionPrivateValues default # Job-related operations must be done by the owner or an administrator... <Limit Create-Job Print-Job Print-URI Validate-Job> AuthType Negotiate Order deny,allow </Limit> <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document> AuthType Negotiate Require user @OWNER @SYSTEM Order deny,allow </Limit> # All administration operations require an administrator to authenticate... <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default> AuthType Default Require user @SYSTEM Order deny,allow </Limit> # All printer operations require a printer operator to authenticate... <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs> AuthType Default Require user @SYSTEM Order deny,allow </Limit> # Only the owner or an administrator can cancel or authenticate a job... <Limit Cancel-Job CUPS-Authenticate-Job> AuthType Negotiate Require user @OWNER @SYSTEM Order deny,allow </Limit> <Limit All> Order deny,allow </Limit> </Policy>
The line localhost:631 limits access so that only the page could only be accessed from the 825 itself. Commented this out be placing # in front and added line Port 631 below it.
Added Allow @local just above each of the four </Location> lines.
Then restart the cups service
sudo systemctl restart cups
The cups management pages should appear at http://<ip_address_of_indicator>:631
It is showing "Not found" but it is shows "CUPS v2.4.2" so it seems the cups web server is running but some page information is missing.
Adding "/admin" to the url shows the administration page, but it is missing style information.
After some research it seems the Yocto recipe "cups-doc" is needed to provide the static page information such as index.html and cups.css. This was added in the 825 image build 2024-01-16. This fixed the problem.
Check a Windows PC that is already configured to use the desired network printer.
This shows the IP address of the printer.
Click "Administration" on the 825 CUPS page.
Click "Add Printer."
Type the username and password. Click "Sign in".
Select the printer that looks correct in the list and click "Continue".
Make sure the IP address shown matches. The name and description may be changed may be changed if desired. Click "Continue".
Select the "Model:" "driverless" and click "Add Printer".
Click "Set Default Options."
The page should change to show "default options have been set successfully."
Select the maintenance drop down.
Select "Print Test Page."
This feature does not currently work. Will investigate further.
Maybe printer test page is also part of cups-doc recipe.
card825gen2:~$ cat /home/admin/test.txt test 123
card825gen2:~$ lp -d "Canon_iR-ADV_4545_4551_III_UFR_II" /home/admin/test.txt request id is Canon_iR-ADV_4545_4551_III_UFR_II-31 (1 file(s))
Page printed with top line "test 123" successfully
card825gen2:~$ lp -d "Canon_iR-ADV_4545_4551_III_UFR_II" /usr/images/startup.png request id is Canon_iR-ADV_4545_4551_III_UFR_II-32 (1 file(s))
The PNG file did not print.
card825gen2:~$ lp -d "Canon_iR-ADV_4545_4551_III_UFR_II" /usr/images/cardinal_logo.bmp request id is Canon_iR-ADV_4545_4551_III_UFR_II-33 (1 file(s))
The cardinal_logo did print.
Maybe png files do not work, but bmp files do.
Printing from application code.
#include <stdio.h> #include <cairo.h> #include <cairo-ps.h> #include <cups/cups.h> #include "cairobmp.h" #define WIDTH 480 #define HEIGHT 500 int main(int argc, char **argv) { int n; char tmpFilepath[] = "/tmp/tktprtXXXXXX"; // mkstemp(tmpFilepath); strcpy(tmpFilepath, "/tmp/tkt.bmp"); // TODO Easier name just for testing printf("tmpFilename [%s]\n", tmpFilepath); cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_A1, WIDTH, HEIGHT); printf("after surface create %d\n", cairo_surface_get_type(surface)); cairo_t *context = cairo_create(surface); LoadBMPToSurface("/usr/images/cardinal_logo.bmp", surface, 0, 0); // draw some text cairo_select_font_face(context, "Arial Black", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size(context, 30); int x = 20; int y = 140; cairo_move_to(context, x, y); cairo_show_text(context, "Item 1"); // the text we got as a parameter y += 30; cairo_move_to(context, x, y); cairo_show_text(context, "Item 2"); // the text we got as a parameter y += 30; cairo_move_to(context, x, y); cairo_show_text(context, "Item 3"); // the text we got as a parameter // draw a dotted box const double pattern[] = { 15.0, 10.0 }; cairo_set_dash(context, pattern, 2, 0); cairo_set_line_width(context, 5); cairo_rectangle(context, 5, 105, 400, 300); cairo_stroke(context); // finish up cairo_show_page(context); cairo_destroy(context); cairo_surface_flush(surface); CairoSurfaceToBMP(surface, tmpFilepath); cairo_surface_destroy(surface); const char *printerName = "STARSK1_311"; n = cupsPrintFile(printerName, tmpFilepath, "825 ticket", 0, NULL); // return value is job ID printf("cupsPrintFile result %d\n", n); //unlink(tmpFilepath); // TODO This is commented to allow testing - after testing is done uncomment so after print the tmp file will be deleted return 0; }
Attachments (17)
- cups_mainpage.png (52.4 KB ) - added by 11 months ago.
- cups_admin.png (45.1 KB ) - added by 11 months ago.
- cups_add_printer1.png (41.5 KB ) - added by 11 months ago.
- cups_add_printer2.png (30.7 KB ) - added by 11 months ago.
- cups_add_printer3.png (21.5 KB ) - added by 11 months ago.
- windows_printer_properties.png (21.3 KB ) - added by 11 months ago.
- cups_add_printer_name.png (27.0 KB ) - added by 11 months ago.
- cups_add_printer_model.png (35.2 KB ) - added by 11 months ago.
- cups_sign_in.png (10.2 KB ) - added by 11 months ago.
- cups_printer_info.png (45.8 KB ) - added by 11 months ago.
- cups_unable_to_print_test_page.png (20.1 KB ) - added by 11 months ago.
- cups_maintenance_dropdown.png (11.5 KB ) - added by 11 months ago.
- cups_set_printer_options.png (27.6 KB ) - added by 11 months ago.
- cups_set_default_options_success.png (24.6 KB ) - added by 11 months ago.
- cups_jobs1.png (26.7 KB ) - added by 11 months ago.
- cups_jobs2.png (42.0 KB ) - added by 11 months ago.
- 825setup_cups.png (22.8 KB ) - added by 9 months ago.
Download all attachments as: .zip