Index: packaging/generic/print-camera-list.c =================================================================== --- packaging/generic/print-camera-list.c (revision 9114) +++ packaging/generic/print-camera-list.c (working copy) @@ -39,6 +39,7 @@ " --debug print all debug output\n" \ " --help print this help message\n" \ " --verbose also print comments with camera model names\n" \ +" --oldudev when generating udev rulres, use the old syntax (for udev<=097)\n" \ "\n" \ ARGV0 " prints the camera list in the specified format FORMAT on stdout.\n" \ "\n" \ @@ -126,6 +127,7 @@ exit(13); \ } while (0) +static int oldudev_mode = FALSE; /* whether to use the old udev syntax */ /* print_usb_usermap * @@ -289,7 +291,10 @@ udev_begin_func (const func_params_t *params) { printf ("# udev rules file for libgphoto2\n#\n"); - printf ("BUS!=\"usb\", ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n"); + if (!oldudev_mode) + printf ("SUBSYSTEMS!=\"usb\", ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n"); + else + printf ("BUS!=\"usb\", ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n"); return 0; } @@ -345,16 +350,29 @@ } if (flags & GP_USB_HOTPLUG_MATCH_INT_CLASS) { - printf("SYSFS{bInterfaceClass}==\"%02x\", ", class); + if (!oldudev_mode) + printf("ATTRS{bInterfaceClass}==\"%02x\", ", class); + else + printf("SYSFS{bInterfaceClass}==\"%02x\", ", class); if (flags & GP_USB_HOTPLUG_MATCH_INT_SUBCLASS) { - printf("SYSFS{bInterfaceSubClass}==\"%02x\", ", subclass); + if (!oldudev_mode) + printf("ATTRS{bInterfaceSubClass}==\"%02x\", ", subclass); + else + printf("SYSFS{bInterfaceSubClass}==\"%02x\", ", subclass); } if (flags & GP_USB_HOTPLUG_MATCH_INT_PROTOCOL) { - printf("SYSFS{bInterfaceProtocol}==\"%02x\", ", proto); + if (!oldudev_mode) + printf("ATTRS{bInterfaceProtocol}==\"%02x\", ", proto); + else + printf("SYSFS{bInterfaceProtocol}==\"%02x\", ", proto); } } else { - printf ("SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\", ", - a->usb_vendor, a->usb_product); + if (!oldudev_mode) + printf ("ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ", + a->usb_vendor, a->usb_product); + else + printf ("SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\", ", + a->usb_vendor, a->usb_product); } if ((*params->argv)[1] == NULL) { const char *hotplug_script = ((*params->argv)[0] != NULL) @@ -1003,6 +1021,12 @@ gp_log_add_func (GP_LOG_ALL, debug_func, NULL); } else if (0 == strcmp(argv[i], "--help")) { return print_help(); + } else if (0 == strcmp(argv[i], "--oldudev")) { + if (oldudev_mode) { + fprintf(stderr, "Error: duplicate parameter: option \"%s\"\n", argv[i]); + return 1; + } + oldudev_mode = TRUE; } else { format_name = argv[i]; }