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