OpenPrinting / system-config-printer

Graphical user interface for CUPS administration
GNU General Public License v2.0
164 stars 90 forks source link

The status of cups still shows idle when the printer has been unplugged #182

Closed hugh712 closed 3 years ago

hugh712 commented 4 years ago

[ Impact ] After printers (non-ippusb protocal) have been disconnected, the status of cups still shows "idle" instead of "disabled", so seems the disconnected procedure hasn't worked well.

[ Test Case ]

  1. Connect the printer (non-ippusb protocal)(which isn't 070104) with the machine
  2. Wait for the status of cups became "Idle" (lpstat -p)
  3. Unplug the cable of the printer
  4. Check the status of cups again. (lpstat -p)

[Expected result] The status should show disabled.

[Actual result] The status shows idle.

[info] Target: HP LaserJet Pro203dw HP Officejet 100 Mobile Printer HP Officeject 200 Mobile Printer Brother HL-2250DN Samsung ML-331x

hugh712 commented 4 years ago

currently the syspath for udev-configure-printer is too specific level as:

/devices/pci0000:00/0000:00:14.0/usb1/1-5

But current path can be as below for removing

/devices/pci0000:00/0000:00:14.0/usb1/1-5:1.0 or /devices/pci0000:00/0000:00:14.0/usb1/1-5:1.0/usbmisc/lp0

hugh712 commented 4 years ago

The idea of my solution[0] is:

  1. check if the path provided by map is a subset of removing device path eg. /devices/pci0000:00/0000:00:14.0/usb1/1-5 is a subset of /devices/pci0000:00/0000:00:14.0/usb1/1-5:1.0

  2. check if the exist of this device eg. stat /sys/devices/pci0000:00/0000:00:14.0/usb1/1-5

  3. if this device is not exist, then remove..

[0] https://github.com/hugh712/system-config-printer

tillkamppeter commented 3 years ago

Merged PR #183 which fixes this. Thank you very much.

RokeJulianLockhart commented 2 years ago

This continues to affect me in Fedora 36. Was this problem definitely resolved? For those that observe this during the future, choose your cables wisely!