USB devices including CUPS printing, scanners, and webcams

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 17:56, 30 June 2006 by Ramuk (Talk | contribs)

Jump to: navigation, search

This article Based on work by Myno, andre, mindbender, downlalaway, Thorongil, frontalot, and TcT. Originally by frontalot. at
This is a basic run through of USB devices connecting for Debian on an PPC LinkStation. The USB hard drive is USB 2.0 at 3Mb/s (on a laptop HD). NB. It is based on using the original 'hardware' conversion of the LS 1 and not the Freelink project -the concepts should be the same but some jobs may already have been done for you! hotplug is a little flakey on 2.4 kernels in recognising devices sometimes in my (downlalaway) experience. A reboot while the device is in generally makes things work.

CUPS Printer

apt-get install cupsys cupsys-bsd cupsys-client cupsys-driver-gimpprint cupsys-driver-gimpprint-data cupsys-pt cups-pdf

I'm unsure if we need cupsys-bsd

apt-get install gs-common gs-esp gs-gpl gsfonts xpdf # for pdf and possibly to help gimp-print drivers
apt-get install hotplug usbview

for easier usb device info -if you haven't done it already for a usb hard drive (see usb hard drive part)

cd /dev; ./MAKEDEV -v usb (probably unnecessary)            
mknod /dev/usblp0 c 180 0 (think this makes the show work)  
mknod /dev/usblp1 c 180 0 (added this for luck)             

Probably reboot LS. Reboot printer then insert (I chose back usb port)


(do an apt-get install usbutils if it cannot be found)

It should show the printer connected somewhere


This should show it again (in a gui via vnc) and show the Name:usblp and interface number (mine is 1 possibly due to it being also a scanner). Go through the cups web interface http://localhost:631 if you have mozilla running on-board. Alternatively edit cupsd.conf and scroll down to the bottom and add

Allow From @LOCAL

below the two lines:

Allow From

This will allow locally networked computers to access and admin the printer config. Turn off the @LOCAL or modify for your IP only if you don't trust everyone to be able to admin it. Select printesrs, add printer, enter the Name, location descripton etc (there are notes about no spaces in names - maybe an old version of cups tho). Select usb #1 interface and then your printer from the next lists. If your printer isn't in gimpprint then you might need to download it from linuxprinting or get cupsomatic-ppd. Cupsomatic gives you every printer possible, a bit unnecessary usually. Hopefully returning to the printer page it should show it on


USB 1 interface number printer gives usblp0, USB 2 interface gives usblp1 etc. Both worked for me!?

Print a test page from the web interface and be very joyful if it works first time. To troubleshoot: Reboot the linkstation, unplug the printer, reboot the printer while plugged in... trying test pages. Often it springs into life when not expecting and then works for evermore. Do usbview through a vnc link to see if it connected properly at each stage.

Now there's two ways of setting up to be able to print from your other networked computers -IPP printing and samba printing. IPP is preferred since samba currently shows delays in printing.

Cups-IPP Printing

You can share you printer to your network without using Samba. Thus, you can easily share your printer without bothering about Samba configs.

Working with RAW printers (you use the driver on your client, simply add the printer with driver "RAW" in CUPS web interface) is in my case sped up by the factor 100, as Windows and Samba and Cups do not need to argue about the driver to be used and access rights.

For sharing to your net 192.168.0.x, you simply add "allow from 192.168.0.*" to the line configuring access to CUPS in cupsd.conf. Or one can use @LOCAL -see above.

Now e.g. in Windows, add a printer, say "Network printer", now select "Connect to Printer on Internet or your Intranet via HTTP" and put in:


Now you are prompted for a driver, if CUPS does not provide one. In the case of a RAW printer, you must always select a driver and use it.

Thats it, you are done, wasn't that easier than fumbling around with smbd.conf?

Cups-PDF Printing

