October 14, 2008

Canon PIXMA scanners now network ready on Linux !

A major update of the PIXMA backend is now available through Sane CVS.

Door is opened to scanning over a network on Linux, with (presumably) all PIXMA multifunction scanners offering a network connexion.

On Linux, older PIXMA models offering network connexion were only able to print, under the JetDirect protocol, using the well known port 9100.
Scanning over the network without a Windows or Mac box was unfortunately not possible, because involving a Canon proprietary protocol, named BJNP, coming with absolutely no information or documentation, and thus very difficult to approach.

Recent PIXMA models offering network connexion have been "enhanced" by Canon, in the way they now accept ... only the BJNP protocol for printing and scanning!
Bye bye JetDirect, welcome to Canon's world!

The situation then for Linux users? print and scan only with USB, forget about network ...

Until ...

Until Louis Lagendijk, a Linux user like many of us, acquired his new PIXMA MP970, and started to work on demystifying this BJNP Canon protocol, for his own needs, to have his printer work over the network.
Louis first designed a Cups printing driver, that works with all network PIXMA printers running the BJNP protocol. This cups-bjnp driver is available here.

Recently, Louis has also worked on adding BJNP support to the Sane pixma backend ...
The result now: you can scan over a LAN network on Linux with Xsane, and your PIXMA network scanner !

Great job.

With the arrival of Canon's new PIXMA 2008 series, models like MP620, MP980, ... which propose network and Wifi, are very likely (but feedback needed!) to be used on Linux with Sane, Cups, for printing and scanning over network ...

Good news again for Linux Canon users!

April 22, 2008

Give your scanner a new fresh SANE installation ...

Many Canon Pixma models are supported directly by the Sane Library (through the pixma backend), and the use of an older specific driver is not necessary anymore. Support is either natively brought by the Linux distribution you're running, latest models or bug fixes become available by using the git version

So it became necessary to rationalize all the older articles posted on that blog, in order to guide users to the sole and correct solution to install the pixma backend on their system. Old articles have been retailored, this main tutorial has now all the necessary stuff to get your Pixma scanner ready to use with Sane.

This little guide will explain you how to get the latest Sane git version to be installed on your system. As always, the Sane git version contains the latest release of the Sane pixma backend.
Note that the procedure here can be used also for installing the version 1.0.20 of the Sane library.

All recent PIXMA and ImageClass models are supported, see the man pages or sane-project.org doc pages for more information.
The following models have at least been tested or reported to work fine with Sane.
  • PIXMA MP210, MP220, MP240, MP250, MP260, MP270
  • PIXMA MP450, MP460, MP470, MP480, MP490
  • PIXMA MP500, MP510, MP520, MP530, MP540, MP560
  • PIXMA MP600, MP600R, MP610, MP620, MP630, MP640, MP710
  • PIXMA MP800, MP800R, MP810, MP830, MP960, MP970, MP980, MP990
  • PIXMA MX300, MX310, MX330, MX700, MX850, MX860, MX7600
  • MultiPASS MP700, MP730, PIXMA MP750 (no grayscale)
  • ImageCLASS MF3110, MF4010, MF4018, MF4120, MF4122, MF4140
  • ImageCLASS MF4150, MF4270, MF4370dn, MF4380dn
  • ImageCLASS MF4660, MF4690, MF5770, D480
  • I-SENSYS MF4320d, MF4330d

