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,33 @@ 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"); + printf ("SUBSYSTEM==\"usb\", ENV{DEVTYPE}!=\"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=\"664\", GROUP=\"scanner\"\n", usbid->usb_vendor_id + 2, usbid->usb_product_id + 2); usbid = usbid->next; }