[PATCH] More simple udev rules handling

Riccardo Magliocchetti riccardo.magliocchetti at gmail.com
Mon Jul 26 13:56:57 UTC 2010


There are a lot of issues reported on Debian BTS of not handled
cameras or more in general issues with udev. Mine is not recognized
too while it should because there should be a generic rule for
ptp cameras.

Looking in /etc/udev/rules.d and in /lib/udev/rules.d i haven't
found any link to gphoto2 rules so maybe _that_ is why it's
not working. So my idea of fix is just makes thing more simple.

I've done these changes:
- force link of udev rules in every case and remove the old one
  if exists
- one user reports that moving the rule from 025 to 090 fixed the
  issue for him, i have no idea if that could make a difference,
  so move the rule later to 90 since the other scripts here are
  not using levels starting from zero.
  In upstream documentation they use 90 too.

Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti at gmail.com>
---
 debian/changelog             |    1 +
 debian/libgphoto2-2.postinst |   10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7e1450a..5944053 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ libgphoto2 (2.4.9.1-1) unstable; urgency=low
 
   * New upstream release (Closes: #561972).
   * Dropped all patches: obsoleted or applied upstream.
+  * More simple udev rules install, should help with udev issues reported on BTS.
 
  -- Riccardo Magliocchetti <riccardo.magliocchetti at gmail.com>  Mon, 26 Jul 2010 13:27:49 +0200
 
diff --git a/debian/libgphoto2-2.postinst b/debian/libgphoto2-2.postinst
index 6975dd9..222c7d1 100644
--- a/debian/libgphoto2-2.postinst
+++ b/debian/libgphoto2-2.postinst
@@ -20,11 +20,11 @@ case "$1" in
 	# create udev rules file
 	if [ -d /etc/udev/ ]; then
 	    /usr/lib/$PACKAGE/print-camera-list udev-rules version 0.98 mode 0664 group plugdev > /etc/udev/$PACKAGE.rules
-	    # install the udev file only once:
-	    #    - the first time the package is installed
-	    # OR - the first time the package is upgraded from a version earlier than 2.1.6-5.1
-	    if [ -z "$2" ] || dpkg --compare-versions "$2" lt 2.1.6-5.1 ; then
-		ln -sf ../$PACKAGE.rules /etc/udev/rules.d/025_$PACKAGE.rules
+	    # When in doubt use brute force
+	    ln -sf ../$PACKAGE.rules /etc/udev/rules.d/90-$PACKAGE.rules
+
+	    if [ -L /etc/udev/rules.d/025_$PACKAGE.rules ]; then
+	    	rm -f /etc/udev/rules.d/025_$PACKAGE.rules
 	    fi
 
 	    if [ -L /etc/udev/rules.d/020_libgphoto2_generic-ptp_support.rules ]; then
-- 
1.7.1


--------------080803040909020108050404--



More information about the Pkg-phototools-devel mailing list