OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
1.1k stars 195 forks source link

How to execute a specific command before printing? #1045

Closed SeeleVolleri closed 2 months ago

SeeleVolleri commented 2 months ago

Hi guys, I am using HP Laserjet 1020 plus (hp laserjet 1020), the hplip propriteriy driver requires manual execute hp-firmware to download the firmware, then start printing. Otherwise the printer just sitting there watch me find why it doesn't work.

System Information:

Additional context Docker running using

$ docker run -d --name=cups \
--net="host" \
--privileged=true \
-e TZ="Asia/Shanghai" \
-v /dev:/dev \
-v "/etc/avahi/services:/etc/avahi/services" \
-v /var/run/dbus:/var/run/dbus \
olbat/cupsd
root@Sumeru:/# lpstat -l -e
_1020_Sumeru network none ipps://%E6%83%A0%E6%99%AE%201020%20%40%20Sumeru._ipps._tcp.local/cups
HP_LaserJet_1020_USB_S413MJ9_HPLIP permanent ipp://localhost:631/printers/HP_LaserJet_1020_USB_S413MJ9_HPLIP hp:/usb/HP_LaserJet_1020?serial=S413MJ9
ValdikSS commented 2 months ago

Make the udev rule on your host to run the command you need upon connecting. You can check such a rule in either hplip or foo2zjs.

SeeleVolleri commented 2 months ago

I know, it's just a scenario... not possible in CUPS?

georgeraraujo commented 2 months ago

Looks like a job for Tea4CUPS, more specifically with a prehook. The Debian Wiki has an entry with a description of the capabilities of Tea4CUPS with examples.

SeeleVolleri commented 2 months ago

Thanks, I tried and works as I expected!