YaST2 Developers Documentation: Configuration of scanner | ![]() |
![]() functions files intro |
Something was committed to the system? True if system may have been modified.
Write only, used during autoinstallation. Don't run services and SuSEconfig, it's all done at one place.
Something was committed to the system?
Abort function
Scanner database: When package version of sane/hp-officeJet/iscan 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 scanner maps in the following format: [ $[ "package":"The package which provides the backend: sane/hplip/hp-officeJet/iscan (required)", "backend":"The name of the backend (required)", "manufacturer":"The manufacturer name of the scanner (required)", "model":"The model name of the scanner (required)", "firmware":"Whether or not firmware upload is required (value is 'required' or the empty string)", "interface":"None or one or more scanner interfaces (may be the empty string)", "status":"The support status: basic/complete/good/minimal/unsupported/untested (required)", "comment":"An optional comment (may be the empty string)" ], $[ ... ], ... $[] ]
Active scanners: Determined at runtime via Scanner::DetermineActiveScanners() which calls the bash script "/usr/lib/YaST2/bin/determine_active_scanners YCP" which outputs on stdout a YCP list of scanner maps in the following format: [ $[ "backend":"The name of the backend (required)", "sane_device":"The SANE device (required)", "manufacturer":"The manufacturer name of the scanner (required)", "model":"The model name of the scanner (required)", ], $[ ... ], ... $[] ]
Active backends: Determined at runtime via Scanner::DetermineActiveBackends() which calls the bash script "/usr/lib/YaST2/bin/determine_active_scanner_backends YCP" which outputs on stdout a YCP list of backends in the following format: [ "The name of the backend", ... "" ]
Autodetected scanners: Determined at runtime via Scanner::AutodetectScanners() which calls the bash script "/usr/lib/YaST2/bin/autodetect_scanners YCP" which calls "sane-find-scanner" which may result for example the following description strings of autodetected scanners: SCSI processor 'HP C6270A 3846' at /dev/sg0 USB scanner (vendor=0x05da, product=0x20b0) at libusb:002:005 USB scanner (vendor=0x03f0 [Hewlett-Packard], product=0x0201 [HP ScanJet 6200C]) at libusb:002:006 USB scanner (vendor=0x04a9 [Canon], product=0x220e [CanoScan], chip=LM9832/3) at libusb:001:005 USB scanner (vendor=0x04b8 [EPSON], product=0x010b [Perfection1240]) at libusb:001:004 Only in case of USB an automated extraction of manufacturer is possible. If there are two '[...]' substrings then the first one is the manufacturer and the second one is the model (but there may be only one or none substring).
Network scanning configuration: Determined at runtime via Scanner::DetermineNetworkScanningConfig() which calls the bash script "/usr/lib/YaST2/bin/determine_network_scanner_config YCP" which outputs on stdout a YCP map in the following format: $[ "net_backend_hosts":"Comma seperated list of hosts in /etc/sane.d/net.conf", "saned_hosts":"Comma seperated list of hosts or subnets in /etc/sane.d/saned.conf" ]
Environment values: It is a map in the following format: $[ "sane_version":"What 'rpm -q sane' 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)" ]
Other global variables:
Local variables:
Local functions:
An ugly new version (with simple automated Popup::ShowFeedback which is shown too often): boolean ExecuteBashCommand( string bash_commandline ) { y2milestone( "Executing bash commandline: %1", bash_commandline ); // if( "" == feeback_title ) // { feeback_title = "Executing " + bash_commandline; string feeback_title = "Executing " + bash_commandline; // } // Show feedback in any case: Popup::ShowFeedback( feeback_title, _("Please wait...") ); bash_result = (map)SCR::Execute( .target.bash_output, bash_commandline ); // Wait at least one more second before clearing the feedback // so that the user can read the feedback text in any case: sleep( 1000 ); Popup::ClearFeedback(); if( bash_result["exit"]:9999 != 0 ) { y2milestone( "'%1' exit code is: %2", bash_commandline, bash_result["exit"]:9999 ); y2milestone( "'%1' stdout is: %2", bash_commandline, bash_result["stdout"]:"" ); y2milestone( "'%1' stderr is: %2", bash_commandline, bash_result["stderr"]:"" ); return false; } return true; } A future version (with sophisticated automated Popup::ShowFeedback), see yast/trunk/core/agents-perl/doc/ag_background.html
Test whether the package is installed (Package::Installed) and if not then test whether the package is available to be installed (Package::Available) and if yes then install it (Package::Install).
Determine the active scanners by calling a bash script which calls "scanimage -L" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list
Determine the active backends by calling a bash script which calls "grep ... /etc/sane.d/dll.conf" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list
Try to autodetect USB and SCSI scanners by calling a bash script which calls "sane-find-scanner" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list
Search the active_scanners list for possible SCSI scanners ("/dev/" in SANE device) and if at least one possible SCSI scanner was found, then run /etc/init.d/sane-dev (using "restart" to be safe that outdated permissions are reset) and enable it for reboot ("insserv") otherwise stop it and disable it for reboot ("insserv -r")
Global functions:
Write scanner settings: - Save the actual environment
Create a textual summary and a list of detected scanners
Create a list of items from the database entries which is used for the SelectionBox in the SelectModelDialog
Activate the backend in /etc/sane.d/dll.conf according to the specified backend_name or if the specified backend_name is the empty string then set the backend_name according to a specified database_index.
Deactivate the backend in /etc/sane.d/dll.conf according to the specified backend_name or if the specified backend_name is the empty string then set the backend_name according to a specified database_index.
Test the backend according to the specified backend_name.
Create an overview table with all active scanners and backends
Determine the network scanning config by calling a bash script which calls "grep ... /etc/sane.d/net.conf" and "grep ... /etc/sane.d/saned.conf" and processes its output and stores the results as YCP map in a temporary file and then read the temporary file (SCR::Read) to get the YCP map
Setup the network scanning config by calling a bash script which writes into /etc/sane.d/net.conf, /etc/sane.d/saned.conf, and /etc/xinetd.d/sane-port and reloads or starts the xinetd dependig on whether it is running or not
Autoinstallation stuff:
Dump the scanner settings to a single map. For use by autoinstallation.
Return packages needed to be installed and removed during autoinstallation to insure module has all needed software installed.
|
YaST2 Developers Documentation | ![]() |