Blame SOURCES/sane-backends-1.0.25-udev.patch

7a04bb
From 252f347d59fff3ab1877f77a36613b318651725e Mon Sep 17 00:00:00 2001
7a04bb
From: Nils Philippsen <nils@redhat.com>
7a04bb
Date: Tue, 8 Oct 2013 16:29:13 +0200
7a04bb
Subject: [PATCH] patch: udev
7a04bb
7a04bb
Squashed commit of the following:
7a04bb
7a04bb
commit fb6d1f4c0d17f1df33429bf03a64cd4fbb819ea5
7a04bb
Author: Nils Philippsen <nils@redhat.com>
7a04bb
Date:   Tue Oct 8 16:24:49 2013 +0200
7a04bb
7a04bb
    adapt generated udev rules for Fedora
7a04bb
7a04bb
commit 8bffaccc1eeb19ecbaddb4ac9da73954af4c5d4f
7a04bb
Author: Nils Philippsen <nils@redhat.com>
7a04bb
Date:   Mon Sep 10 12:20:43 2012 +0200
7a04bb
7a04bb
    use group and mode macros consistently
7a04bb
---
7a04bb
 tools/sane-desc.c | 14 +++++++-------
7a04bb
 1 file changed, 7 insertions(+), 7 deletions(-)
7a04bb
7a04bb
diff --git a/tools/sane-desc.c b/tools/sane-desc.c
7a04bb
index badc8ce..f992bf5 100644
7a04bb
--- a/tools/sane-desc.c
7a04bb
+++ b/tools/sane-desc.c
7a04bb
@@ -57,9 +57,9 @@
7a04bb
 #define COLOR_NEW          "\"#F00000\""
7a04bb
 #define COLOR_UNKNOWN      "\"#000000\""
7a04bb
 
7a04bb
-#define DEVMODE  "0664"
7a04bb
+#define DEVMODE  "0644"
7a04bb
 #define DEVOWNER "root"
7a04bb
-#define DEVGROUP "scanner"
7a04bb
+#define DEVGROUP "root"
7a04bb
 
7a04bb
 #ifndef PATH_MAX
7a04bb
 # define PATH_MAX 1024
7a04bb
@@ -3564,7 +3564,8 @@ print_udev (void)
7a04bb
     }
7a04bb
 
7a04bb
   printf("\n# The following rule will disable USB autosuspend for the device\n");
7a04bb
-  printf("ENV{libsane_matched}==\"yes\", RUN+=\"/bin/sh -c 'if test -e /sys/$env{DEVPATH}/power/control; then echo on > /sys/$env{DEVPATH}/power/control; elif test -e /sys/$env{DEVPATH}/power/level; then echo on > /sys/$env{DEVPATH}/power/level; fi'\"\n");
7a04bb
+  printf("ENV{libsane_matched}==\"yes\", TEST==\"power/control\", ATTR{power/control}=\"on\"\n");
7a04bb
+  printf("ENV{libsane_matched}==\"yes\", TEST!=\"power/control\", TEST==\"power/level\", ATTR{power/level}=\"on\"\n");
7a04bb
 
7a04bb
   printf ("\nLABEL=\"libsane_usb_rules_end\"\n\n");
7a04bb
 
7a04bb
@@ -3641,10 +3642,8 @@ print_udev (void)
7a04bb
     }
7a04bb
   printf ("LABEL=\"libsane_scsi_rules_end\"\n");
7a04bb
 
7a04bb
-  if (mode == output_mode_udevacl)
7a04bb
-    printf("\nENV{libsane_matched}==\"yes\", RUN+=\"/bin/setfacl -m g:%s:rw $env{DEVNAME}\"\n", DEVGROUP);
7a04bb
-  else
7a04bb
-    printf ("\nENV{libsane_matched}==\"yes\", MODE=\"664\", GROUP=\"scanner\"\n");
7a04bb
+  if (mode != output_mode_udevacl)
7a04bb
+    printf ("\nENV{libsane_matched}==\"yes\", MODE=\"%s\", GROUP=\"%s\"\n", DEVMODE, DEVGROUP);
7a04bb
 
7a04bb
   printf ("\nLABEL=\"libsane_rules_end\"\n");
7a04bb
 }
7a04bb
@@ -3695,6 +3694,7 @@ print_udevhwdb (void)
7a04bb
 
7a04bb
   printf("# The following rule will disable USB autosuspend for the device\n");
7a04bb
   printf("ENV{DEVTYPE}==\"usb_device\", ENV{libsane_matched}==\"yes\", TEST==\"power/control\", ATTR{power/control}=\"on\"\n\n");
7a04bb
+  printf("ENV{DEVTYPE}==\"usb_device\", ENV{libsane_matched}==\"yes\", TEST!=\"power/control\", TEST==\"power/level\", ATTR{power/level}=\"on\"\n");
7a04bb
 
7a04bb
   printf ("SUBSYSTEMS==\"scsi\", GOTO=\"libsane_scsi_rules_begin\"\n");
7a04bb
   printf ("GOTO=\"libsane_rules_end\"\n\n");
7a04bb
-- 
7a04bb
2.5.0
7a04bb