rpms/sane-backends/FC-4 libusbscanner, 1.10, 1.11 sane-backends.spec, 1.44, 1.45

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Apr 5 13:41:21 UTC 2006


Author: nphilipp

Update of /cvs/dist/rpms/sane-backends/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv29939

Modified Files:
	libusbscanner sane-backends.spec 
Log Message:
update libusbscanner to handle cold-plugged USB scanners (#144444, slightly changed patch by Michal Jaegermann)



Index: libusbscanner
===================================================================
RCS file: /cvs/dist/rpms/sane-backends/FC-4/libusbscanner,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- libusbscanner	9 Dec 2004 19:24:37 -0000	1.10
+++ libusbscanner	5 Apr 2006 13:41:19 -0000	1.11
@@ -28,6 +28,19 @@
 DEVDIR=/dev
 DEVNAME="scanner-usb-$(echo ${DEVICE#../proc/bus/usb/} | sed -e 's;/;:;g')"
 
+wait_and_add () {
+    local limit=90
+    # wait until the action can be performed but no longer
+    # than $limit seconds
+    while ! ln -snf "${DEVICE}" "${DEVDIR}/${DEVNAME}" ; do
+	    [ "$limit" = 0 ] && return
+	    sleep 1
+	    limit=$((limit - 1))
+    done
+    
+    /sbin/pam_console_apply "${DEVDIR}/${DEVNAME}"
+}
+
 if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
 then
 
@@ -36,13 +49,14 @@
     # follow the symlink and set the permissions of /proc/bus/usb/BBB/DDD such
     # that "console" users will be able to use their USB scanner.
     #
-    # If the scanner is "cold plugged," this event will likely occur before
-    # the root filesystem is writeable, but no-one seems to know how to fix
-    # that.
+    # If the scanner is "cold plugged", and this event will occurred before
+    # the root filesystem was writeable, then we wait in a background
+    # until a link in ${DEVDIR} can be created.  Permissions on
+    # /proc/bus/usb/BBB/DDD will be of a "revert" type; see
+    # man 5 console.perms.  This is fine; when a device does not exist
+    # at all we do not particularly care about its permissions.
     #
-    ln -sf "${DEVICE}" "${DEVDIR}/${DEVNAME}"
-    
-    /sbin/pam_console_apply "${DEVDIR}/${DEVNAME}"
+    ( wait_and_add >/dev/null 2>&1 & )
     
     # See /etc/hotplug/usb.agent for a description of how REMOVER works.
     ln -sf "${0}" "${REMOVER}"


Index: sane-backends.spec
===================================================================
RCS file: /cvs/dist/rpms/sane-backends/FC-4/sane-backends.spec,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- sane-backends.spec	20 Dec 2005 13:22:37 -0000	1.44
+++ sane-backends.spec	5 Apr 2006 13:41:19 -0000	1.45
@@ -4,7 +4,7 @@
 Summary: Scanner access software
 Name: sane-backends
 Version: 1.0.17
-Release: 0.fc4.1
+Release: 0.fc4.2
 License: GPL (programs), relaxed LGPL (libraries), and public domain (docs)
 Group: System Environment/Libraries
 Source0: ftp://ftp.sane-project.org/pub/sane/%{name}-%{version}/%{name}-%{version}.tar.gz
@@ -135,6 +135,10 @@
 %{_libdir}/sane/*.so
 
 %changelog
+* Wed Apr 05 2006 Nils Philippsen <nphilipp at redhat.com> 1.0.17-0.fc4.2
+- update libusbscanner to handle cold-plugged USB scanners (#144444, slightly
+  changed patch by Michal Jaegermann)
+
 * Tue Dec 20 2005 Nils Philippsen <nphilipp at redhat.com> 1.0.17-1
 - version 1.0.17
 - reenable gphoto2 backend




More information about the fedora-cvs-commits mailing list