3

On GNU/Linux how does one setup the sane package (i.e. Scanning Access Now Easy) for a Canon Pixma scanner connected via a local network router, e.g. Wi-Fi?

Elliptical view
  • 1,160
  • 12
  • 23

1 Answers1

4

The low cost, Canon Pixma, all-in-one printer/scanner can be used with GNU/Linux, but Canon won't tell you this. Because I've had to struggle to get it fully functional, I am sharing my notes here. I have a model MG2924 of the MG2900 series. (BTW, getting printing working is the subject of another post.)

First get the Canon Pixma scanner to work with a USB cable.

This will tell you if the rest of sane is working before you deal with the network issues.

In /etc/sane.d/

  • sane.conf - nothing needed in here

  • net.conf - also nothing needed in here
    (This is for scanners connected to another host (probably with a USB cable to that host).)

  • canon.conf - also nothing needed in here
    (This is NOT for canon pixma scanners, but rather for other canon scanners.)

  • dll.conf - 'pixma' must be in the list here.
    This is the list of scanner drivers to dynamically load.

    Note 1: 'net' is NOT needed here, but don't take it out.
    net appears to be for when a scanner is connected to host A, and host B wants to use it via host A.

    Note 2: This pixma driver entry is for both Canon pixma interface types:

    • Wired via a USB cable, and/or
    • Networked via a local network interface via a WiFi link or Ethernet cable.
  • pixma.conf - For only a USB link, this can initially remain empty.


Now test your scanner with a USB cable:

  • First run sane-find-scanner | grep found. You should see something like this:

    found USB scanner (vendor=0x04a9 [Canon], product=0x1780 [MG2900 series]) at libusb:001:007

  • Also test with scanimage -L for a similar result as before, and then finally do a full test with

  • Simple Scan (a GUI, from the package simple-scan on Debian).


Now get network scanning to work.

  • pixma.conf - Now you have to add to this the URI(s) to your scanner(s).

    The trouble is that this URI is probably being served to your scanner from DHCP in your local router (e.g. your Wi-Fi box), so this IP address can change when you re-power. (We'll deal with that in a moment.)

    To find the IP address for your printer/scanner run sudo arp -a and then grep the output for the MAC address stamped on the underside of your scanner.

    Now add a line for your IP like this, bjnp://<ip>, e.g. bjnp://192.168.1.5

    bjnp is the proprietary Canon protocol used to talk to this printer/scanner. This was reverse engineered and put in the pixma driver to allow you to use a Canon pixma printer/scanner with Linux.


Now re-test with scanimage -L and then with Simple Scan (a GUI, from the package simple-scan on Debian). Note, you can't use sane-fine-scanner because it only scans for USB and SCSI connected scanners, not for scanners on the local network.

At this point you should be able to scan over WiFi.


Now to solve the problem of DHCP in the future changing this IP address.

The best solution I've found so far is to put a short list of the most probably IP's you'll see in pixma.conf, like this:

#put the most probable first (not sure if this matters)

bjnp://192.168.1.2
bjnp://192.168.1.3
bjnp://192.168.1.4
bjnp://192.168.1.5
bjnp://192.168.1.6
bjnp://192.168.1.7
# that should be enough 

# You may have to add more or less IP addresses above to meet your needs.

The startup will be slow because it has to check all of these IPs before it can startup, but it should work. ........ alternatively you can either use a USB cable, or you can run arp from time to time to find out which IP your scanner is currently on, and then hand update pixma.conf.

If someone has a better solution, I'd love to hear it.

Elliptical view
  • 1,160
  • 12
  • 23
  • @DHCP: A DHCP "static allocation", or "reservation" is what you want. Most routers have an option for this (e.g. Linksys: https://www.linksys.com/us/support-article?articleNum=135673). You can assign an address to the scanner's MAC, and the DHCP server will always give that same address to that device. – zebediah49 Apr 20 '21 at 04:08
  • Thanks adding the IP to `pixma.conf` file worked for me. – n.podbielski Jul 25 '23 at 09:15