How to tell if at least one printer is connected? #111
-
|
What's the best machine-readable way to tell if at least one printer is connected? My context is freedomofpress/securedrop-client#2332 (comment), where we want to check if any printer is connected before opening a print dialog. Is it safe long-term to just look at whether |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
I think, the most reliable way is to use Avahi to tell, if there is at least one _ipp._tcp or _uscan._tcp service, connected to the local host. The ipp-usb may fail to remove |
Beta Was this translation helpful? Give feedback.
-
|
Also, if there are some blacklisted printers, ipp-usb will continue to run (keeping socket existent), though it will not touch the printer |
Beta Was this translation helpful? Give feedback.
I think, the most reliable way is to use Avahi to tell, if there is at least one _ipp._tcp or _uscan._tcp service, connected to the local host.
The ipp-usb may fail to remove
/var/ipp-usb/ctrlsocket if it crashed or if somebody unexpectedly killed it. Also, in theipp-usb standaloneandipp-usb debugmodes, the program runs forever even if there is no connected devices, and the socket remains existent.