All models are now supported through USB or network BJNP (Canon's proprietary) protocol, Wired Ethernet or Wifi.

As compile Sane can be sometimes tricky, I'll try to give you the way to avoid pitfalls and have it working at the end, without too much efforts.

Hope it helps !! Let's go.
  • Download latest Sane git package

    2 methods to get the latest Sane git package are possible.

    • HTTP access method

      The HTTP access method should be used only if you are restricted by a firewall that won't let you use the git protocol. HTTP is slower and requires more bandwidth than any other access methods.

      You can download an http snapshot at the address hereafter, where Sane git is hosted:

      http://git.debian.org/?p=sane/sane-backends.git

      Download the latest (upper, named MASTER) tar.gz snapshot image

      Do a quick check after download, that the directory contained in the archive is at a current date.
      Then, untar the package into a directory.

    • Or use git to download it, as developers do ...

      This is actually better than the previous method, as you can later easily update (using git again) the content of the downloaded files, simply issuing a git pull command.
      You patch just the modified files, and you will recompile only what has changed, not the whole thing.

      So first, you must install the git application on your system, it should be available already packaged in your distribution repositories, the name should be something like: git-core or git-scm

      Then, in a terminal, enter the following command:

      $ git clone git://git.debian.org/sane/sane-backends.git

      Files download will begin. You’ll get in your current directory, a new directory named sane-backends. This is the main directory were all the Sane source files are located.

      Updating to the latest source files from the repository

      If you want later to update your git directory with the latest version available from the public Sane git repository, in order to build the latest Sane code, you just need to enter the following command, from the sane-backends directory:

      $ git pull

      This will download the latest changes to the files in your directory sane-backends.

      Then, to build Sane, you can apply the following procedure from the "make", then "make install" statements as indicated here below. Only changed files will be recompiled.
  • Build Sane

    Enter the directory sane-backends created after downloading Sane git.

    The procedure is then “almost” classical, with a few points to take into account instead of running a trivial ./configure, make, make install.

    According to your Linux distribution, you need to run the ./configure command with a set of parameters.

    As it is not possible to cover here all existing distributions, details are given for Ubuntu and Mandriva, as samples.

    For these 2 distributions:

    • Check first that the development libusb library is present and installed.

      On Mandriva, the rpm is called something like:

      libusb0.1_x-devel-...

      on Ubuntu, it is called: libusb-dev.

      Install the package, if not already installed.

      Be warned that if not installed, compilation will success, but the backend will not work, and no error message will be prompted!

    • On both distributions, run the ./configure command like this:

      $ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var

      This will choose /usr/lib/sane as SANE lib directory, /etc/sane.d as SANE config files dir, and /var/lock/sane as state directory: The ones that are used by Mandriva and Ubuntu.

      Check in the logs coming in the terminal window, at the end of the configure, that it will compile with usb support.

    • Then compile as usual

      $ make

      This will take ... a significative amount of time ... Can have a cup of coffee.

    • Install on Ubuntu

      $ sudo make install

    • Or install on Mandriva

      $ su
      # make install
  • Set non-root users permissions

    Now, permissions for non root users to access the scanners need to be set up, as not achieved by the “make install” statement.

    These permission settings depend also on the Linux distribution: whether it uses hotplug, udev, …

    Ubuntu Hardy and later (Intrepid, ...)
    This tweak is not necessary as hardware detection is performed by HAL and not udev, the scanner should be available for non root users, as long as permissions are set to enable scanning from menu: System/Administration/Users and Groups (need a logout/login for changes to be taken into account).
    However, if you experience permissions problems for non root users (ressource not available) on these latest Ubuntu releases, you should try Lee's suggestion, for tweaking the
    /etc/udev/rules.d/40-basic-permissions.rules.

    Ubuntu Jaunty
    Try Darryl's tweak on Jaunty 9.04 to set up persistent-to-upgrades udev rules.



    Ubuntu (releases before Hardy Heron 8.04) and Mandriva both use udev to detect USB devices.
    SANE compilation produces a udev rules file, covering all scanners handled.
    It is named: sane-backends/tools/udev/libsane.rules
    You'll need to install it, by simply replacing the current installed file (coming from the SANE package installed by your Linux distribution), with this new one.
    • Locate first this file
      in the /etc/udev/rules.d directory, it should be called XX-libsane.rules

    • Backup this file somewhere

    • Copy over it, the SANE GIT generated libsane.rules
      Keep the same name as the original one.
      This should give you the following statements, for instance, on Ubuntu:

      $ cp /etc/udev/rules.d/70-libsane.rules ~/
      $ sudo cp tools/udev/libsane.rules /etc/udev/rules.d/70-libsane.rules

    • Have udev take into account the new rules
      Simply reboot, or unplug/replug your scanner USB cable.

  • Test Sane installation

    Now, check that the new Sane git is correctly installed.

    Current Sane git sane-backends version is 1.0.21, check it:

    $ scanimage -V
    scanimage (sane-backends) 1.0.21cvs; backend version 1.0.21

    At that point, you should be able to run some scans with scanimage, and if OK, with Xsane :

    $ scanimage -L
    device `pixma:04A91725_10484D' is a CANON Canon PIXMA MP610 multi-function peripheral

    Next statement will perform a short test of the scanner, you may hear it start scanning and promptly stop.

    $ scanimage –T
    scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
    scanimage: acquiring RGB frame, 8 bits/sample
    scanimage: reading one scanline, 1920 bytes... PASS
    scanimage: reading one byte... PASS
    scanimage: stepped read, 2 bytes... PASS
    scanimage: stepped read, 4 bytes... PASS
    scanimage: stepped read, 8 bytes... PASS
    scanimage: stepped read, 16 bytes... PASS
    scanimage: stepped read, 32 bytes... PASS
    scanimage: stepped read, 64 bytes... PASS
    scanimage: stepped read, 128 bytes... PASS
    scanimage: stepped read, 256 bytes... PASS
    scanimage: stepped read, 512 bytes... PASS
    scanimage: stepped read, 1024 bytes... PASS
    scanimage: stepped read, 2048 bytes... PASS
    scanimage: stepped read, 2047 bytes... PASS
    scanimage: stepped read, 1023 bytes... PASS
    scanimage: stepped read, 511 bytes... PASS
    scanimage: stepped read, 255 bytes... PASS
    scanimage: stepped read, 127 bytes... PASS
    scanimage: stepped read, 63 bytes... PASS
    scanimage: stepped read, 31 bytes... PASS
    scanimage: stepped read, 15 bytes... PASS
    scanimage: stepped read, 7 bytes... PASS
    scanimage: stepped read, 3 bytes... PASS

    And the final result:

    $ xsane
Hope you'll succeed to that point !

In Xsane, you may need to adjust the colors precisely (white, black, gray), using the 3 pipette tool in the preview window.
Read Xsane documentation on how to do that. This is very easy to do, and you'll get after that beautiful scans.

To finish, here are some samples obtained with an MP610, scanning at 600 dpi, and an extra view of a small detail on a stamp, scanned at 4800 dpi.

Comments are welcome, feel free to report anything missing or incorrect ...

February 3, 2008

Canon MP210 and MP520 join the party!

UPDATE:

This article is now DEPRECATED.

For any Pixma device, install instead the latest Sane library.

Read the article on this blog here



May look out of topic here ?

Good news anyway for Canon Pixma MP210 and MP520 owners...

They will now be able to use their scanners with Sane frontends like Xsane, Kooka, ... as MP610.

Following some exchanges in this blog and the libsane mailing list, the driver updates made for MP610 appeared to be fully compatible with MP520 (message posted in this Blog by Thomas) and MP210 scanners.

The reason?

Simply, those 3 all-in-one use exactly the same USB protocol, at least for their scanner part.
Remember they were released by Canon at the same time ...

Let's congratulate this Canon's initiative, as a step towards device standardization is a major help for the programmers planet, a single driver working for at least 3 different models ... this is eden world!

Note: this latest driver version does not bring anything new to MP610 (uh ... what else could we bring anyway??)

Installation procedure

The procedure to install the pixma updated libsane driver is the same as for MP610, only the model PID needs to be correctly set in the udev rules for permissions:
  • Download latest 0.14.2u version of the libsane-pixma library, (either full package or patch for libsane-pixma 0.13.1 available) and follow the installation instructions given in this previous post.

  • When setting the permissions rules (see the same post) for MP210 or MP520, adjust the corresponding USB PID:
    • MP210 USB address: 04a9:1721
    • MP520 USB address: 04a9:1724

      This would give udev rules like for instance:
      # Canon PIXMA MP210
      SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="1721", MODE="664", GROUP="scanner"

      or
      # Canon PIXMA MP520
      SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="1724", MODE="664", GROUP="scanner"

  • Remember, to have udev take into account the rules changes, either unplug the USB cable, wait a few seconds, and plug it back, or issue the following command:
    $ sudo udevcontrol reload_rules

  • You're ready to scan! Select in your frontend (Xsane, Kooka, …) a scan resolution proposed, and start scanning:
    • for MP210: available 75, 150, 300, or 600 dpi
    • for MP520: available 75, 150, 300, 600, 1200, or 2400 dpi

Someone else has got another compatible model ? ;-)

January 9, 2008

Borderless printing on Pixma ... now painless ?

So you got this nice Pixma printer that is claimed to do "borderless" printing …

You installed the latest Canon Linux drivers for your MP600/610, run fine ...

And now, you try to print borderless photos from your favorite Desktop application … and you learn in Canon's documentation that borderless printing:
  • Requires a dedicated Canon utility (cifmp600 / cifmp610)
  • run from the command line,
  • with limited image type support (no jpeg!!!)
  • no network gui, just localhost
  • and … only available to the root user!!!
Hey, Whatzat ??

IMHO, a good reason for … reworking a little bit original ppd files, and… turnaround some buggy code.

In fact, Canon’s software already includes borderless printing with cups/ppd files, if the papersize name (in the printer ppd file) ends with “.bl”
Simply create such lines in the ppd file, and you add borderless paper types …

So simple?

Well, add also some driver bug for paper sizes with an X: 4X6, 5X7, … To avoid modifying/recompile any source code, add a small modification to Canon’s driver config file, namely:
/usr/lib/bjlib/cifmp610.conf (or /usr/lib/bjlib/cifmp600.conf for MP600), to add lines with a small x like 4x6, 5x7 in the [papersize] section.

The new packages files to download include those new ppds, along with the modified cifmp610.conf / cifmp600.conf files.

Installation

Download here the latest package for the printer and language (English or French) you want.
The package contains:
  • a new ppd file to install as explained in this previous post
  • a cifmp6x0.conf file to replace Canon’s existing one (keep a backup of Canon’s original just in case):
    • MP610 : copy over /usr/lib/bjlib/cifmp610.conf
    • MP600 : copy over /usr/lib/bjlib/cifmp600.conf
Then, you can start printing borderless images, simply by selecting the new “borderless” paper formats that appear in the paper sizes list, in your application printing dialog.

A simple live test under Gnome’s EOG and Ubuntu Gutsy

Under Gnome, simply double click an image, this trigs “Eye Of Gnome”, Gnome’s standard picture viewer. Note that many other picture viewers (KDE’s, Gnome’s …) will have the same ability, EOG is used here as sample.

EOG supports now Gnome’s standard printing dialog.

Select first the menu "File/Page setup":

Choose in the printers list, the MP610 or MP600, and in the papers list, the new borderless format you want. Choose also the image orientation.

Click apply

Now, in the printing dialog "File/print", look at the “image parameters” tab. In the preview pane, EOG will show your photo as printed on paper, the borders will be 0 if image matches paper format.

Important: choose a combination of paper type and print quality that match. Check Canon's driver user manual (see cifmp610 or cifmp600 "Print Option Combinations" section) for compatible combinations.
If you select an incompatible combination, nothing will be printed, and you won't get any error message ...

Choose also options in the "advanced" tab, and check the quality, halftoning options to match for the paper type selected.

Click print

Et voila!
Your image is printing on paper without borders ;-)

Tips:
  • PPD files have been updated for borderless A4, 4"x6", 5"x7", 4"x8", 8"x10" formats.
    If you need to add other paper formats, simply create new .bl papersizes in the ppd file.
  • Files proposed here are for MP600/MP610 printers, but the same method can be used for many other Canon printers that use the same drivers. Again, modify the same way the ppd and .conf files.
Notes:

  • You might notice that the printed image extends a little bit outside the paper. This is due to the cifmp6x0 utility, that uses a --extend parameter, which defaults to 2. This makes image extend a little bit outside the paper. See Canon’s driver cifmp6x0 documentation (borderless and extend options) for more information.
  • Borderless printing on A4 is not very accurate, as stated in Canon's documentation (the 'Doze documentation). Please take a look at this Canon documentation to get info on borderless printing.