diff -Nru system-config-printer-1.5.12/debian/changelog system-config-printer-1.5.12/debian/changelog --- system-config-printer-1.5.12/debian/changelog 2020-10-09 18:51:11.000000000 +0800 +++ system-config-printer-1.5.12/debian/changelog 2020-11-03 15:31:05.000000000 +0800 @@ -1,3 +1,10 @@ +system-config-printer (1.5.12-0ubuntu4) groovy; urgency=medium + + * Update the udev rule due to usb_id udev import is disabled in some systems. + * Make the matching rule of printer device path more flexible. + + -- hugh chao Tue, 03 Nov 2020 15:31:05 +0800 + system-config-printer (1.5.12-0ubuntu3) groovy; urgency=medium * Really do not recommend ippusbxd any more. diff -Nru system-config-printer-1.5.12/debian/patches/44-make-matching-rule-more-flexible.patch system-config-printer-1.5.12/debian/patches/44-make-matching-rule-more-flexible.patch --- system-config-printer-1.5.12/debian/patches/44-make-matching-rule-more-flexible.patch 1970-01-01 08:00:00.000000000 +0800 +++ system-config-printer-1.5.12/debian/patches/44-make-matching-rule-more-flexible.patch 2020-11-03 15:31:05.000000000 +0800 @@ -0,0 +1,59 @@ +## Description: After printers (non-ippusb protocal) have been disconnected, the status of cups still shows "idle" instead of "disabled", this patch make the matching rule more flexible. +## Origin/Author: hugh.chao@canonical.com +## Bug: https://github.com/OpenPrinting/system-config-printer/issues/182 +Index: system-config-printer-1.5.12/udev/70-printers.rules +=================================================================== +--- system-config-printer-1.5.12.orig/udev/70-printers.rules ++++ system-config-printer-1.5.12/udev/70-printers.rules +@@ -1,4 +1,4 @@ + # Low-level USB device add trigger + ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", ENV{ID_USB_INTERFACES}!="*:070104:*", TAG+="systemd", ENV{SYSTEMD_WANTS}="configure-printer@usb-$env{BUSNUM}-$env{DEVNUM}.service" + # Low-level USB device remove trigger +-ACTION=="remove", SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:0701*:*", ENV{ID_USB_INTERFACES}!="*:070104:*", RUN+="udev-configure-printer remove %p" ++ACTION=="remove", SUBSYSTEM=="usb", ENV{INTERFACE}=="7/1/*", ENV{INTERFACE}!="7/1/4", RUN+="udev-configure-printer remove %p" +Index: system-config-printer-1.5.12/udev/udev-configure-printer.c +=================================================================== +--- system-config-printer-1.5.12.orig/udev/udev-configure-printer.c ++++ system-config-printer-1.5.12/udev/udev-configure-printer.c +@@ -1793,6 +1793,30 @@ disable_queue (const char *printer_uri, + } + + static int ++device_exists(char *device_path) ++{ ++ char full_path[100]; ++ struct stat buffer; ++ int exist = -1; ++ int path_length=strlen(device_path); ++ // 5 is the length of "/sys" + null ++ snprintf(full_path, path_length + 5, "%s%s", "/sys", device_path); ++ ++ // check the exist of this device ++ if (stat(full_path, &buffer) == 0){ ++ exist = 1; ++ } ++ ++ return exist; ++} ++ ++static char* ++compare_usb_uri(char *uri_store, char *uri_uevent) ++{ ++ return strstr(uri_uevent, uri_store); ++} ++ ++static int + do_remove (const char *devaddr) + { + struct usb_uri_map *map; +@@ -1830,8 +1854,8 @@ do_remove (const char *devaddr) + map = read_usb_uri_map (); + prev = &map->entries; + for (entry = map->entries; entry; entry = entry->next) +- { +- if (!strcmp (entry->devpath, devpath)) ++ { ++ if (compare_usb_uri(entry->devpath, devpath) !=NULL && device_exists(entry->devpath) == -1) + { + uris = &entry->uris; + break; diff -Nru system-config-printer-1.5.12/debian/patches/series system-config-printer-1.5.12/debian/patches/series --- system-config-printer-1.5.12/debian/patches/series 2020-02-25 05:15:11.000000000 +0800 +++ system-config-printer-1.5.12/debian/patches/series 2020-11-03 15:26:47.000000000 +0800 @@ -8,3 +8,4 @@ 33_no-usb-queues-for-ipp-over-usb-printers.patch 40-udev-configure-printer-add-checks-for-null.patch 43-fix-abrt-in-udev-configure-printer.patch +44-make-matching-rule-more-flexible.patch