Skip to content

Configuring captdriver from the Command Line

mounaiban edited this page Aug 14, 2022 · 7 revisions

Prerequisites

If you have completed Stages 1 (build environment setup), 2 (building) and 3 (binary installation), you are almost there and could be printing in a minute if all goes well! If you have not completed all previous stages, please do so now in order. Find out which stage you are at, then return to the unified guide to choose the right guides for your operating system, and follow their instructions.

Process

Ensure that the printer device is connected and switched on.

With captdriver and the CUPS command-line programs already installed, run the following command to identify the printer's URI:

lpinfo -v

A list of URIs should scroll in; there may be a pause before certain items on the list. You should eventually get a response like the following:

network socket
network http
network ipps
network lpd
network https
network beh
direct usb://Canon/LBP3000?serial=00001337BEEF
network ipp

PROTIP: Due to the asynchronous nature of the device detection process, the items are likely to appear in a different order.

In our example, a USB-attached Canon LBP3000 has responded to lpinfo -v with a URI, which we will use to complete the installation.

Ensure that you are in the repository root directory in which you ran make install in Stage 2, then enter the following commands in order with superuser privileges:

lpadmin -p 'LBP3000' -v usb://Canon/LBP3000?serial=00001337BEEF -P ppd/CanonLBP-2900-3000.ppd -L 'Which room' -E
# Optional: set the newly-installed printer as default
lpadmin -d 'LBP3000'

If the first command succeeded, you should be able to print right away from any application of your choice! Some apps may need to be restarted to recognise printers installed while they were running.

If the second command succeeded, the printer will be selected by default when you request a print in most apps.

Notes

The lpadmin command line structures in this example can be expressed as:

lpadmin -p $PRINTER_NAME -v $PRINTER_URI -P $PATH_TO_PPD_FILE -L $LOCATION_DESCRIPTION -E
lpadmin -d $PRINTER_NAME

Where:

  • $PRINTER_NAME: Name of the printer as it appears in most printer selectors shown when a printout is requested from an app.

  • $PATH_TO_PPD_FILE: Path to the PPD file compiled during the build process, which ties the printer to the filter, and informs applications of of the printer's features.

  • $LOCATION_DESCRIPTION: Some applications show this, and so does the CUPS web control panel (accessible from http://localhost:631 by default with a web browser).

Troubleshooting

Checking if the CUPS command line programs are installed

On some systems, the CUPS command line programs are not installed by default. You can install them from the following packages, depending on your operating system:

  • Fedora: cups-client

    • The command line programs are usually pre-installed by default, due to their bundling with cups-client.
  • Debian: cups-bsd

Checking where the CUPS command programs are installed

The CUPS command line programs may be installed, but not in a directory mentioned by the $PATH environment variable. This means you will have to use the full path to the command to use it.

For example, On Debian 10.3, most of the CUPS command line programs are installed to /usr/sbin/, making them inaccessible without specifying their full path by default.

This can be verified with the whereis command,

whereis lpinfo
whereis lpadmin

And checking the presence of the paths in the $PATH environment variable with

echo $PATH

The laziest workaround is to add an alias to the programs you use most, like:

alias lpadmin='/usr/sbin/lpadmin'
# Repeat with other programs you want to use
alias lpc='/usr/sbin/lpc'
alias cupsenable='/usr/sbin/cupsenable'
alias cupsdisable='/usr/sbin/cupsdisable'
alias cupsctl='/usr/sbin/cupsctl'

Adding /usr/sbin to the PATH environment variable enables quick access to all CUPS programs at once:

PATH=$PATH:/usr/sbin

PROTIP: Recycling the existing value of $PATH adds the /usr/sbin directory to the paths, instead of setting it to the only path.

References

Details of package cups-bsd in buster. Debian Packages https://packages.debian.org/buster/cups-bsd

Package cups-client. Fedora Packages. https://apps.fedoraproject.org/packages/cups-client/

Bookmarks

Installation Guide

Targeted Printers

Essential Test Suite

Unofficial Introduction to CAPT (Executive Summary)

Support Levels

Rootless Write Access To USB Devices

Miscellaneous Tips

Wishlists

Other Canon Printer-Related Projects

SPECS: 0xA1A1 Command and Response Format

Home Page

Search for pages starting with

  • SPECS for notes on the operation of the CAPT data formats and communications protocol
  • TESTING for guidelines on testing Captdriver
  • TIPS for potentially helpful information on studying the project or the CAPT format-protocol
Clone this wiki locally