Hi all,
When trying to print a test page in the final stage of hp-setup, the following error occurs: Printing test page to printer ENVY_4520... lpr: ENVY_4520: unknown printer error: Print command failed with exit code 256! This is because /usr/bin/lpr comes before /usr/local/bin/lpr in the PATH environment variable. Here's my fix. I don't use the HPLIP GUI, but I applied the same fix to all occurrences. Ciao, David Index: print/hplip/Makefile =================================================================== RCS file: /cvs/ports/print/hplip/Makefile,v retrieving revision 1.211 diff -u -p -u -p -r1.211 Makefile --- print/hplip/Makefile 7 Jun 2023 15:45:56 -0000 1.211 +++ print/hplip/Makefile 28 Sep 2023 05:40:49 -0000 @@ -18,6 +18,9 @@ PKGNAME-hpcups= hpcups-${V} PKGNAME-hpijs= hpijs-${V} PKGNAME-gui= hplip-gui-${V} +REVISION-main = 0 +REVISION-gui = 0 + SHARED_LIBS += hpdiscovery 0.0 # 0.1 SHARED_LIBS += hpmud 2.0 # 0.6 SHARED_LIBS += hpipp 0.0 # 0.1 @@ -184,6 +187,7 @@ pre-configure: ${WRKSRC}/ui4/devmgr5.py \ ${WRKSRC}/fax/backend/hpfax.py \ ${WRKSRC}/base/codes.py \ + ${WRKSRC}/base/device.py \ ${WRKSRC}/base/g.py \ ${WRKSRC}/base/queues.py \ ${WRKSRC}/base/services.py \ @@ -202,8 +206,11 @@ pre-configure: ${WRKSRC}/scan.py \ ${WRKSRC}/setup.py \ ${WRKSRC}/ui4/nodevicesdialog.py \ + ${WRKSRC}/ui4/printsettingstoolbox.py \ + ${WRKSRC}/ui5/printsettingstoolbox.py \ ${WRKSRC}/ui/devmgr4.py \ ${WRKSRC}/ui/nodevicesform.py \ + ${WRKSRC}/ui/scrollprint.py \ ${WRKSRC}/logcapture.py \ ${WRKSRC}/createPPD.sh Index: print/hplip/patches/patch-base_device_py =================================================================== RCS file: print/hplip/patches/patch-base_device_py diff -N print/hplip/patches/patch-base_device_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ print/hplip/patches/patch-base_device_py 28 Sep 2023 05:40:49 -0000 @@ -0,0 +1,15 @@ +Index: base/device.py +--- base/device.py.orig ++++ base/device.py +@@ -2450,9 +2450,9 @@ Content-length: %d\r + if remove: rem_str = '-r' + + if is_gzip: +- c = 'gunzip -c %s | lpr %s %s -P%s' % (file_name, raw_str, rem_str, printer_name) ++ c = 'gunzip -c %s | ${TRUEPREFIX}/bin/lpr %s %s -P%s' % (file_name, raw_str, rem_str, printer_name) + else: +- c = 'lpr -P%s %s %s %s' % (printer_name, raw_str, rem_str, file_name) ++ c = '${TRUEPREFIX}/bin/lpr -P%s %s %s %s' % (printer_name, raw_str, rem_str, file_name) + + exit_code = os_utils.execute(c) + Index: print/hplip/patches/patch-ui4_printsettingstoolbox_py =================================================================== RCS file: print/hplip/patches/patch-ui4_printsettingstoolbox_py diff -N print/hplip/patches/patch-ui4_printsettingstoolbox_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ print/hplip/patches/patch-ui4_printsettingstoolbox_py 28 Sep 2023 05:40:49 -0000 @@ -0,0 +1,15 @@ +Index: ui4/printsettingstoolbox.py +--- ui4/printsettingstoolbox.py.orig ++++ ui4/printsettingstoolbox.py +@@ -264,9 +264,9 @@ class PrintSettingsToolbox(QToolBox): + + if utils.which('lpr'): + if alt_nup: +- cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| lpr -P', self.cur_printer]) ++ cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| ${TRUEPREFIX}/bin/lpr -P', self.cur_printer]) + else: +- cmd = ' '.join(['lpr -P', self.cur_printer]) ++ cmd = ' '.join(['${TRUEPREFIX}/bin/lpr -P', self.cur_printer]) + + if copies > 1: + cmd = ' '.join([cmd, '-#%d' % copies]) Index: print/hplip/patches/patch-ui5_printsettingstoolbox_py =================================================================== RCS file: print/hplip/patches/patch-ui5_printsettingstoolbox_py diff -N print/hplip/patches/patch-ui5_printsettingstoolbox_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ print/hplip/patches/patch-ui5_printsettingstoolbox_py 28 Sep 2023 05:40:49 -0000 @@ -0,0 +1,15 @@ +Index: ui5/printsettingstoolbox.py +--- ui5/printsettingstoolbox.py.orig ++++ ui5/printsettingstoolbox.py +@@ -247,9 +247,9 @@ class PrintSettingsToolbox(QToolBox): + + if utils.which('lpr'): + if alt_nup: +- cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| lpr -P', self.cur_printer]) ++ cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| ${TRUEPREFIX}/bin/lpr -P', self.cur_printer]) + else: +- cmd = ' '.join(['lpr -P', self.cur_printer]) ++ cmd = ' '.join(['${TRUEPREFIX}/bin/lpr -P', self.cur_printer]) + + if copies > 1: + cmd = ' '.join([cmd, '-#%d' % copies]) Index: print/hplip/patches/patch-ui_scrollprint_py =================================================================== RCS file: print/hplip/patches/patch-ui_scrollprint_py diff -N print/hplip/patches/patch-ui_scrollprint_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ print/hplip/patches/patch-ui_scrollprint_py 28 Sep 2023 05:40:49 -0000 @@ -0,0 +1,15 @@ +Index: ui/scrollprint.py +--- ui/scrollprint.py.orig ++++ ui/scrollprint.py +@@ -988,9 +988,9 @@ class ScrollPrintView(ScrollView): + + if utils.which('lpr'): + if alt_nup: +- cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| lpr -P', self.cur_printer]) ++ cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| ${TRUEPREFIX}/bin/lpr -P', self.cur_printer]) + else: +- cmd = ' '.join(['lpr -P', self.cur_printer]) ++ cmd = ' '.join(['${TRUEPREFIX}/bin/lpr -P', self.cur_printer]) + + if copies > 1: + cmd = ' '.join([cmd, '-#%d' % copies])