You are not logged in.

#1 2011-08-20 01:10:31

triplc
Member
From: Hanoi, Vietnam
Registered: 2009-08-23
Posts: 39

Canon LBP3300 usb port keeps on changing

Following the guide https://wiki.archlinux.org/index.php/Canon_LBP2900 , I have LBP3300 worked fine.

However I get 2 problems

1. After a some kernel upgrades (which is relatively often in Arch Linux) the port keeps on changing (/dev/usb/lp0, /dev/usb/lp1) which make udev rules did not work properly.

2. "/etc/rc.d/ccpd restart" does not work properly

So I write this scripts /home/share/bin/cannon-lbp3300-starter

#!/bin/bash
## -------------------------------------------------------------
## restart the cannon lbp3300 properly
##

if [ $UID != 0 ]; then
	echo "This command should be run as root!"
	echo "Example, in /etc/udev/rules.d/85-canon-capt.rules:"
	echo 'KERNEL=="lp*", SUBSYSTEMS=="usb", ACTION=="add", SYSFS{idVendor}=="04a9", RUN+="/bin/bash /home/share/bin/cannon-lbp3300-starter"'
	echo 'KERNEL=="lp*", SUBSYSTEMS=="usb", ACTION=="remove", RUN+="/bin/bash /etc/rc.d/ccpd stop"'
	exit 1
fi

## -------------------------------------------------------------

## find the USB device
USBPORT=$(echo /dev/usb/lp* | head -n 1)

## exit if port not found
if [ x$USBPORT == x ]; then
	echo "USB port not found!"
	exit 1
fi

## -------------------------------------------------------------
## everything looks fine

## name of the printer device (should be correctly setup in cups)
PRTNAME=LBP3300

## set the PATH
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin

## stop the cups
/etc/rc.d/cups stop

## stop the ccpd completely
/etc/rc.d/ccpd stop
killall ccpd
killall -9 ccpd

## start the cups backend again
/etc/rc.d/cups start

## clear printer queue
lprm -PLBP3300 -

## remake the cannon printer
ccpdadmin -x $PRTNAME
rm /var/ccpd/fifo0
mkfifo /var/ccpd/fifo0
chown lp:lp /var/ccpd/fifo0
ccpdadmin -p $PRTNAME -o $USBPORT

## start the ccp backend again
/etc/rc.d/ccpd start

## done. hopely things are really OK now

Offline

Board footer

Powered by FluxBB