Cups-pdf is installed to do a pdf printer, but I think the gs files are needed to allow it to work. xpdf is used to view the pdfs (through a vnc connection). I use xfe file viewer and so I associated xpdf to open pdfs. The default is acroread which I haven't installed. To activate a cups-pdf printer: go to Cups web interface then add printer, insert name etc (no spaces), find Virtual Printer(PDF printer) at bottom, select postscript (I did at least), 'Generic postscript color..' on next page and go back to the start.

One can adjust resolution if needed. Print a test page. It should end up in /root/cups-pdf since logged in as root in the web interface. Otherwise it will print in the /home/username/cups-pdf/. There's error messages available in the web interface too. There appears to be no direct way to change the output directories, but it can be shared by creating a symlink to the /home/username/cups-pdf directory within an area already shared in samba. If samba share permissions allow access to the cups-pdf folder the pdf files will appear in this new directory when you print them. e.g. If you have guest access on the samba share check read permissions for others apply to the cups-pdf folder and pdfs. Also make sure wide links=no is not in smb.conf for that share. A command to create the symlink will go as:

ln -s /home/username/cups-pdf /mnt/sambashare/pdfoutput

Replacing username with your standard samba share user and sambashare with the directory name (or path) that you want the new pdfoutput directory to appear. This needs clarifying a little but should work with a little investigation.

Samba for Printers (although IPP is faster):

All the following Samba configurations can be done more easily through Webmin (see Articles/DebianWebmin) instead of manually editing the conf file. Samba settings for M$ printing. My config in /etc/samba/smb.conf (relevant section):

load printers = yes
printing = cups
printcap name = cups
show add printer wizard = No
guest account = nobody
comment = All Printers
path = /tmp
browseable = yes
printable = yes
create mask = 0777
use client driver = yes
print command = lpr -P %p -o raw %s -r
guest ok = yes
guest account = nobody
comment = Printer Drivers
path = /etc/samba/drivers
browseable = yes
read only = yes
guest ok = no
write list = root

It works ok for me! Others may wish to change guest access for internal network security.

Do a /etc/init.d/samba restart then switch to your M$ box. Find each printer on your linkstation in network neighbourhood and double click etc and select the correct driver for the physical printer and the Apple Color LW 12/660 PS printer for the PDFprinter. For the PDF printer check that colour is selected in the default printing properties on the M$ box -can default to B&W. All this took a few evenings to finally sort out (thanks for help to wartstew). The breakthrough was getting cups with gimp-print drivers to run (it broke first time) and getting the usb port right.

Scanner Setup

For scanner I originally used xsane -this can test if your scanner actually works. Confident people might go straight to sane.

apt-get install xsane  

It worked and found the scanner first time through a vnc link as root -before I did ./MAKEDEV or mknod etc. If xsane works this is a good start.

There is a good way of networking your scanner -this is pretty impossible in windows except with a corporate commercial program I saw. You need to install sane on the LS as per:

apt-get install sane sane-utils 

I used versions 1.0.15-10, a newer version is now current. sane-utils sets up a 'saned' user and group which are the safe ways to access instead of root as xsane used. Best to check this is in /etc/group.

The main difficulty is giving your scanner access to non-root. There's a number of tricks depending on hardware (mine an Epson CX3200 printer/scanner). This is how I (downlalaway) did it: As root do scanimage -L this should find a scanner - if not reboot and reboot/replug scanner. Hopefully a found scanner is id'd and uses libusb. Try as a non-root user - it probably won't find it yet.

So to get non-root access to the scanner I had to add a small script to automatically give the scanner group as 'scanner' -details from: And the relevant section: Save the script as /etc/hotplug/usb/epson_scanner and make it executable.


if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
        chown root "${DEVICE}"
        chgrp scanner "${DEVICE}"
        chmod 660 "${DEVICE}"

Check in /etc/group there's a group 'scanner' and add any usernames you want access and the saned user.


Reboot the scanner and LS to update group list. Now we need to log in as saned and check saned access. As root type:

linkstation#su -s /bin/sh - saned 
saned@linkstation$scanimage -L    

This should find your scanner again if its all worked -try some rebooting/repluggin first if not and check root still finds it. So it works for non-root locally now to get networked follow the advice at:

The steps are: ->1. Setup up inetd (or xinetd) with /etc/inetd.conf to start saned on a request ->2. Check /etc/services (should be default ok) ->3. Set inetd to start at boot (Webmin..system..bootup and shutdown.. tick the inetd entry and press button to start on boot)

To access from a Windows box use sanetwain (its great!): 

It will allow Twain integration easily into any windows programs including work etc as though it were directly connected (NB check your firewalls to allow access). You could also use XSane (for Win or Linux) and other Linux derivatives -Kooka etc. Watch for possible timeout problems when warming up...

USB Hard Drive

apt-get install hotplug usbview autofs

autofs is for file system recognising and hotplug for usb detection is necessary but usbview helps with showing connected devices (usbview and lsusb commands). Create a mount directory in preparation: I did /mnt/UsbDrive but one can make one in /home/username/. A symlink to the directory you chose as mount point from a directory that you already share through samba should allow it to share (unless you've modified samba to prevent this).

mkdir /mnt/UsbDrive

Might be worth a chmod permissions modification if you want to share it with samba or use for backups (haven't used it too much yet).

mount -t vfat /dev/sda /mnt/UsbDrive

Of course, replace vfat for whatever your partition type is. By adding autofs entries into /etc/fstab (be v.careful since the LS may not boot) this line can be simplified to:

mount /mnt/UsbDrive

USB Removable Media: Automount

Note to kernel 2.4.17_mvl21-sandpoint #997 users (ships with Freelink 1.1.1): You need to move a few modules out of the way before you can continue:

mv /lib/modules/2.4.17_mvl21-sandpoint/kernel/drivers/scsi/scsi_mod.o /root/            
mv /lib/modules/2.4.17_mvl21-sandpoint/kernel/drivers/scsi/sd_mod.o /root/              
mv /lib/modules/2.4.17_mvl21-sandpoint/kernel/drivers/usb/storage/usb-storage.o /root/  

Reboot when done.

Note to Linkstation HG users: You may also need to do this; adjust the paths to your needs.

I found this to be the easiest way to automount removable USB devices:

apt-get install autofs gawk wget bzip2 make
tar -xjf 
cd mounttero-0.5 
/etc/init.d/autofs restart 
apt-get remove gawk # this step is optional 

The devices will be mounted automagically in /mnt/auto/, for example, /mnt/auto/usb/ in case of a typical USB thumb drive, and unmounted automagically after four seconds when unplugged.

Edit /etc/auto.tero and comment out all /dev/hda? entries:

#hda1 -fstype=auto,nosuid,nodev,user  :/dev/hda1 
#hda2 -fstype=auto,nosuid,nodev,user  :/dev/hda2 
#hda3 -fstype=auto,nosuid,nodev,user  :/dev/hda3 
#hda4 -fstype=auto,nosuid,nodev,user  :/dev/hda4 

USB Webcam

The webcam has been occasionally flakey at times to be discovered if not pulled out/plugged in at the 'right time'. Not clear what the 'right' time is yet. Originally, there aren't any USB entries for dev/video so I did a:

cd /dev; ./MAKEDEV -v video

This made some. Loading a gui to see something:

apt-get install gqcam

Now when the webcam didn't discover correctly and when typing command gqcam from a terminal it will complain about no /dev/video present or similar. A reboot with camera plugged in usually solves it but there probably is a correct solution. I also get reversed RG colour with gqcam and changing it back (there's conf file) it messes up the brightness. Do an update-menus if the various xsane, gqcam or others don't appear in the menus.

Enjoy and please carefully comment if it doesn't work or changes needed.

Originally by frontalot and edited by Myno, andre, mindbender, downlalaway, Thorongil and TcT from