Понедельник, 06.05.2024, 00:27
Приветствую Вас, Гость
Главная » Статьи » Ubuntu

Canon_LBP_2900

Introduction

This works in Ubuntu and Kubuntu 6.06 (Dapper), 6.10 (Edgy), 7.04 (Feisty) and 7.10 (Gutsy). Based on the driver files provided I assume that this will work for Canon LBP 1120, 1210, 3000, 3200, 3210, 3300, 3600, 5000 printers as well as the Canon LBP 2900 and 2900i. Confirmed to work on 2900, 2900i and 1210 printers.

It also works in amd64 or x64! See amd64 steps for details...

Additionally, it works on the development version of Hardy as of 10th of Feb. Reboot not necessary on Gutsy or Hardy.

It works for USB connected printers. However, it does not work for printers connected via the parallel port. The LBP1210 printer can be connected via USB or parallel; for this printer connect it via USB and it will work.

This was primarily taken from http://doc.ubuntu-fr.org/materiel/imprimante_canon_lbp_2900 and embellished from my own experiences and the sources listed below. Thanks to Kaleo for the heads up and the help.

This article is derived from:

Step 1:

Go to the following web page and download the Driver.tar.gz:

http://software.canon-europe.com/products/0010177.asp

Step 2:

Extract Driver.tar.gz either by right-clicking on the file and selecting "Extract Here", or in the Terminal in the directory you downloaded it into and entering the following command:

$ tar -xvf Driver.tar.gz

This should create a new directory called Driver which contains two files: cndrvcups-capt-1.30-1.i386.rpm and cndrvcups-common-1.30-1.i386.rpm.

These rpms need to be converted into debs so that we can install them, and to do that we need to install alien. You can do that with Synaptic (System > Administration > Synaptic) or in the Terminal:

$ sudo aptitude install alien

Then, you convert the files using alien in the Terminal:

$ sudo alien -c cndrvcups-capt-1.30-1.i386.rpm
$ sudo alien -c cndrvcups-common-1.30-1.i386.rpm

Install the debs you have just created by double clicking on the files or using the Terminal:

$ sudo dpkg -i cndrvcups-common_1.30-2_i386.deb cndrvcups-capt_1.30-2_i386.deb

Note that the latest version of the drivers contain .deb packages, which you can use instead of the above procedure to convert RPMs.

Step 3:

In order to load the new drivers we have installed we need to stop and restart CUPS. Firstly we stop CUPS:

$ sudo /etc/init.d/cupsys stop

Check that it is stopped. All the times I have done this, CUPS had stopped first time but apparently this may not always be the case due to the installation of ccp:

$ sudo ps ax | grep cupsd

Which will give you something like this:

cupsys 24897 0.0 0.1 4336 1976 ? SNs 07:35 0:04 /usr/sbin/cupsd
username 24738 0.0 0.0 2896 836 pts/0 S+ 21:21 0:00 grep cupsd

If you only get a line that ends with "grep cupsd" CUPS has stopped and you can carry on. If you also get a line that ends with "/usr/sbin/cupsd", as shown above, CUPS has not stopped and you will have to try the following method to stop it:

$ sudo killall cupsd

The aliened debs are not perfect so we have to do some of their the work for them. Create two directories:

$ sudo mkdir /var/ccpd
$ sudo mkdir /var/captmon

And a fifo:

$ sudo mkfifo /var/ccpd/fifo0

Make fifo0 accessable to everyone:

$ sudo chmod 777 /var/ccpd/fifo0

In Ubuntu Edgy and Feisty, change the owner of fifo0 into root (failing to do so gives you an error: Unable to copy PPD file in step 4):

$ sudo chown root /var/ccpd/fifo0

You may need to make the permissions of the /usr/share/cups/model directory more permissive.

$ sudo chmod -R a+rX /usr/share/cups/model

Once you have done this, start CUPS again:

$ sudo /etc/init.d/cupsys start

Step 4:

Register the printer driver with the print spooler with the following command, replacing [printer model] with your printer model and [printer driver file] with your driver file:

