summaryrefslogtreecommitdiff
blob: 2daf62098ffd328a5e3dff1ae4bb70b05de19167 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Index: tools/sane-desc.c
===================================================================
--- tools/sane-desc.c.orig
+++ tools/sane-desc.c
@@ -3151,7 +3151,7 @@ print_udev_header (void)
 
   printf 
     ("#\n"
-     "# udev rules file for supported USB devices\n"
+     "# udev rules file for supported USB and SCSI devices\n"
      "#\n"
      "# To add a USB device, add a rule to the list below between the SUBSYSTEM...\n"
      "# and LABEL... lines.\n"
@@ -3169,25 +3169,32 @@ print_udev_header (void)
 static void
 print_udev (void)
 {
+  int commentlen;
   usbid_type *usbid = create_usbids_table ();
 
   print_udev_header ();
   printf ("\nACTION!=\"add\", GOTO=\"libsane_rules_end\"\n");
-  printf ("SUBSYSTEM!=\"usb_device\", GOTO=\"libsane_rules_end\"\n\n");
+  puts("SUBSYSTEMS==\"scsi\", ATTRS{type}==\"6\", MODE=\"660\", GROUP=\"scanner\"");
+  printf ("SUBSYSTEM!=\"usb|usb_device\", GOTO=\"libsane_rules_end\"\n\n");
   while (usbid)
     {
       manufacturer_model_type * name = usbid->name;
 
-      printf ("# ");
+      commentlen = printf ("# ");
       while (name)
 	{
-	  if (name != usbid->name)
-	    printf (" | ");
-	  printf ("%s", name->name);
+	  if (name != usbid->name) {
+	    commentlen += printf (" | ");
+	  }  
+	  if(commentlen + strlen(name->name) > 480) {
+		  printf(" (line too long, names omitted)");
+		  break;
+	  }
+	  commentlen += printf ("%s", name->name);
 	  name = name->next;
 	}
       printf ("\n");
-      printf ("SYSFS{idVendor}==\"%s\", SYSFS{idProduct}==\"%s\", MODE=\"660\", GROUP=\"scanner\"\n",
+      printf ("ATTRS{idVendor}==\"%s\", ATTRS{idProduct}==\"%s\", MODE=\"660\", GROUP=\"scanner\"\n",
 	      usbid->usb_vendor_id + 2,  usbid->usb_product_id + 2);
       usbid = usbid->next;
     }