November 25, 2007

New Sane scanner driver for Canon Pixma MP610 !

Good news, Canon MP610 is now fully operational, scanner ready under Linux !

Successfully added some modifications to the sane pixma library (home page here), to get the MP610 scanner start dozing off ... using utilities like scan, scanimage, or Xsane and hopefully many other sane frontends ... You can take a look at a 300 dpi scan, produced using Xsane / Ubuntu.

Using Canon's 'Doze driver, I snooped those little USB packets traveling between the MP610 and the computer, and discovered ... several new USB messages added by Canon, which significantly changes the protocol from previous Pixma MPs. The rest was a matter of adding this new stuff (or what I've understood it was !) into the libsane-pixma driver ... and here it is.

Several "thingies" appeared also in this Pixma driver, presumably affecting others MPs ... Fixed the I/O error bug when scanning a full page under Xsane ... Hope this new version can help also other older Canon MP users, as I bet they should fall on it also. Looks like most functions seems to be OK for now.

Of course, let me know if you discover any bugs too. Presumably, it is still in a "beta" state.

Important Note: this first MP610 driver version is currently a clone of "what the 'Doze Canon driver does on USB", and gets the same functionalities. That is to say, It scans - only for the moment I hope - up to 600 dpi. The point is that I don't know how to scan - under 'Doze - at upper resolutions ! If someone can explain how to scan at 4800 dpi using 'Doze, I'll greatly appreciate to upgrade the sane driver to do the same !

So here is now the complete stuff. As it is not yet "officialy" integrated into the libsane-pixma library, I've added the letter "u" at the end, for "unofficial". I'll take contact with the libsane-pixma maintainer to request an add-on and probably a new libsane-pixma version package.


Please go to this page of the blog, to install the latest Sane git version of the pixma backend.

This old procedure here below is not to be used anymore, but I've left it here just for reference only.
Please use the pixma backend that is now included either in the 1.0.20 Sane version, or Sane git version.
  • Get the full new package that includes MP610: mp150-0.14.0u.tar.bz2, and untar it :
    $ tar xvjf mp150-0.14.0u.tar.bz2

  • Or you can get only the MP610.0.14.0u.patch file (patch over the latest official libsane-pixma 0.13.1). To use this patch file only, download it and the libsane-pixma 0.13.1 library, untar, navigate into its main directory, and apply the patch:
    $ patch -p1 < path_to_MP610.0.14.0u.patch
Then, the installation procedure is the same (from the full package or from the patch), go into the main directory where you have you new driver files:
  1. Compile:
    $ make

    or better, if you want to optimize size (1/3 size!) and speed:
    $ make NDEBUG=yes

  2. Test
    From here, you can use the classic "scan" utility provided with the package. See the pixma home page for details on it. Example:
    $ ./scan -x 10 -y 15 -w 51 -h 25 -1 -d 20 -W pixmascan.pnm

  3. Install for Xsane, Kooka, ...
    To install for use with sane, you need to copy the file freshly compiled, to replace you current one coming with the sane library (latest one is 1.0.18). Keep a backup of your current one.
    So you need first to locate your sane currently installed, depending on your distribution.
    For instance, Mandriva and Ubuntu places it at: /usr/lib/sane/
    Simply rename: /usr/lib/sane/ to: /usr/lib/sane/
    And copy your new: to: /usr/lib/sane/

    The statements are:
    # mv /usr/lib/sane/ /usr/lib/sane/
    # cp /usr/lib/sane/

  4. Try it with scanimage, Xsane, Kooka, ...
    You're almost finished.
    Under root, you can try to run scanimage -L (sane command line scan utility) for instance.
    To use Xsane, or Kooka with your non-root user account, read now next section ...
Setting permissions to access the scanner:

Now that you've installed your new scanner, maybe you've noticed that you can only use it ... as a root user !

This behavior may vary between Linux distributions.
The MP610 is detected by udev, the universal linux hotplug device manager, as a usb device, with a unique MP610 usb address: 04a9:1725

According to your distribution's udev rules settings, udev and some scripts may add this device to a particular group, change its permissions, so that non root users can use it. If no udev rules exist, the device belongs to root, with generally too restrictive permissions for non-root users, to access it.

Here are 2 examples, on Mandriva, and Ubuntu, to adjust the udev rules, groups and permissions, to make the MP610 usable by non-root users:

On Ubuntu
As Ubuntu do not create any udev rule for it, MP610 will default to the root group, with too restrictive permissions so that non-root users won't be able to access it.

Ubuntu sets by default all users to belong to a particular group named "scanner".

So the easiest way is to tell udev to make the MP610 belong to the scanner group too.

Modify the file:

And simply add the 2 following lines in it:
# Canon PIXMA MP610
SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="1725", MODE="664", GROUP="scanner"

To have udev take into account this new change, simply... unplug the MP610 USB cable, wait a few seconds, and plug it back.
Or issue the command:
$ sudo udevcontrol reload_rules

On Mandriva
udev and some Mandriva scripts automatically add the MP610 into the "usb" group. This way, a normal user can access the scanner if he belongs to the "usb" group too. <user> can be added to the "usb" group, either with the mcc, or the following command line:
# adduser -G usb <user>

Check that <user> is added correctly to the "usb" group:
$ groups
<user> : <user> usb

Other distros ...
Based on those 2 examples, you'll need either to set:
  • your udev rules and groups, so that:
    • udev changes MP610 group to a non root group (modify the file /etc/udev/rules.d/xx-libsane.rules as with Ubuntu)
    • your normal user belongs to the same group (see for Mandriva, above).

  • or wider permissions for MP610 or all usb devices, but this is less "secure", (r+w for everyone to all USB devices).
    For enabling all usb devices to be accessed by anyone, add a udev rule like:
    SUBSYSTEM=="usb_device", MODE="0666"

    or to open access to MP610 only:
    SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="1725", MODE="666"
Remember that any change to a udev rule needs to be taken into account. For that, simply unplug and replug the USB cable, or run the command, under root:
# udevcontrol reload_rules

Good scans, and fell free to report any comment!

November 15, 2007

New CUPS PPD files for Pixma MP600 and MP610 providing more printing options ...

Canon Pixma MP600 and MP610 are great printers.
Could they become also great printers for Linux ?

Canon gave a kick to those printers by providing drivers for MP600 (which worked for MP610), and recently, drivers for the MP610 printers.

One regret however: if you use the standard printing features offered by Canon's original PPD files, you'll get only few options compared to those available if you use the Canon tools (like the cngpij tool).

So here is the good news: a set of new PPD files I've prepared, which enhances original Canon ones, and provide many additional parameters to the standard printing dialog.

These are Canon's drivers versions. Be careful, as the new PPD files proposed are to be used with the corresponding version of the driver.
  • ver 2.70 for Pixma MP600
  • ver 2.80 for Pixma MP610
For example, here are evince print and gtklp dialogs using these new PPDs:

English and French versions of this PPD are available, so you can get now French texts in your standard print dialog if you wish.

To install those PPD files, simply download them:

1 - MP600 with Canon's driver version 2.70
2 - MP610 with Canon's driver version 2.80
Then, reinstall your MP600 or MP610 printer, using the cups interface (see this previous post), and select the corresponding PPD downloaded file you want when asked for, in the cups driver selection form.

In the CUPS printers list form, the driver will show up as:
  • Canon MP600/MP610 Ver.2.70en for the English PPD / MP600
  • Canon MP600/MP610 Ver.2.70fr for the French PPD / MP600
  • Canon MP610 series Ver.2.80en for the English PPD / MP610
  • Canon MP610 series Ver.2.80fr for the French PPD / MP610
Enjoy ... ;-)

