Author: jsmeix
Date: Wed Mar 26 18:56:46 2008
New Revision: 45768
URL: http://svn.opensuse.org/viewcvs/yast?rev=45768&view=rev
Log:
- V 2.16.3
- Let "Restart Detection" toggle the autodetection behaviour
(see Novell/Suse Bugzilla bnc#310518).
- Enhanced how hp-setup is launched to be more fail-safe.
In particular added a small C program displaytest which tests
with XOpenDisplay whether or not a X window can be opened
(there is no such tool available in xorg-x11) which makes
yast2-scanner no longer a noarch RPM.
Added:
trunk/scanner/tools/displaytest.c
Modified:
trunk/scanner/VERSION
trunk/scanner/configure.in.in
trunk/scanner/package/yast2-scanner.changes
trunk/scanner/src/Scanner.ycp
trunk/scanner/src/dialogs.ycp
trunk/scanner/src/helps.ycp
trunk/scanner/tools/Makefile.am
trunk/scanner/tools/activate_scanner_backend
trunk/scanner/tools/autodetect_scanners
trunk/scanner/tools/create_scanner_database
trunk/scanner/tools/deactivate_scanner_backend
trunk/scanner/tools/determine_active_scanner_backends
trunk/scanner/tools/determine_active_scanners
trunk/scanner/tools/determine_network_scanner_config
trunk/scanner/tools/setup_hplip_scanner_service
trunk/scanner/tools/setup_network_scanner_config
trunk/scanner/tools/setup_ptal_scanner_service
trunk/scanner/tools/test_and_set_scanner_access_permissions
trunk/scanner/tools/test_scanner_backend
trunk/scanner/yast2-scanner.spec.in
Modified: trunk/scanner/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/VERSION?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/scanner/VERSION (original)
+++ trunk/scanner/VERSION Wed Mar 26 18:56:46 2008
@@ -1 +1 @@
-2.16.2
+2.16.3
Modified: trunk/scanner/configure.in.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/configure.in.in?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/scanner/configure.in.in (original)
+++ trunk/scanner/configure.in.in Wed Mar 26 18:56:46 2008
@@ -3,10 +3,19 @@
## Initialize
@YAST2-INIT-COMMON@
@YAST2-INIT-YCP@
+@YAST2-INIT-PROGRAM@
+
+# tools/displaytest needs /usr/include/X11/Xlib.h and /usr/lib/libX11.so -> xorg-x11-libX11-devel RPM
+yast_found_libX11=no
+AC_CHECK_HEADER(X11/Xlib.h,[yast_found_libX11=yes])
+if [[ "$yast_found_libX11" = "no" ]]
+then AC_MSG_ERROR(Header file X11/Xlib.h missing. Usually the xorg-x11-libX11-devel RPM is missing.)
+fi
## some common checks
@YAST2-CHECKS-COMMON@
@YAST2-CHECKS-YCP@
+@YAST2-CHECKS-PROGRAM@
## and generate the output...
@YAST2-OUTPUT@
Modified: trunk/scanner/package/yast2-scanner.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/package/yast2-scanner.changes?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/scanner/package/yast2-scanner.changes (original)
+++ trunk/scanner/package/yast2-scanner.changes Wed Mar 26 18:56:46 2008
@@ -1,4 +1,16 @@
-------------------------------------------------------------------
+Wed Mar 26 12:34:13 CET 2008 - jsmeix@suse.de
+
+- V 2.16.3
+- Let "Restart Detection" toggle the autodetection behaviour
+ (see Novell/Suse Bugzilla bnc#310518).
+- Enhanced how hp-setup is launched to be more fail-safe.
+ In particular added a small C program displaytest which tests
+ with XOpenDisplay whether or not a X window can be opened
+ (there is no such tool available in xorg-x11) which makes
+ yast2-scanner no longer a noarch RPM.
+
+-------------------------------------------------------------------
Tue Mar 25 14:42:30 CET 2008 - jsmeix@suse.de
- V 2.16.2
@@ -7,6 +19,9 @@
is already a CUPS queue (the latter in particular for network
HP all-in-one devices which do not work without a CUPS queue)
and additionally hp-setup can be launched.
+- Initially show only USB scanners with known USB IDs.
+ Show all USB devices which look like scanners only after
+ "Restart Detection" (see Novell/Suse Bugzilla bnc#310518).
-------------------------------------------------------------------
Wed Mar 19 16:45:38 CET 2008 - jsmeix@suse.de
Modified: trunk/scanner/src/Scanner.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/src/Scanner.ycp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/scanner/src/Scanner.ycp (original)
+++ trunk/scanner/src/Scanner.ycp Wed Mar 26 18:56:46 2008
@@ -79,13 +79,13 @@
/**
* Scanner database:
- * When package version of sane-backends/hplip/hp-officeJet/iscan/iscan-free changes
+ * When package version of sane-backends/hplip/iscan/iscan-free changes
* the database is created anew in Scanner::Read() which calls the bash script
* "/usr/lib/YaST2/bin/create_scanner_database YCP"
* which outputs on stdout a YCP list of @ref scanner_model_map
* where the last list entry is an emtpy map.
* @struct scanner_model_map
- * $[ "package":"The package which provides the backend: sane-backends/hplip/hp-officeJet/iscan/iscan-free (required)",
+ * $[ "package":"The package which provides the backend: sane-backends/hplip/iscan/iscan-free (required)",
* "backend":"The name of the backend (required)",
* "manufacturer":"The manufacturer name of the scanner (required)",
* "model":"The model name of the scanner (required)",
@@ -205,20 +205,17 @@
* @struct environment_values
* $[ "sane-backends_version":"What 'rpm -q sane-backends' returns (required)",
* "hplip_version":"What 'rpm -q hplip' returns (required)",
- * "hp-officeJet_version":"What 'rpm -q hp-officeJet' returns (required)",
* "iscan_version":"What 'rpm -q iscan' returns (required)"
* "iscan-free_version":"What 'rpm -q iscan-free' returns (required)"
* ]
*/
global map< string, string > actual_environment = $[ "sane-backends_version":"",
"hplip_version":"",
- "hp-officeJet_version":"",
"iscan_version":"",
"iscan-free_version":""
];
global map< string, string > stored_environment = $[ "sane-backends_version":"",
"hplip_version":"",
- "hp-officeJet_version":"",
"iscan_version":"",
"iscan-free_version":""
];
@@ -249,10 +246,27 @@
* As there is no USB device class for scanners (they have the unspecific USB device class 255),
* sane-find-scanner can only do some best guess to determine if a USB device is a scanner or not.
* Therefore also other USB devices with the device class 255 are reported as possible USB scanners.
- * Preset to true so that only scanners for which the USB IDs are known by SANE are shown by default.
+ * Preset to true so that initially only scanners for which the USB IDs are known by SANE are shown.
* It changes to false (i.e. show all USB devices with the device class 255 as possible USB scanners)
- * when the user has explicitely requested a "Restart Detection" in the OverviewDialog.
- * It is neither somehow automatically reset to true nor can the user reset it manually to true.
+ * when the user explicitely requests a "Restart Detection" in the OverviewDialog.
+ * A second "Restart Detection" changes it back to true so that "Restart Detection" toggles it.
+ * The idea behind is that the user can simply "Restart Detection" as often as he likes
+ * until the result is o.k. for him because "Restart Detection" does not cause harm and
+ * it avoids a separated button or check-box to determine the autodetection behaviour
+ * which would require additional explanatory (complicated) help text about the whole stuff.
+ * Examples:
+ * Assume there is a known powered-off USB scanner and another USB device with class 255:
+ * Initially nothing is shown.
+ * After the first "Restart Detection" only the other USB device with class 255 is shown.
+ * This unexpected result makes the user think about what is wrong and he powers-on the scanner.
+ * After the second "Restart Detection" only the USB scanner is shown.
+ * Assume there is an unknown powered-off USB scanner and another USB device with class 255.
+ * Initially nothing is shown.
+ * After the first "Restart Detection" only the other USB device with class 255 is shown.
+ * This unexpected result makes the user think about what is wrong and he powers-on the scanner.
+ * After the second "Restart Detection" nothing is shown.
+ * A third "Restart Detection" shows both the USB scanner and the other USB device with class 255.
+ * This is the best possible result because it is not possible to show only the unknown USB scanner.
*/
global boolean ignore_unknown_USB_scanners = true;
@@ -656,12 +670,12 @@
* Test whether there exist a print queue which depends on the specified SANE backend.
* Examples:
* hpaio (package hplip):
- * Setting up the hpaio backend requires to activate/start the hplip service.
+ * Setting up the hpaio backend activates also the hplip service.
* It may happen that the conflicting service ptal is in use by the CUPS printing system.
* I.e. there may be a print queue which uses the ptal CUPS backend.
* hpoj (package hp-officeJet):
* Setting up the hpoj backend requires to initialize/activate/start the ptal service.
- * It may happen that the conflicting service hplip is in use by the CUPS printing system.
+ * It may happen that the conflicting service hplip is in use.
* I.e. there may be a print queue which uses the hp CUPS backend.
* Note:
* The test is only implememnted for the CUPS printing system.
@@ -749,16 +763,14 @@
if( ! TestAndInstallPackage( "sane-backends" ) )
{ return false;
}
- // Check installed package version of sane-backends, hp-officeJet, iscan, iscan-free:
+ // Check installed package version of sane-backends, hplip, iscan, iscan-free:
actual_environment["sane-backends_version"] = InstalledPackageVersion( "sane-backends" );
actual_environment["hplip_version"] = InstalledPackageVersion( "hplip" );
- actual_environment["hp-officeJet_version"] = InstalledPackageVersion( "hp-officeJet" );
actual_environment["iscan_version"] = InstalledPackageVersion( "iscan" );
actual_environment["iscan-free_version"] = InstalledPackageVersion( "iscan-free" );
- y2milestone( "Version of sane-backends, hplip, hp-officeJet, iscan, iscan-free: %1, %2, %3, %4, %5",
+ y2milestone( "Version of sane-backends, hplip, iscan, iscan-free: %1, %2, %3, %4",
actual_environment["sane-backends_version"]:"failed",
actual_environment["hplip_version"]:"failed",
- actual_environment["hp-officeJet_version"]:"failed",
actual_environment["iscan_version"]:"failed",
actual_environment["iscan-free_version"]:"failed"
);
@@ -769,7 +781,6 @@
{ y2milestone( "Warning: Failed to read the stored environment." );
stored_environment = $[ "sane-backends_version":"failed to read",
"hplip_version":"failed to read",
- "hp-officeJet_version":"failed to read",
"iscan_version":"failed to read",
"iscan-free_version":"failed to read"
];
@@ -780,7 +791,6 @@
Progress::NextStage();
if( actual_environment["sane-backends_version"]:"0" != stored_environment["sane-backends_version"]:"1"
|| actual_environment["hplip_version"]:"0" != stored_environment["hplip_version"]:"1"
- || actual_environment["hp-officeJet_version"]:"0" != stored_environment["hp-officeJet_version"]:"1"
|| actual_environment["iscan_version"]:"0" != stored_environment["iscan_version"]:"1"
|| actual_environment["iscan-free_version"]:"0" != stored_environment["iscan-free_version"]:"1"
|| -1 == SCR::Read( .target.size, database_filename )
@@ -959,16 +969,98 @@
/**
* Run hp-setup:
- * @return true in any case because there is no usable exit code of hp-setup
- * (always zero even in case of error).
+ * @return false if hp-setup cannot be run and return true in any other case
+ * because there is no usable exit code of hp-setup (always zero even in case of error).
*/
global boolean RunHpsetup()
-{ Popup::ShowFeedback( // No title for a simple busy message:
+{ // First of all the multi-line strings because such strings cannot be indented:
+ string ptal_in_use_conflict_message =
+ // Message of a Report::Error when hp-setup should be run.
+ // Do not change or translate "ptal", it is a service name.
+ // Do not change or translate "hp-setup", it is a program name.
+ // Do not change or translate "HPLIP", it is a subsystem name.
+_("There is at least one printer configuration that uses the ptal service.
+It is possible to proceed but then the running ptal service could prevent
+that hp-setup works correctly.
+It is recommended to abort the scanner configuration now,
+stop the ptal service, change the printer configuration to use HPLIP,
+and start the scanner configuration again afterwards.
+");
+ string displaytest_failed_message =
+ // Message of a Report::Error when hp-setup should be run.
+ // Do not change or translate "hp-setup", it is a program name:
+_("Cannot run hp-setup because no graphical display can be opened.
+This happens in particular when YaST runs in text-only mode,
+or when the user who runs YaST has no DISPLAY environment variable set,
+or when the YaST process is not allowed to access the graphical display.
+In this case you should abort the scanner configuration now,
+run hp-setup manually, and start the scanner configuration again afterwards.
+");
+ string install_hplip_message =
+ // Message of a Popup::YesNo when hplip should be installed.
+ // Do not change or translate "hp-setup", it is a program name.
+ // Do not change or translate "hplip", it is a package name:
+_("It seems hplip is not installed which is required to run hp-setup.
+Should the hplip package be installed?
+");
+ string hpsetup_not_executable_message =
+ // Message of a Report::Error when hp-setup should be run.
+ // Do not change or translate "hp-setup", it is a program name:
+_("Cannot run hp-setup because
+/usr/bin/hp-setup is not executable
+or does not exist.
+");
+ string hpsetup_busy_message =
+ // Body of a Popup::ShowFeedback.
+ // Do not change or translate "hp-setup", it is a program name:
+_("Launched hp-setup.
+You must finish hp-setup before you can proceed with the scanner configuration.
+");
+ if( DependantPrintQueueExists( "hpoj" ) )
+ { y2milestone( "Error: hp-setup is not launched because of conflict: PTAL is in use by a CUPS queue." );
+ Report::Error( ptal_in_use_conflict_message );
+ return false;
+ }
+ if( ! ExecuteBashCommand( "/usr/lib/YaST2/bin/displaytest" ) )
+ { // The file location is the same on i386 and x86_64 (i.e. no "lib64" on x86_64).
+ // In particular when YaST runs in text-only mode, hp-setup must not be launched
+ // because it would run without any contact to the user "in the background"
+ // while in the foreground YaST waits for hp-setup to be finished
+ // which is imposible for the user so that the result is a deadlock.
+ // All the user could do is to kill the hp-setup process.
+ // It does not matter if displaytest fails orderly because XOpenDisplay fails
+ // or if it crashes because of missing libX11.so on a minimal installation without X
+ // because any non-zero exit code indicates that no graphical window can be opened.
+ // Therefore the yast2-scanner RPM should not require a full installed X system.
+ // Nevertheless the RPM build AutoReqProv creates a requirement for libX11.so
+ // so that a few xorg-x11-lib* packages (xorg-x11-libX11, xorg-x11-libxcb, xorg-x11-libXau)
+ // are enforced by RPM to be installed.
+ y2milestone( "Error: hp-setup is not launched because /usr/lib/YaST2/bin/displaytest failed." );
+ Report::Error( displaytest_failed_message );
+ return false;
+ }
+ if( "not installed" == actual_environment["hplip_version"]:"not installed"
+ || "failed to determine" == actual_environment["hplip_version"]:"failed to determine"
+ )
+ { y2milestone( "hplip not installed or failed to determine its version. Therefore testing and installing hplip." );
+ if( ! Popup::YesNo( install_hplip_message ) )
+ { y2milestone( "Error: hp-setup cannot run because user rejected to install hplip." );
+ return false;
+ }
+ if( ! TestAndInstallPackage( "hplip" ) )
+ { y2milestone( "Error: hp-setup cannot run because YaST failed to install hplip." );
+ return false;
+ }
+ }
+ if( ! ExecuteBashCommand( "test -x /usr/bin/hp-setup" ) )
+ { y2milestone( "Error: /usr/bin/hp-setup not executable or does not exist." );
+ Report::Error( hpsetup_not_executable_message );
+ return false;
+ }
+ Popup::ShowFeedback( // No title for a simple busy message:
"",
// Busy message:
- // Body of a Popup::ShowFeedback.
- // Do not change or translate "hp-setup", it is a program name:
- _("Running hp-setup...")
+ hpsetup_busy_message
);
ExecuteBashCommand( "/usr/bin/hp-setup" );
Popup::ClearFeedback();
@@ -1595,7 +1687,7 @@
// Do not change or translate "hpaio", it is a driver name.
// Do not change or translate "hplip", it is a service name.
// Do not change or translate "PTAL", it is a subsystem name.
-_("The hpaio driver requires the hplip service to be up and running.
+_("The hpaio driver needs the hplip service to be up and running to show the device status.
Additionally, the hplip service should be configured to start when booting.
The hplip service and the PTAL system exclude each other.
Therefore a running PTAL system would be stopped and deactivated
@@ -1606,14 +1698,11 @@
string ptal_in_use_conflict_message =
// Message of a Popup::ContinueCancel for scanners which should be set up with the hpaio driver.
// Do not change or translate "ptal", it is a service name.
- // Do not change or translate "hpoj", it is a driver name.
- // Do not change or translate "hplip", it is a service name.
+ // Do not change or translate "HPLIP", it is a subsystem name.
_("There is at least one printer configuration that uses the ptal service.
It is possible to proceed but then the ptal service would be stopped
and all print queues that use the ptal service would no longer work.
-If the scanner is also supported by the hpoj driver, do not proceed.
-Instead use hpoj to set up the scanner.
-Alternatively proceed and change the printer configuration to use the hplip service.
+When you proceed, change the printer configuration to use HPLIP.
");
string hpoj_message =
// Message of a Popup::YesNo for scanners which should be set up with the hpoj driver
@@ -1751,7 +1840,11 @@
}
// Set up special requirements for particular backends (e.g. "hpaio", "hpoj"):
Progress::NextStage();
- // The hpaio backend (from the package hplip) requires the hplip service to be up and running.
+ // The hpaio backend (from the package hplip) recommends the hplip service to be up and running.
+ // Since HPLIP version 2.7.6 one part of the hplip service hpiod is replaced
+ // by new direct device I/O (via hpmud library), only hpssd (for device status) still exists
+ // but hpssd is not strictly required but without it hp-toolbox cannot show the device status
+ // so that the hplip service (since HPLIP 2.7.6 only hpssd) is still recommended to run:
// This makes only sense if user confirmation is requested.
// Otherwise skip this section.
if( "hpaio" == backend_name
@@ -1769,7 +1862,8 @@
// which asked the user whether he wants to let YaST activate the hplip service
// so that this message is shown if the user has explicitely rejected to do it.
// Do not change or translate "hplip", it is a service name.
- _("If the hplip service is not running, the scanner cannot work.")
+ // Do not change or translate "hp-toolbox", it is a program name.
+ _("If the hplip service is not running, no device status can be shown in hp-toolbox.")
);
}
else
Modified: trunk/scanner/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/src/dialogs.ycp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/scanner/src/dialogs.ycp (original)
+++ trunk/scanner/src/dialogs.ycp Wed Mar 26 18:56:46 2008
@@ -470,8 +470,15 @@
}
/* restart the whole autodetection */
if( ret == `restart_detection )
- { // Show all USB devices with the device class 255 as possible USB scanners:
- Scanner::ignore_unknown_USB_scanners = false;
+ { // Toggle autodetection behaviour (initially ignore_unknown_USB_scanners == true):
+ if( Scanner::ignore_unknown_USB_scanners )
+ { // Show all USB devices with the device class 255 as possible USB scanners:
+ Scanner::ignore_unknown_USB_scanners = false;
+ }
+ else
+ { // Show only USB scanners for which the USB IDs are known in the database:
+ Scanner::ignore_unknown_USB_scanners = true;
+ }
// Scanner::RestartDetection results true in any case, see the function comment.
Scanner::RestartDetection();
// Exit this dialog and run it again via the sequencer in wizards.ycp
@@ -481,10 +488,20 @@
/* run hp-setup */
if( ret == `run_hpsetup )
{ // Run hp-setup and wait until it is finished before the autodetection is restarted.
- // There is no usable exit code of hp-setup (always zero even in case of error).
+ // Scanner::RunHpsetup() returns false only if hp-setup cannot be run.
+ // It returns true in any other case because there is no usable exit code of hp-setup
+ // (always zero even in case of error).
// The hp-setup exit code does not matter because the autodetection will show
// an appropriate result (e.g. no HP all-in-one device if hp-setup failed):
- Scanner::RunHpsetup();
+ if( ! Scanner::RunHpsetup() )
+ { Popup::Error( // Message of a Popup::Error.
+ // Only a simple message because before the function Scanner::RunHpsetup
+ // was called and this function would have shown more specific messages.
+ // Do not change or translate "hp-setup", it is a program name:
+ _("Failed to run hp-setup.")
+ );
+ continue;
+ }
// Scanner::RestartDetection results true in any case, see the function comment.
Scanner::RestartDetection();
// Exit this dialog and run it again via the sequencer in wizards.ycp
Modified: trunk/scanner/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/src/helps.ycp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/scanner/src/helps.ycp (original)
+++ trunk/scanner/src/helps.ycp Wed Mar 26 18:56:46 2008
@@ -219,8 +219,7 @@
// Do not change or translate "HPLIP", it is a project name.
// Do not change or translate "hplip", it is a package name.
// Do not change or translate "hplip", it is a service name.
-// Note that the "all" is crucial in
-// "either ptal or hplip must be used to access all HP all-in-one devices".
+// The "for all" is crucial in "either ptal or hplip must be used for all HP all-in-one devices".
_("<p>
<b><big>HP All-in-One Devices</big></b><br>
HP all-in-one devices require a special setup.
@@ -229,11 +228,11 @@
the outdated HPOJ software (package hp-officeJet),
which provides the PTAL system (with the ptal service) to access HP all-in-one devices,
and the up-to-date HPLIP software (package hplip),
-which provides the hplip service to access HP all-in-one devices.
+which provides the hplip service for device status of HP all-in-one devices.
Both software packages can be installed at the same time
but the services cannot be run together.
Because a running service is required to access the device,
-either ptal or hplip must be used to access all HP all-in-one devices.
+either ptal or hplip must be used for all HP all-in-one devices.
</p>"),
"configure_network_scanning" :
Modified: trunk/scanner/tools/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/tools/Makefile.am?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/scanner/tools/Makefile.am (original)
+++ trunk/scanner/tools/Makefile.am Wed Mar 26 18:56:46 2008
@@ -15,3 +15,8 @@
test_and_set_scanner_access_permissions
EXTRA_DIST = $(ybin_SCRIPTS)
+
+ybin_PROGRAMS = displaytest
+displaytest_SOURCES = displaytest.c
+displaytest_LDADD = -lX11
+
Modified: trunk/scanner/tools/activate_scanner_backend
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/tools/activate_scanner_backend?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/scanner/tools/activate_scanner_backend (original)
+++ trunk/scanner/tools/activate_scanner_backend Wed Mar 26 18:56:46 2008
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner