11 июл. 2010 г.

How to setup Canon LBP 3010 on Archlinux

UPD 2012: this is obsolete. Try AUR packages. Canon LBP-3010 driver v2.00 vs Archlinux + new CUPS (1.4.4)
disclaimer: kinda dirty hack.

-1) Install these packages:
  • cups
  • ghostscript
  • gsfonts
  • rpmextract.sh (if you will extract driver files from rpm packages)
  • system-config-printer
  • libstdc++5
0) Download driver ver. 2.00 (cndrvcups-common_2.00-1 and cndrvcups-capt_2.00-1) and extract rpm or deb packages.
I downloaded archive with .deb packages from here:
http://codebin.cotescu.com/canon/lbp_driver/CanonCAPTdriver.tar.gz
http://support-asia.canon-asia.com/contents/ASIA/EN/0900772407.html
1)In dir with extracted files do (because initscipts in Arch are in /etc/rc.d/):
mv etc/init.d etc/rc.d
2) Copy all dirs to root dir:
cp -r * / 
3) Replace /etc/rc.d/ccpd with:
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

DAEMON=/usr/sbin/ccpd
PID=`pidof -o %PPID ${DAEMON}`

export PATH=$PATH:/usr/local/sbin/:usr/local/bin

start ()
{
  stat_busy "Starting CCPD"

  [ -z "$PID" ] && ${DAEMON} 2>/dev/null

  if [ $? -gt 0 ]; then
    stat_fail
  else
    add_daemon ccpd
    stat_done
  fi
}

stop ()
{
  stat_busy "Stopping CCPD"
  [ ! -z "$PID" ] && kill $PID &> /dev/null
  if [ $? -gt 0 ]; then
    stat_fail
  else
    rm_daemon ccpd
    stat_done
  fi
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage $0 {start|stop|restart}"
esac

exit 0
4) Add execute permissions for this script:
chmod +x /etc/rc.d/ccpd
5) (!!! important !!!) Restart CUPS:
/etc/rc.d/cups restart
6) Add printer to CUPS:
lpadmin -p LBP3010 -m CNCUPSLBP3050CAPTK.ppd -v ccp://localhost:59687 -E
7) Register printer for ccpd daemon:
ccpdadmin -p LBP3010 -o /dev/usblp0
8) Start ccpd:
/etc/rc.d/ccpd start
9) You can add udev rule to automatically restart ccpd daemon when printer is plugged in:
echo 'SUBSYSTEM=="usb", KERNEL=="lp0", RUN+="/etc/rc.d/ccpd restart"' > /etc/udev/rules.d/85-LBP3010.rules