Skip to content

Navigation Menu

Sign in
Sign up

Snap calling LPrint Snap #180

wills721 started this conversation in General
Apr 11, 2025 · 5 comments · 3 replies
Discussion options

I have my own Snap for my own product and application. How can I call LPrint Snap from within my own Snap?

Seems like I would need LPrint SNAP to expose a Slot of type content for an interface?

@michaelrsweet

You must be logged in to vote

Replies: 5 comments 3 replies

Comment options

I think you can just run the "lprint" executable like any other command on the system?

You must be logged in to vote
0 replies
Comment options

Not from within a Snap no. Outside the Snap yes. @michaelrsweet

In order for my Snap to call out to your Snap your snapcraft.yaml needs to expose a Slot and then my Snap setups a Plug in. At least I believe this is what would need to happen in order to call Lprint from within my Snap.

You must be logged in to vote
1 reply
Comment options

Unfortunately, I really don't know how that would work... Usually snaps are standalone...

@tillkamppeter Do you have any thoughts on this?

Comment options

When the LPrint Snap is installed, it is running the LPrint Printer Application, a daemon listening on localhost:8000 (port can vary if other daemons are running, use LPrint's DNS-SD broadcast for exact info) and understanding IPP, behaving as a driverless IPP printer. So your Snap only needs to plug the network and avahi-observe interfaces to discover the LPrint Printer Application and to talk IPP to it for actually printing. All control of the running LPrint Printer Application can be done by IPP (there are extensions specific to PAPPL), you do not need the command line client.

To talk IPP, use libcups for C programs and goipp for Go programs, libcups bindings for any other programming language.

You must be logged in to vote
0 replies
Comment options

@tillkamppeter I see. So from my Snap's pov it is only talking cups. I will try this and report back.

You must be logged in to vote
0 replies
Comment options

@michaelrsweet @tillkamppeter Well, I found out that within a snap you can shell call other snaps using 'snap run ' so I just shell call 'snap run lprint'. Easy.

You must be logged in to vote
2 replies
Comment options

@michaelrsweet @tillkamppeter Well, I found out that within a snap you can shell call other snaps using 'snap run ' so I just shell call 'snap run lprint'. Easy.

Good to know, thanks a lot.

But keep in mind:

  • When you install the LPrint Snap, it automatically starts the LPrint daemon. Therefore use snap run lprint only for controlling or communicating with the running daemon via command line, not for daemon-less operation of LPrint.
  • The LPrint daemon can be controlled/communicated with by lprint on the command line or by IPP, the former is more useful if you have a shell script. From a C program the better way is to use IPP.
Comment options

@tillkamppeter Got it. Thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Converted from issue

This discussion was converted from issue #178 on April 13, 2025 22:01.

AltStyle によって変換されたページ (->オリジナル) /