-
-
Notifications
You must be signed in to change notification settings - Fork 42
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?
All reactions
Replies: 5 comments 3 replies
I think you can just run the "lprint" executable like any other command on the system?
All reactions
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.
All reactions
Unfortunately, I really don't know how that would work... Usually snaps are standalone...
@tillkamppeter Do you have any thoughts on this?
All reactions
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.
All reactions
@tillkamppeter I see. So from my Snap's pov it is only talking cups. I will try this and report back.
All reactions
@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.
All reactions
@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 lprintonly 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
lprinton 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.
All reactions
@tillkamppeter Got it. Thank you for your help.