$ sudo /usr/sbin/lpadmin -p [printer model] -m [printer driver file] -v ccp:/var/ccpd/fifo0 -E

For example, the command for the Canon LBP 2900 would be:

$ sudo /usr/sbin/lpadmin -p LBP2900 -m CNCUPSLBP2900CAPTK.ppd -v ccp:/var/ccpd/fifo0 -E

Note: If you get the error lpadmin: Unable to copy PPD file!, try substituting -P for -m above.

If you are unsure of what your driver file is called you can get a list of the available drivers:

$ ls /usr/share/cups/model/ | grep CNCUPS

Look for the one that matches your model number. Some of them end with "K.ppd" and some end with "J.ppd". I have no idea what difference is, the K ones have worked fine for me so far.

Added 2007-12-09: for me, under Ubuntu 7.10, the K ones constantly use about 75% CPU, while the J ones don't. I did not find any problems with the J file so far.

Ubuntu Edgy and Feisty are searching the driver in /usr/share/ppd/ so I created a link:

$ cd /usr/share/ppd/
$ sudo ln -s /usr/share/cups/model/CNCUPSLBP2900CAPTK.ppd

Once registered your printer should appear in the System > Administration > Printing dialog.

Register the printer with ccpd daemon, once again replace [printer model] with your printer model:

$ sudo /usr/sbin/ccpdadmin -p [printer model] -o /dev/usblp0

For example, the command for the Canon LBP 2900 would be:

$ sudo /usr/sbin/ccpdadmin -p LBP2900 -o /dev/usblp0

Step 5:

Replace /etc/init.d/ccpd with the script below (taken from http://rdoursenaud.free.fr/debian/capt.html):

#
# ccpd startup script for Canon Printer Daemon for CUPS
#
# Modified for Debian GNU/Linux
# by Raphael Doursenaud <rdoursenaud@free.fr>.

DAEMON=/usr/sbin/ccpd
LOCKFILE=/var/lock/subsys/ccpd
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=ccpd
DESC="Canon Printer Daemon for CUPS"

test -f $DAEMON || exit 0

case $1 in
start)
echo -n "Starting $DESC: $NAME"
start-stop-daemon --start --quiet --exec $DAEMON
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
echo "."
;;
status)
echo "$DESC: $NAME:" `pidof $NAME`
;;
restart)
echo -n "Restarting $DESC: $NAME"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --exec $DAEMON
echo "."
;;
*)
echo "Usage: ccpd {start|stop|status}"
exit 1
;;
esac

exit 0

Copy and paste the above script into a new text file, then backup and replace the old version:

$ sudo mv /etc/init.d/ccpd ccpdold
$ sudo cp [text file you created] /etc/init.d/ccpd

Give everyone execution rights to the new file:

$ sudo chmod a+x /etc/init.d/ccpd

Step 6:

Start the ccpd daemon:

$ sudo /etc/init.d/ccpd start

Step 7:

Set ccpd to start when you startup your computer:

$ sudo update-rc.d ccpd defaults 20

Step 8:

Switch off the printer and reboot your computer. Once you have logged in, switch on the printer again.

Step 9:

Test your installation.

First test:

$ sudo ccpdadmin

Which should output this:

Usage:
ccpdadmin [-p Printer-name -o Printer-dev-path]
ccpdadmin [-x Remove-Printer-name]


CUPS_ConfigPath = /etc/cups/
LOG Path = None
UI Port = 39787

Entry Num : Spooler : Backend : FIFO path : Device Path : Status
----------------------------------------------------------------------------
[0] : LBP2900 : ccp : /var/ccpd/fifo0 : /dev/usblp0 :

Second test, replace [printer model] with your printer model

$ captstatusui -P [printer model]

For example, the command for the Canon LBP 2900 would be:

$ captstatusui -P LBP2900

This will launch a window that after a bit should say "ready to print".

Finally open a file and try to print it.

P.S. If you are using Gutsy 7.10, then the following steps should be done too:

These steps are required only on 7.10. They are not required for 7.04 or 8.04.

$ sudo gedit /etc/apparmor.d/usr.sbin.cupsd

added the following lines (marked with ###insert):

/var/run/avahi-daemon/socket rw,
/var/run/cups/ rw,
/var/run/cups/** rw,
/var/spool/cups/ rw,
/var/spool/cups/** rw,
# needed for Canon CAPT driver ###insert
/var/ccpd/** rw, ###insert

# third-party printer drivers; no known structure here
/opt/** rix,

2.

$ sudo /etc/init.d/apparmor restart

Then the printer should work properly.

amd64 Steps:

First thank you for this wonderful info! Following it I managed to install LBP-1210 on Ubuntu 6.10 Edgy amd64! I taught it would be impossible, but it WORKS!

Before you start this procedure:

  1. I had to install following ia32 libraries in my Edgy amd64 distribution, I did this using Synaptic, installed; ia32-libs, ia32-libs-gtk, ia32-kde (don't know if this one is really needed), ia32-libs-openoffice.org. I also installed some other 32-bit packages, just in case, and for the need of some other 32-bit software such as Skype; lib32asaund2, lib32gcc1, lib32stdc++6 and lib32z1

  2. Feisty amd64 distribution does not have ia32-libs-openoffice.org in its repositories! One option is to download Edgy's ia32-libs-openoffice.org package from here, and to install it manually. Another option is to extract some libraries manually from Feisty x86 packages and to place them in /usr/lib32/. These packages are; libtasn1-3, libgcrypt11 and libgpg-error0, with respective libraries.

  3. Also, during regular installation steps, Canon's driver required libcups.so.2 and libgnutls.so.13 32-bit libraries which I had to provide manually because they were not included in any of standard amd64 ia32* or lib32* packages (funny that libgnutls.so.12 is included in ia32-libs-openoffice.org Edgy amd64 package). I copied these libcups.so.2 and libgnutls.so.13 from 32-bit Ubuntu Dapper Distribution to /usr/lib32. You can also copy this library from chroot 32-bit distribution if you have one.

  4. Also you can download and extract manually this file from standard 32-bit packages, it is libcupsys2 and libgnutls packages. It can be found here and here.

  5. You can see how to setup chroot environment here.

After you start install procedure:

  1. In Step 2, when you should convert these 32-bit Cannon drivers packages using alien, it will probably not work using 64-bit alien. I had to use 32-bit Dapper chroot distribution I had set up previously. From chroot, alien converting worked fine, using same commands. For your convenience, some debs are attached below.

  2. Again, in Step 2 one should use --force-architecture install option when trying to install these 32-bit driver packages on 64-bit machine. Do this at your own risk. It installed for me without problem, with few warnings only.

Testing your printer

  1. In Step 9, following test might not work (replace [printer model] with your printer model):

$ captstatusui -P [printer model]
  • This should launch a window that should say "ready to print" or something, but in my system it required more 32-libraries... If you really need this useless status window, extract libgtk-1.2, libgdk-1.2, libglib-1.2 and libgmodule-1.2 libraries from libgtk1.2 and libglib1.2 Feisty or Edgy packages and place them into /usr/lib32/. Try right-clicking you printer in System > Administration > Printing dialog, and opening Properties. Print test page should work without problems.

  • Note: I tested this only on my Canon LBP-1210 printer connected to USB. My computer doesn't have Parallel port so I could not test it. Other printers mentioned at top of this page should work as well.
  • This did not work for me on an IA32 (Duron 750MHz) machine attached via parallel port. I replaced usblp0 with lp0, but instead of saying "ready to print" it had nothing in the message box.

Automatically Reporting and Correcting Errors

Although the above instructions should work, I find the resulting print System rather fragile. To fix this we can do the following

First, ensure that we have zenity installed

$ sudo apt-get install zenity

We need to give everyone in lpadmin the right to automatically clean up old print processes and restart the print system. To do this, start visudo

$ sudo visudo

and add the following four lines to the end of the file:

%lpadmin ALL=NOPASSWD: /etc/init.d/ccpd restart
%lpadmin ALL=NOPASSWD: /etc/init.d/cupsys restart
%lpadmin ALL=NOPASSWD: /usr/bin/killall captfilter ccpd
%lpadmin ALL=NOPASSWD: /usr/bin/killall -9 captfilter ccpd

Then, save the following code to ~/bin/launch_captstatusui

# 
# launch_captstatusui starts up captstatusui, restarting cups and ccpd when needed

model=LBP1210
errfile=/tmp/captstatusui.err
#wmctrl -l | if grep `hostname`" $model$"

killall captstatusui
sleep 0.2
killall -9 captstatusui

(captstatusui -P $model 2> $errfile ||
(
echo "NOTE: 'Check the DevicePath of /etc/ccpd.conf' often means 'out of paper'

(Will try again once you close this dialog)" >> $errfile
zenity --text-info --title='Canon Printer Error.' --filename=$errfile
sudo /etc/init.d/ccpd restart
sudo /etc/init.d/cupsys restart
captstatusui -P $model
)
)&

Edit the file so the model=... matches your printer.

Now make this file executable.

$ chmod +x ~/bin/launch_captstatusui

Check that this file can be run:

$ launch_captstatusui

Now add the following file to ~/bin/launcher_captstatusui

# A script to check whether the user is trying to print, and if so help them around any errors.
#
# This script is intended only for use with the Canon CAPT printing system
# John C, McCabe-Dansted (2008) gmatht at gmail dot com,

dir=~/.tmp
mkdir -p $dir
lpq=$dir/lpq
new=$lpq.new
age=0

restart() { # Restart the Canon Capt Printer Driver and Cups.
(sudo /usr/bin/killall -9 captfilter ccpd
sleep 1
sudo /usr/bin/killall -9 captfilter ccpd
sudo /etc/init.d/ccpd restart
sudo /etc/init.d/cupsys restart
) 2>&1 | tee > $dir/tmp
zenity --text-info --title "Print system restarted" --filename=$dir/tmp
}

active_jobs() { #Count the active print jobs listed in $1
grep "^active" < $1 | wc -l
}

lpq > $lpq
while true
do
lpq > $new
if diff $lpq $new
then # no changes
rm $new
age=$(($age+1))
test "$age" = 3 &&
grep "^active" < $lpq &&
zenity --question --title "Restart Print Server" --text "It seems to be taking a long time to print. \n Restart Print Server?" && restart
else # new job added or removed
echo if test `active_jobs $lpq` -le`active_jobs $new`
if [ `active_jobs $lpq` -le `active_jobs $new` ]
then # A new job has been added or replaced
(launch_captstatusui & wmctrl -R KJobViewer & kjobviewer --all)
rm $lpq
mv $new $lpq
age=0
fi
fi

ps -C "captfilter ccpd" -o time | grep 1.:.. && (
#Server has taken over 10 minutes of CPU time
zenity --question --title "Restart Print Server" --text 'The print server seems to have crashed \n Restart the print server? \n (Click OK if unsure)' && restart
)

sleep 9
done

Now test launcher_captstatusui

$ launcher_captstatusui

This won't output anything interesting, but if you try forcing a printer error (e.g. by disconnecting the USB cable), and printing, you should notice a helpful dialog pop up after several seconds.

Finally, set launcher_captstatusui to be automatically started. on KDE, this can be done by:

$ ln ~/bin/launcher_captstatusui ~/.kde/Autostart 

For other desktops, see http://gentoo-wiki.com/HOWTO_Autostart_Programs

Источник: https://help.ubuntu.com/community/HardwareSupportComponentsPrinters/CanonPrinters/Canon_LBP_2900
Категория: Ubuntu | Добавил: xpavlus (28.07.2008)
Просмотров: 3033 | Рейтинг: 0.0/0
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Бесплатный конструктор сайтов - uCoz
grand theft auto: vice city неоспоримый 4