Accepting request 198328 from Printing

Added udev rule that only uploads firmware into printer that need it (see upstream bug https://bugs.launchpad.net/hplip/+bug/1220628/comments/18) (forwarded request 198327 from jsmeix)

OBS-URL: https://build.opensuse.org/request/show/198328
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hplip?expand=0&rev=86
This commit is contained in:
Stephan Kulow 2013-09-11 10:12:42 +00:00 committed by Git OBS Bridge
commit 0134d2b7da
3 changed files with 26 additions and 9 deletions

View File

@ -1,6 +1,6 @@
--- data/rules/56-hpmud.rules.orig 2013-06-21 08:56:30.000000000 +0200 --- data/rules/56-hpmud.rules.change-udev-rules.orig 2013-08-07 08:02:33.000000000 +0200
+++ data/rules/56-hpmud.rules 2013-07-04 15:49:33.000000000 +0200 +++ data/rules/56-hpmud.rules 2013-09-10 13:24:09.000000000 +0200
@@ -1,18 +1,41 @@ @@ -1,18 +1,50 @@
# HPLIP udev rules file. Notify console user if plugin support is required for this device. # HPLIP udev rules file. Notify console user if plugin support is required for this device.
+# SUSE changed: +# SUSE changed:
@ -22,8 +22,14 @@
+# because automated installation of non-free proprietary third-party software +# because automated installation of non-free proprietary third-party software
+# (here the plugin from HP) should not happen and it can cause whatever kind +# (here the plugin from HP) should not happen and it can cause whatever kind
+# of strange behaviour see for example https://bugs.launchpad.net/bugs/1197416 +# of strange behaviour see for example https://bugs.launchpad.net/bugs/1197416
+# and https://bugs.launchpad.net/bugs/1221348
+# while in contrast manual printer setup via hp-setup usually "just works" +# while in contrast manual printer setup via hp-setup usually "just works"
+# and it is clear for the user what goes on and in case of failure what went wrong. +# and it is clear for the user what goes on and in case of failure what went wrong.
+#
+# Because the rule to automatically "add the printer and install plugin"
+# is also used to upload firmware into printers that need it
+# see https://bugs.launchpad.net/bugs/1220628
+# a rule that only uploads firmware into printers that need it is added.
+ +
ACTION!="add", GOTO="hpmud_rules_end" ACTION!="add", GOTO="hpmud_rules_end"
-SUBSYSTEM=="ppdev", OWNER="root", GROUP="lp", MODE="0660" -SUBSYSTEM=="ppdev", OWNER="root", GROUP="lp", MODE="0660"
@ -43,10 +49,13 @@
# This rule will add the printer and install plugin # This rule will add the printer and install plugin
-ENV{hp_test}=="yes", PROGRAM="/bin/sh -c 'logger -p user.info loading HP Device $env{BUSNUM} $env{DEVNUM}'", RUN+="/bin/sh -c 'if [ -f /usr/bin/systemctl ]; then /usr/bin/systemctl --no-block start hplip-printer@$env{BUSNUM}:$env{DEVNUM}.service; else /usr/bin/nohup /usr/bin/hp-config_usb_printer $env{BUSNUM}:$env{DEVNUM} ; fi'" -ENV{hp_test}=="yes", PROGRAM="/bin/sh -c 'logger -p user.info loading HP Device $env{BUSNUM} $env{DEVNUM}'", RUN+="/bin/sh -c 'if [ -f /usr/bin/systemctl ]; then /usr/bin/systemctl --no-block start hplip-printer@$env{BUSNUM}:$env{DEVNUM}.service; else /usr/bin/nohup /usr/bin/hp-config_usb_printer $env{BUSNUM}:$env{DEVNUM} ; fi'"
+# ENV{hp_test}=="yes", PROGRAM="/bin/sh -c 'logger -p user.info loading HP Device $env{BUSNUM} $env{DEVNUM}'", RUN+="/bin/sh -c 'if [ -f /usr/bin/systemctl ]; then /usr/bin/systemctl --no-block start hplip-printer@$env{BUSNUM}:$env{DEVNUM}.service; else /usr/bin/nohup /usr/bin/hp-config_usb_printer $env{BUSNUM}:$env{DEVNUM} ; fi'" +# ENV{hp_test}=="yes", PROGRAM="/bin/sh -c 'logger -p user.info loading HP Device $env{BUSNUM} $env{DEVNUM}'", RUN+="/bin/sh -c 'if [ -f /usr/bin/systemctl ]; then /usr/bin/systemctl --no-block start hplip-printer@$env{BUSNUM}:$env{DEVNUM}.service; else /usr/bin/nohup /usr/bin/hp-config_usb_printer $env{BUSNUM}:$env{DEVNUM} ; fi'"
+
+# This rule uploads firmware to HP USB printer devices if needed:
+ENV{hp_test}=="yes", PROGRAM="/bin/logger -p user.info udev hpmud.rules runs hp-firmware to test if HP device with USB vendor ID $attr{idVendor} and USB product ID $attr{idProduct} at USB bus ID $env{BUSNUM} and USB device ID $env{DEVNUM} needs firmware and if yes to upload it", RUN+="/usr/bin/hp-firmware -s $env{BUSNUM}:$env{DEVNUM}"
# If sane-bankends is installed add hpaio backend support to dll.conf if needed. # If sane-bankends is installed add hpaio backend support to dll.conf if needed.
ENV{sane_hpaio}=="yes", RUN+="/bin/sh -c 'grep -q ^#hpaio /etc/sane.d/dll.conf;if [ $$? -eq 0 ];then sed -i -e s/^#hpaio/hpaio/ /etc/sane.d/dll.conf;else grep -q ^hpaio /etc/sane.d/dll.conf;if [ $$? -ne 0 ];then echo hpaio >>/etc/sane.d/dll.conf;fi;fi'" ENV{sane_hpaio}=="yes", RUN+="/bin/sh -c 'grep -q ^#hpaio /etc/sane.d/dll.conf;if [ $$? -eq 0 ];then sed -i -e s/^#hpaio/hpaio/ /etc/sane.d/dll.conf;else grep -q ^hpaio /etc/sane.d/dll.conf;if [ $$? -ne 0 ];then echo hpaio >>/etc/sane.d/dll.conf;fi;fi'"
@@ -22,3 +45,4 @@ ENV{libsane_matched}=="yes", RUN+="/bin/ @@ -22,3 +54,4 @@ ENV{libsane_matched}=="yes", RUN+="/bin/
LABEL="hpmud_rules_end" LABEL="hpmud_rules_end"

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Sep 10 14:44:46 CEST 2013 - jsmeix@suse.de
- change-udev-rules.diff: Added rule that only uploads firmware
into printers that need it by calling only hp-firmware, see
https://bugs.launchpad.net/bugs/1220628
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Sep 4 10:09:00 CEST 2013 - jsmeix@suse.de Wed Sep 4 10:09:00 CEST 2013 - jsmeix@suse.de

View File

@ -15,6 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
Name: hplip Name: hplip
# BuildRequires foomatic-filters to avoid /usr/lib/rpm/brp-symlink ERROR: # BuildRequires foomatic-filters to avoid /usr/lib/rpm/brp-symlink ERROR:
# link target doesn't exist (neither in build root nor in installed system): # link target doesn't exist (neither in build root nor in installed system):
@ -331,30 +332,30 @@ with the scan drivers in HPLIP for standard HP all-in-one printers.
%setup -q %setup -q
# Patch10 fix-uninitialized-variables.diff # Patch10 fix-uninitialized-variables.diff
# fixes "... is used uninitialized ..." warnings: # fixes "... is used uninitialized ..." warnings:
%patch10 %patch10 -b .fix-uninitialized-variables.orig
# Patch101 change-udev-rules.diff # Patch101 change-udev-rules.diff
# changes the udev rules file 56-hpmud.rules # changes the udev rules file 56-hpmud.rules
%patch101 %patch101 -b .change-udev-rules.orig
# Patch102 disable-chgrp_lp.diff deactivates the "chgrp lp" in Makefile.am # Patch102 disable-chgrp_lp.diff deactivates the "chgrp lp" in Makefile.am
# because during build this results "Operation not permitted". # because during build this results "Operation not permitted".
# Instead it is done in the files section via attr(0775,root,lp) # Instead it is done in the files section via attr(0775,root,lp)
# where mode 0775 is used instead of mode 0777 as in Makefile.am # where mode 0775 is used instead of mode 0777 as in Makefile.am
# because a public writable directory /var/log/hp/ is not allowed # because a public writable directory /var/log/hp/ is not allowed
# to avoid security issues: # to avoid security issues:
%patch102 %patch102 -b .disable-chgrp_lp.orig
# Patch104 neither-add_user_to_group-nor-open_mdns_port.diff # Patch104 neither-add_user_to_group-nor-open_mdns_port.diff
# removes add_user_to_group and open_mdns_port.diff from distros.dat for SUSE distros # removes add_user_to_group and open_mdns_port.diff from distros.dat for SUSE distros
# to avoid security issues when normal users get added to system groups 'lp' and 'sys' # to avoid security issues when normal users get added to system groups 'lp' and 'sys'
# see https://bugs.launchpad.net/bugs/1197416 and https://bugs.launchpad.net/bugs/1112306 # see https://bugs.launchpad.net/bugs/1197416 and https://bugs.launchpad.net/bugs/1112306
# and to avoid security issues when ports in the firewall get opened # and to avoid security issues when ports in the firewall get opened
# see https://bugs.launchpad.net/bugs/426161 # see https://bugs.launchpad.net/bugs/426161
%patch104 %patch104 -b .neither-add_user_to_group-nor-open_mdns_port.orig
# Patch105 deactivate-add_group-function.diff # Patch105 deactivate-add_group-function.diff
# deactivates the add_group function that would add the groups ('lp') to user # deactivates the add_group function that would add the groups ('lp') to user
# which would cause security issues see https://bugs.launchpad.net/bugs/1197416 # which would cause security issues see https://bugs.launchpad.net/bugs/1197416
# that would happen in any case via a fallback command in an "else" clause # that would happen in any case via a fallback command in an "else" clause
# even if this functionality was explicitly disabled in distros.dat # even if this functionality was explicitly disabled in distros.dat
%patch105 %patch105 -b .deactivate-add_group-function.orig
%build %build
# If AUTOMAKE='automake --foreign' is not set, autoreconf (in fact automake) # If AUTOMAKE='automake --foreign' is not set, autoreconf (in fact automake)