November 14, 2007

Setup Canon Pixma MP600 or MP610 multifunctions printers on Linux

A tutorial for installing the all-in-one printers Canon Pixma MP600 and MP610 under linux, using the cups printing system.

1. Download the Canon Driver

Canon proposes drivers for the MP600 printer and scanner, and now for the MP610 too.
  1. Go to the site : canon-asia and select the MP600 or MP610 printer.
  2. Download the files:

    • For both models, the file:
      • IJ Printer Driver Ver. 3.00 for Linux (debian or rpm Common package)
        This file is available on the MP638 page.
      • MP600:
        • cnijfilter-mp600-2.70-2.i386.rpm

      • MP610:
        according to your distribution (Mandriva/Red Hat like or Debian/Ubuntu like:
        • cnijfilter-mp610series-2.80-1.i386.rpm or cnijfilter-mp610series-2.80-1.i386.deb

    2. Install the Canon Driver: MP600

    Here the procedure is sligthly different between linux distros supporting rpm packages (like Mandriva, Red Hat...) and Debian like (Ubuntu, ...) which need first to prepare debian .deb packages

    2.1 On a linux distro supporting rpm packages

    Use your packet manager, or double click the 2 files to install the driver, in this order:
    1. cnijfilter-common-3.00-1.i386.rpm
    2. cnijfilter-mp600-2.70-2.i386.rpm
    or, with the command line, under root, in the directory where files are:
    # urpmi cnijfilter-common-3.00-1.i386.rpm
    # urpmi cnijfilter-mp600-2.70-2.i386.rpm

    Restart cups:
    # /etc/init.d/cups restart

    2.2 On a linux distro using debian .deb pakages (here on Ubuntu)

    First, you must install the alien utility. From a terminal:
    $ sudo apt-get install alien

    Then install the common package and convert the .rpm packages into .deb package:
    $ sudo dpkg -i cnijfilter-common-3.00-1.i386.deb
    $ sudo alien -i --scripts cnijfilter-mp600-*.rpm

    Install also some additional packages (here for Ubuntu Feisty. On Gutsy, libpng3 becomes libpng12-0, and libtiff3 becomes libtiff4):
    $ sudo apt-get install libpng3 libtiff3

    Then create a necessary links:
    $ sudo ln -s /usr/lib/ /usr/lib/

    And restart cups:
    $ sudo /etc/init.d/cupsys restart

    3. Install the Canon Driver: MP610

    This is much simpler, as packages exist for rpm package managers (like Mandriva, Red Hat...) or .deb package managers (Debian like, Ubuntu, ...):

    3.1 On a linux distro supporting rpm packages

    Use your packet manager, or double click the 2 files to install the driver, in this order:
    1. cnijfilter-common-3.00-1.i386.rpm
    2. cnijfilter-mp610-2.80-2.i386.rpm
    or, with the command line, under root, in the directory where files are:
    # urpmi cnijfilter-common-3.00-1.i386.rpm
    # urpmi cnijfilter-mp610series-2.80-2.i386.rpm

    Restart cups:
    # /etc/init.d/cups restart

    3.2 On a linux distro using debian .deb pakages (here on Ubuntu)

    Use also your packet manager, or double click the 2 files to install the driver, in this order:
    1. cnijfilter-common-3.00-1.i386.deb
    2. cnijfilter-mp610series-2.80-2.i386.deb
    or, with the command line, in the directory where files are:
    $ sudo dpkg -i cnijfilter-common-3.00-1.i386.deb
    $ sudo dpkg -i cnijfilter-mp610series-2.80-1.i386.deb

    Restart cups:
    $ sudo /etc/init.d/cupsys restart

    4. Install your MP600 or MP610 printer

    Before starting printer installation, note that for 64 bits systems, a small tweak has to be added to have Canon's driver point to the correct lib location (32 bits). See Joerg's comment here on how to set it.

    The easiest way to install the printer is to use the cups interface from a web browser.
    • Open a web browser, and type url: https://localhost:631
    • Connect the printer and turn it on
    • Click the Add printer button

    - Select the name of your printer (e.g. MP610) and various information and click "Continue"

    - In the list, choose, depending if you have a MP600 or MP610 (only the one you have will show) and click "Continue":
    USB printer #1 with status readback for canon ij (Canon MP600 series)
    USB printer #1 with status readback for canon ij (Canon MP610 series)

    - Choose the make/model or the ppd file. The Canon driver shows up as:
    • Canon MP600 Ver.2.70 for the MP600 PPD
    • Canon MP610series Ver.2.80 for the MP610 PPD

    This is a basic ppd file, but will work for MP600 and MP610 printers. Choose this one, then click "Add printer"

    Or if you want to use another ppd file, enter its path in box, of click "browse" to select the ppd file.
    This will be the way to choose a new ppd file, like the ones proposed in my later post.

    - You'll be asked for the username password. Depending on the distribution you have, you can use your username and password account (Ubuntu) or you must use the root account (Mandriva)

    - Then, depending on the version of cups, you will see the default printer options screen (below), or directly the printers screen. You can always change the default printer options by clicking the "Set printer options" button.

    From here, you can also print a test page by clicking the corresponding button, and check whether your MP works.