[yast-commit] r46956 - in /trunk/scanner: VERSION package/yast2-scanner.changes src/Scanner.ycp tools/test_and_set_scanner_access_permissions
Author: jsmeix
Date: Tue Apr 22 15:38:34 2008
New Revision: 46956
URL: http://svn.opensuse.org/viewcvs/yast?rev=46956&view=rev
Log:
- V 2.16.7
- Added tests to test_and_set_scanner_access_permissions
if HAL knows about the scanner and show an explanatory
error message if not. The error message is only shown
when a driver is activated but not if a driver is
deactivated. Because of the YaST 'text freeze' this
error message cannot be translated for openSUSE 11.0
so that currently it is only a simple stderr message,
(see Novell/Suse Bugzilla bnc#340173).
Modified:
trunk/scanner/VERSION
trunk/scanner/package/yast2-scanner.changes
trunk/scanner/src/Scanner.ycp
trunk/scanner/tools/test_and_set_scanner_access_permissions
Modified: trunk/scanner/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/VERSION?rev=46956&r1=46955&r2=46956&view=diff
==============================================================================
--- trunk/scanner/VERSION (original)
+++ trunk/scanner/VERSION Tue Apr 22 15:38:34 2008
@@ -1 +1 @@
-2.16.6
+2.16.7
Modified: trunk/scanner/package/yast2-scanner.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/package/yast2-scanner.changes?rev=46956&r1=46955&r2=46956&view=diff
==============================================================================
--- trunk/scanner/package/yast2-scanner.changes (original)
+++ trunk/scanner/package/yast2-scanner.changes Tue Apr 22 15:38:34 2008
@@ -1,4 +1,17 @@
-------------------------------------------------------------------
+Tue Apr 22 15:27:55 CEST 2008 - jsmeix@suse.de
+
+- V 2.16.7
+- Added tests to test_and_set_scanner_access_permissions
+ if HAL knows about the scanner and show an explanatory
+ error message if not. The error message is only shown
+ when a driver is activated but not if a driver is
+ deactivated. Because of the YaST 'text freeze' this
+ error message cannot be translated for openSUSE 11.0
+ so that currently it is only a simple stderr message,
+ (see Novell/Suse Bugzilla bnc#340173).
+
+-------------------------------------------------------------------
Thu Apr 17 13:17:35 CEST 2008 - jsmeix@suse.de
- V 2.16.6
Modified: trunk/scanner/src/Scanner.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/src/Scanner.ycp?rev=46956&r1=46955&r2=46956&view=diff
==============================================================================
--- trunk/scanner/src/Scanner.ycp (original)
+++ trunk/scanner/src/Scanner.ycp Tue Apr 22 15:38:34 2008
@@ -2120,18 +2120,7 @@
{ active_scanners = [];
}
else
- { if( ! SetScannerAccessPermissions()
- && user_confirmation
- )
- { Report::Warning( sformat( // Message of a Report::Warning when setting scanner access permissions failed
- // where %1 can be replaced by an error message if such an error message exists.
- // Only a simple message because this error does not happen on a normal system
- // (i.e. a system which is not totally broken or totally messed up).
- _("Failed to set scanner access permissions.\n%1"),
- OnlyMeaningfulErrorMessage( result["stderr"]:"" )
- )
- );
- }
+ { SetScannerAccessPermissions();
}
if( ! DetermineActiveBackends() )
{ active_backends = [];
Modified: trunk/scanner/tools/test_and_set_scanner_access_permissions
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/tools/test_and_set_scanner_access_permissions?rev=46956&r1=46955&r2=46956&view=diff
==============================================================================
--- trunk/scanner/tools/test_and_set_scanner_access_permissions (original)
+++ trunk/scanner/tools/test_and_set_scanner_access_permissions Tue Apr 22 15:38:34 2008
@@ -30,7 +30,7 @@
if [ -n "$1" ]
then echo "$1" >$TMP_DATA_RAW
else MAXIMUM_WAIT="60"
- if [ -x /usr/bin/scanimage ]
+ if [ -x $( type -p scanimage || echo qqq ) ]
then scanimage -f '%d;' >$TMP_DATA_RAW &
scanimagePID=$!
for i in $( seq $MAXIMUM_WAIT )
@@ -74,7 +74,7 @@
# the BusDevice values are unique (because the lsusb output is unique)
# because another backend might have already reported a HP USB scanner.
# Skip this section if hp-makeuri cannot be executed for whatever reason.
-if [ -x /usr/bin/hp-makeuri ]
+if [ -x $( type -p hp-makeuri || echo qqq ) ]
then for BusDevice in $( lsusb -d 03f0: | cut -d ' ' -f 2,4 | tr ' :' ': ' )
do for URI in $( hp-makeuri -s $BusDevice 2>/dev/null )
do if grep -q "^$URI\$" $TMP_DATA
@@ -105,6 +105,17 @@
echo 'as displayed by the command /usr/sbin/lsusb -->' >>$HAL_LOCAL_FILE
echo '' >>$HAL_LOCAL_FILE
+# Setting extglob is required to remove an arbitrary number
+# of leading zeroes from a varaiable via ${varaiable##*(0)}
+shopt -s extglob
+
+# Get the HAL UDIs:
+KNOWN_HAL_SCANNER_UDIs=""
+if [ -x $( type -p hal-find-by-capability || echo qqq ) ]
+then KNOWN_HAL_SCANNER_UDIs="$( hal-find-by-capability --capability scanner )"
+fi
+UNKNOWN_TO_HAL=""
+
# Test and set scanner access permissions:
exec <$TMP_DATA
while read LINE
@@ -119,8 +130,6 @@
# Skip scanners where VENDOR or PRODUCT contains only zeroes:
echo $VENDOR | grep -q [1-9a-f] || continue
echo $PRODUCT | grep -q [1-9a-f] || continue
- # Skip scanners which are already listed in the global HAL file:
- grep -i -A 1 "usb_device.vendor_id\" int=\"0x$VENDOR\"" $HAL_GLOBAL_FILE | grep -q -i "usb_device.product_id\" int=\"0x$PRODUCT\"" && continue
# Skip "SCSI via USB" scanners:
# There is a small number of USB scanners which are not talked to via libusb.
# They talk an unusual protocol which is a derivative of usb storage.
@@ -138,6 +147,20 @@
[ "05da:80a3" = "$VENDOR_PRODUCT" ] && continue
[ "05da:80ac" = "$VENDOR_PRODUCT" ] && continue
[ "05da:00b6" = "$VENDOR_PRODUCT" ] && continue
+ # Scanners which are not skipped above must have an entry in a HAL fdi file.
+ # If the "scanner" capability is already known to HAL, everything is already o.k
+ # regardless if it is listed in the global or local HAL file or elsewhere.
+ # If there are several scanners with the same USB IDs connected,
+ # it is assumed that when HAL knows one, it knows all of them.
+ # If KNOWN_HAL_SCANNER_UDIs is emptly e.g. because HAL does not run or is not installed
+ # it is perfectly right to collect the models in UNKNOWN_TO_HAL
+ # so that YaST can show an appropriate message to the user.
+ HAL_UDI_VENDOR_PRODUCT=${VENDOR##*(0)}_${PRODUCT##*(0)}
+ echo "$KNOWN_HAL_SCANNER_UDIs" | grep -q -i "/usb_device_$HAL_UDI_VENDOR_PRODUCT" && continue
+ # The "scanner" capability is not yet known to HAL:
+ UNKNOWN_TO_HAL="$UNKNOWN_TO_HAL USB-ID(hex)=$VENDOR_PRODUCT"
+ # Skip scanners which are already listed in the global HAL file:
+ grep -i -A 1 "usb_device.vendor_id\" int=\"0x$VENDOR\"" $HAL_GLOBAL_FILE | grep -q -i "usb_device.product_id\" int=\"0x$PRODUCT\"" && continue
# Write an entry to the local HAL file:
echo ' <match key="info.subsystem" string="usb_device">' >>$HAL_LOCAL_FILE
echo "
participants (1)
-
jsmeix@svn.opensuse.org