USB devices including CUPS printing, scanners, and webcams

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 12:06, 2 July 2006 by (Talk)

Jump to: navigation, search

This article Based on work by Myno, andre, mindbender, downlalaway, Thorongil, frontalot, and TcT. Originally by downlalaway 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 things do change so check any notes. USB and hotplug is a little flakey on 2.4 kernels in recognising devices. A reboot while the device is in may make things work.


CUPS Printer

apt-get install cupsys cupsys-driver-gutenprint cupsys-pt cups-pdf
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 usb-utils

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 (for kernel 2.4.17). Reboot printer then insert.


(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 Allow localhost lines near the bottom and add

Allow From @LOCAL

below the 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.

NB. Cupsys 1.2 and 1.2.1 have changed a little and have an apparent bug (or zealous security feature):

The Allow From localhost line in the /etc/cups/cupsd.conf line locks out any other added Allow lines, e.g. local network connections. Replace it with Allow 192.168.1.x for the LS's LAN address and add Allow @LOCAL for your lan and any others you need. It seemed to work... Check access with typing http://linkstationip:631 into a browser.

Select printers, 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 gutenprint then you might need to check it in Cupsys-gutenprint 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.

To add the printer in Windows, goto Settings, Printers & Faxes, 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). 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 recommended & 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.

Note: the following script was unnnecessary when using udev on 2.6.16 experimetning on a debian Linksys NSLU2, and is expected to be the same with udev on a linkststation.

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 may have to delete the Devices line in the C:\Windows\sanetwain.ini file before connecting. I don't know a good solution yet, but it is caused by sanetwain recording the last good libusb connection number, but it changes the next time the scanner is turned on. You could also use XSane (for Win or Linux) and other Linux derivatives -Kooka etc.

USB Hard Drive

apt-get install hotplug autofs usb-utils usbview

autofs is for file system recognising and hotplug for usb detection is necessary. Usb-utils gives us the lsusb tool for detecting connections and usbview is a gui showing connected devices. 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).

Note: This is for brief usb disk mounting. For repetitive use go straight to the Automount section since this work very well especially with kernel 2.6. All usb devices can need reboots with 2.4.17, but this is due to the kernel only.

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.

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

Update June 2006: Please note the availability of modules and the /dev/ entries depends on quite a few factors -e.g. this was originally written based on the 2.4.17 #990 LS1 kernel which had the modules but no /dev/video entries. The 2.4.17 freelink 1.1.1 has /dev/video entries and kernel modules ov511.o, so may work straight off (but I haven't tried! It may still be flakey with 2.4.17..) As of June 2006, freelink 1.1.1 upgraded to (andre's v28?) has the /dev/video since its freelink 1.1.1 again but has no webcam modules -check by drilling down in /lib/modules/2.6.xx/kernel/drivers/ to see if videodev.ko, ov511.ko or ovcamchip.ko are present. We'll try to fix this so it runs straight off.

Webcam drivers The next problem to check is the type of webcam chip you have - there are a few and hopefully you'll have an ov511 but others may have pre-compiled modules sometime. Find out by plugging into the LS and with lsusb it should tell you in the list of devices. Creative webcams are often ov511, but others: logitech quickcams or Philips could need another driver. See for a full list.

Using udev in future, instead of hotplug, can also be possible -this may mean the /dev/video links are automagically assigned, but I have not attempted this on a Linkstation.

Original instructions (sometimes still be valid): 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. Other apps that might be tried are: 'xcam' -another alternative viewer, and 'motion' - a command line webcam app to be used as a security motion detector (intend to try this).

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

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