Linux Peripherals

Author: Michael Minn (see www.michaelminn.com for current contact info)

15 January 2012


Guidelines for installing and using peripherals under Linux


1. Introduction

The following document provides information for the installing and using a number of old peripherals on Linux machines. Contemporary hardware marketing lifecycles are extremely short so most of this devices listed here are no longer available new. However, older hardware can be found on e-bay and in millions of closets around the world. And subsequent hardware releases often represent only incremental change from previous offerings, giving value to older installation instructions.

Hardware compatibility is perhaps the most difficult part of using Linux. Hardware vendors are almost completely oriented toward the PC/Mac world and Linux drivers frequently have to be created by volunteers using reverse engineering. Hardware vendors often chose proprietary protocols over standard protocols and occasionally supply firmware with drivers, making it difficult or impossible to support the hardware without manufacturer cooperation. The situation has gotten much better in the past few years due both to broader acceptance of Linux and increased commodification of hardware, although it is still a significant problem.

Therefore, it is vital that you research Linux compatibility as much as possible prior to purchasing a piece of equipment.

The situation is additionally complicated by the fact that vendors often use the same product name for hardware that appears the same externally but uses different internal chipsets and software drivers. Sometimes the distinction can be made with product numbers or version numbers on the box, but this is not always the case. Vendors often simply rebrand products from a handful of suppliers and electrically identical products may be offered by different vendors under different product names and numbers. It is a complex, incestuous situation and you should make sure you know EXACTLY what product number and version you are buying.

Caveat Emptor.


2. Diagnostic Utilities

One of the virtues (and drawbacks) of using an operating system oriented towards geeks is that you are less hidden from the technical details of your computer than you are under Windoze or the Mac GUI. Although there is a wide variety of management software (of varying quality) that comes with the desktop GUIs, the most effective utilities are often command line programs.

/sbin/lspci -vn: Lists information about devices connected to the internal PCI busses. This is especially useful for looking up the PCI vendor and device codes for PCMCIA cards. These codes can be used to search the Internet for device information. For example, this is the lspci -vn listing for my Belkin wireless card:


	02:00.0 Class 0200: 1799:6020 (rev 20)
        Subsystem: 1799:6020
        Flags: medium devsel, IRQ 11
        I/O ports at 4000 [disabled]
        Memory at 10800000 (32-bit, non-prefetchable) [disabled] [size=512]
        Capabilities: [50] Power Management version 2

cat /proc/bus/usb/devices: Lists information about connected USB devices, including the names of any drivers (i.e. kernel modules) that have been loaded to support the device. This can be used to determine if a USB device is supported. The output is a bit cryptic, although when looking for a driver, the key line is "Driver=". For example, this is a part of the listing for my Edirol UA-5 sound module, supported by the mmusbaudio kernel module:

	T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
	D:  Ver= 1.10 Cls=ff(vend.) Sub=00 Prot=ff MxPS= 8 #Cfgs=  1
	P:  Vendor=0582 ProdID=0010 Rev= 1.00
	S:  Manufacturer=Roland
	S:  Product=EDIROL UA-5
	C:* #Ifs= 4 Cfg#= 1 Atr=c0 MxPwr=  0mA
	I:  If#= 0 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=00 Driver=mmusbaudio
	I:  If#= 1 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=00 Driver=mmusbaudio
	I:  If#= 1 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=00 Driver=mmusbaudio
	E:  Ad=01(O) Atr=09(Isoc) MxPS= 288 Ivl=1ms
	I:  If#= 2 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=00 Driver=mmusbaudio
	I:  If#= 2 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=00 Driver=mmusbaudio
	E:  Ad=82(I) Atr=05(Isoc) MxPS= 288 Ivl=1ms
	I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=00 Driver=mmusbaudio
	E:  Ad=03(O) Atr=02(Bulk) MxPS=   8 Ivl=0ms
	E:  Ad=84(I) Atr=02(Bulk) MxPS=   8 Ivl=0ms

If the device is not supported, the Driver will be indicated as (none):

	I:  If#= 0 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=00 Driver=(none)
	I:  If#= 1 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=00 Driver=(none)
	I:  If#= 1 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=00 Driver=(none)

/sbin/lsusb -v: Lists USB device information in a slightly more human readable form, although, for some strange reason, driver information isn't included. Also, if you're not familiar with USB interfaces and endpoints, the listing is as incomprehensible as /proc/bus/usb/devices.

cdrecord -scanbus: Lists SCSI and emulated SCSI drives. This is useful for verifying that an external USB storage device is supported.

tail /var/log/messages: The log of system messages. Usually, when a USB or PCMCIA peripheral is plugged in, a message (good or bad) is listed to this file. Often the messages indicate the name of a device file associated with the device that can be used for further configuration. Note that you must be superuser to view this file.

dmesg: Also lists system log messages.


3. Epson Scanners

Of all peripherals, scanners are perhaps the most problematic with Linux. Scanner hardware is constantly changing and in the absence of a set of common interface standards, each new scanner model requires new driver software. Scaner interfaces usually involve proprietary protocols that leave Linux driver developers consistently behind the curve.

Epson has been unusually (though not universally) supportive of Linux driver development and I join others on the web in recommending their products. However, before purchasing a scanner, I highly recommend you visit the SANE Website and verify that your scanner is supported. Common branding does not imply that the underlying hardware comes from the same engineers or factories.

SANE (Scanner Access Now Easy) provides basic scanner handling capabilities in two parts: backends and frontends. Separate "backends" are used to handle the wide variety of hardware protocols used by different scanners. These backends then provide a standardized interface for numerous graphical and command line frontends interfaces. I assume the name SANE is a take-off on TWAIN, the standard Windows scanner interface.

3.1 General Scanner Permissions

SANE uses libusb for communicating directly accessing scanner through the /dev/bus/usb devices. SANE on contemporary Linux distributions should be able to detect most supported scanners when they are plugged in without additional hotplugging configuration.

However, device permissions are an issue and unless they are configured appropriately, the scanner will be visible from scanimage -L (because you do not have permission to access the /dev/bus/usb devices).

	scanimage -L

	scanimage: no SANE devices found

One solution is to do your scanning as superuser, although that is not recommended as a security issue.

The more appropriate course of action is to add a UDEV rule for this device that assigns appropriate permissions. For example, for the Epson scanners listed in this document, I created a file called /lib/udev/rules.d/71-scanner.rules with the following contents:

# Epson 3490
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",SYSFS{idVendor}=="04b8" , SYSFS{idProduct}=="0122", MODE="0666"

# Epson 2400
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",SYSFS{idVendor}=="04b8" , SYSFS{idProduct}=="011b", MODE="0666"

# Epson 1240U
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",SYSFS{idVendor}=="04a5" , SYSFS{idProduct}=="20c0", MODE="0666"

Then run udevadmin to load the rules file:

	sudo udevadm trigger

You can scan either from the command line with scanimage (use scanimage --help for command line options) or rom GIMP. In GIMP's File->Acquire dropdown, you should see an entry or epson:'dev'usb'scanner0 that will magically appear when the scanner is plugged in.

There are some GNU OCR programs out there, although the last time I tried them they weren't even close in quality to the proprietary ones available on Windoze.

3.2 Epson Perfection 3490

I purchased Epson Perfection 3490 USB Scanner in Fall 2005 and it is supported by contemporary releases of SANE's snapscan backend. There are a few pesky but essential configuration changes you will need to make before using the scanner.

Firmware File: The scanner requires firmware that is loaded into scanner RAM each time it is rebooted. The firmware file is provided in a Micro$oft "Cabinet File" ModUsd.cab in the ESCAN directory of the software CD provided with the scanner. It can be extracted using the cabextract utility (cabextract ModUsd.cab). You can also go through the installation process under Windoze and copy the file to a Linux partition. The firmware file can be found in c:/WINDOWS/system32/Esfw52.bin. I copied it to the /usr/share/sane directory.

/etc/sane.d/snapscan.conf: At the top of the snapscan.conf file, there is an entry for the path to the firmware file which you should change to the file described above. Note that this is NOT the /etc/sane.d/snapscan.conf file, which may exist from an earlier/different SANE configuration.

	#------------------------------ General -----------------------------------

	# Change to the fully qualified filename of your firmware file, if
	# firmware upload is needed by the scanner
	# firmware /path/to/your/firmware/file.bin
	firmware /usr/share/sane/Esfw52.bin

At the bottom of the snapscan.conf file, make sure that an entry has been added for the 3490. If there is no entry, you should verify that you have a current version of SANE that supports this scanner.

	# Epson Perfection 3490
	usb 0x04b8 0x0122

Scanner Permissions: USB device permission should be configured as described in the previous section.

scanimage: The scanimage program is a generalized command line utility for handling scanners. You can verify that the scanner is connected and accessible with:

	scanimage -L

Scanimage can also be used for listing available parameters (scanimage --help) and in batch scanning scripts. See the scanimage man page for details.

Small Issues: Be aware that, unlike many other EPSON scanners, the 3490 scans with the top of the page at the front of the glass (near the front panel controls), not the back (near the lid hinge). Also, I had some issues with strange pixellation when using the 600dpi and 1200dpi resolutions. 400 dpi, 800 dpi and 1600 dpi looked much better.

Debugging: Permission: If scanimage does not detect the scanner (i.e. "No scanners were identified" message) as a normal user, but works as root, you probably have a libusb permission issue that can be solved with the hotplugging configuration listed above.

Debugging: Transparency Unit Freeze: I initially had a problem with scanimage freezing when I tried to use the transparency adapter (--source "Transparency Adapter"). An strace showed that scanimage was looping while waiting for a message from the scanner that never seemed to arrive. The only solution was to unplug the scanner so that scanimage failed.

The problem seemed to be that I was using an older version of libusb (RPM libusb-0.1.8-2.1). When I upgraded to a newer version (libusb-0.1.10a) the problem went away. Not sure if that was the problem, but I haven't had it since. (reference)

Debugging: Verifying Scanner Connection: You can verify that the scanner is being recognized by the USB subsystem with

	cat /proc/bus/usb/devices

You should see lines in the listing like the following. Note that the Driver is listed as "(none)" - which is correct since SANE now uses libusb rather than a kernel driver module. If the Driver is listed as "scanner", you problems with an older version of SANE that does not support this scanner...and you should upgrade to a current version.

	T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
	D:  Ver= 2.00 Cls=ff(vend.) Sub=ff Prot=ff MxPS=64 #Cfgs=  1
	P:  Vendor=04b8 ProdID=0122 Rev= 1.10
	S:  Manufacturer=EPSON
	S:  Product=EPSON Scanner
	C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
	I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
	E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
	E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
	E:  Ad=83(I) Atr=03(Int.) MxPS=   8 Ivl=4096ms

Debugging: sane-find-scanner: The SANE backend source contains a script in the tools directory called sane-find-scanner. This will find USB devices that appear to be scanners, although listing by sane-find-scanner does necessarily mean that there is a backend that supports the scanners. For example, the listing for the the Epson 3490 is:

	found USB scanner (vendor=0x04b8 [EPSON], 
		product=0x0122 [EPSON Scanner]) at libusb:001:005
	  # Your USB scanner was (probably) detected. It may or may not be supported by
	  # SANE. Try scanimage -L and read the backend's manpage.

Debugging: Not scanning full platen: I read a posting here about not being able to scan the complete area of the glass (i.e. cropping off edges). I think the solution is to get the most recent SANE snapshot (not the released version), although I am not certain since I do not have ready access to a scanner that I can test.

Debugging: libsane symlink: Trevor Cordes wrote me about an annoying problem he had with a symbolic link in Fedora 3:

I hit one major 2-hour-headbanging stumbling block that your site doesn't mention. Maybe you didn't run across this. It might be FC3 specific. The problem was something in the system (I still don't know what) makes a symlink from /usr/local/lib/sane/libsane.so.1 -> libsane-v4l.so.1.0.16. That's totally bogus. If I rm the symlink it just instantly pops back into existence!! Weird! This wouldn't have been a problem, but my /etc/ld.so.conf had /usr/local/lib/sane listed BEFORE /usr/local/lib and so this bogus libsane.so was being used instead of the real one in /usr/local/lib! Reversing the order in ld.so.conf solved the problem. Scanner works great now.

I still don't know what is causing the bogus symlink but I don't really care at this point and quick googling turned up similar reports but only in older OS's and no real reason listed.

3.2 Epson Perfection 1240U and 2400

I purchased Epson Perfection 1240U USB Scanner in 2002 and an Epson Perfection 2400 Scanner in 2004. Both of them are supported by the epson scanner backend.

SANE Install: SANE comes with most distributions. If you need to get a copy from the website, you will need two packages: the backends and the frontends.

PRIOR TO PLUGGIN IN YOU SCANNER, AS SUPERUSER you need to modify some SANE configuration files in the /etc/sane.d directory.

/etc/sane.d/dll.conf: This file contains a list of backends that are dynamically loaded when the scanner connected. By default, some entries may be commented out (# character). For a scanner that uses the epson backend, remove the # from in front of the epson line.

	# dmc
	epson
	# fujitsu

Scanner Permissions: USB device permission should be configured as described in the previous section.

Connect Scanner: You should now plug in your scanner to the USB port. SANE should recognize the new device, which you can verify with the following AS SUPERUSER:

	scanimage -L

This gives the following listing for my Epson Perfection 2400:

	device `epson:libusb:004:003' is a Epson GT-9300 flatbed scanner

3.3 Epson Perfection 3170

I briefly owned a Epson Perfection 3170 scanner, but I do not recommend it. The driver requires proprietary firmware and since the backend is a precompiled library, setup is a mega pain. Although RPMs are available, they may not work on your software configuration and it is best to compile from source.

Download iscan: Download iscan (which includes the epkowa driver) from Avasys. Note that you need the gcc 3.2 (experimental version), not the gcc 2.6 version. This site also hosts a message board that may be helpful if you have installation problems. If you try to compile the gcc 2.6 version on a gcc 3.x system, you will get errors like:

	pisa_esmod_tool.cc:45: undefined reference to `Focus::operator new(unsigned)'

Download SANE: You may need to recompile SANE from source because distributions like SuSE do not put the SANE libraries in /usr/local and because the proprietary iscan libraries will give errors with scanimage and xscanimage. If you already have SANE installed, you should uninstall. Download the sane-backends and sane-frontends directly from the SANE Website.

IMLIB: You will need imlib to compile the iscan interface that is part of the driver. Your distribution should include an imlib-devel package RPM. You can verify installation with

	To verify installation:  rpm -qa | grep imlib
	
	To install an RPM:       rpm -i imlib-devel-1.9.14-36.i586.rpm

Compile iscan: This will place the libraries in /usr/local/lib and the executables in /usr/local/bin (which you need to add to your PATH environment variable if it is not already there).

	tar -zxvf iscan-1.8.1-0.redhat.8.0.tar.gz
	cd iscan-1.8.1  
	./configure
	make
	make install

If you get the error message "gdk_imlib.h: No such file or directory", verify that imlib-devel is installed.

Library Problem: If you try running iscan at this point you will probably get the error:

	iscan: error while loading shared libraries: libesmod.so.1: 
	cannot open shared object file: No such file or directory

The precompiled, proprietary epkowa driver library (libesint32.so) was compiled with a bad path to the scanner firmware binary file (esfw32.bin). Source code is not available so this can't be fixed. However, you can create a link that will fix the problem. ldconfig updates the library loader cache. You may want to make sure that the /etc/ld.so.conf file contains an entry for /usr/local/lib.

	cd /usr/share
	ln -s /usr/local/share/iscan iscan
	ldconfig

Compile SANE: The SANE frontends (scanimage and xscanimage) as normally compiled will not be able to find the scanner without a meaningful error message. The problem is that the frontends are linked using gcc, but since the epkowa libraries were compiled with g++, when epkowa.c calls dlopen() in attach() on line 2530 fails to find a symbol:

	/usr/local/lib/libesint32.so: undefined symbol: __gxx_personality_v0

Therefore, you need to change the Makefile for scanimage (in the sane-backends) to use g++ to link. Edit the sane-backends-1.0.14/frontend/Makefile and change:

	LINK = $(CC) $(LDFLAGS) -o $@

	to

	LINK = g++ $(LDFLAGS) -o $@

/usr/local/etc/sane.d/dll.conf: The SANE configuration files are in the /usr/local/etc/sane.d directory, not /etc/sane.d. The dll.conf file indicates which backend libraries should be loaded when the scanner module is loaded. Add the following line to the dll.conf file:

	epkowa

Device File Permission: The scanner device files are often installed with permissions that makes them inaccessible by anyone besides the root. This will cause scanimage to be unable to detect the scanner. Change the permission:

	chmod 0777 /dev/usb/scanner0

/etc/modules.conf: The modules.conf file provides module configuration information, including which modules should be loaded when device files are accessed. /dev/usb/scanner0 is device major number 180 and the scanner module provides access to all SANE scanners. Add the following line to dynamically load the scanner module when the scanner device file is accessed:

	alias char-major-180 scanner
	options scanner vendor=0x04b8 product=0x0116

/etc/sane.d/epson.d: This file contains configuration information for the epson backend Edit /etc/sane.d/epson.conf and remove the # from the bottom line (i.e. uncomment) and change it to:

	usb /dev/usb/scanner0

At this point you should be able to use the graphical iscan program by typing iscan at a command line prompt. If you just use the iscan program, you should be good to go. However, the SANE GUI program xscanimage is useful with gimp and the command line program scanimage is useful for scanning from shell scripts. Because my time with the 3170 was so brief before I returned it to the store, I'm not sure which of these modifications are actually necessary. They all relate to problems with an option descriptor returned by the library driver.

OPT_WAIT_FOR_BUTTON: There is a break in the sequence of options use in the iscan epkowa.h and epkowa.c files. Go through those files and delete all references (or dependent code) that require the constant OPT_WAIT_FOR_BUTTON.

xscanimage crashing problem: The fix above should solve this, but on line 990 of xscanimage.c, there is a problem referencing the NULL title of the problematic option:

      if (!opt->title)
              title[0] = 0;
	              
      else if (opt->unit == SANE_UNIT_NONE)
            strncpy (title, opt->title, sizeof (title));

scanimage crashing problem: The scanimage command line program also has a problem with this bad option. In scanimage.c, add the following NULL check after line 350 call to sane_get_option_descriptor in print_option()

          if (!opt || !opt->desc)
	          return;

4. Digital Cameras

USB support for many digital cameras with utilities that ship with most Linux distibutions. gtkam is a front-end graphical interface for the gphoto2 command line program. Camera images can be accessed through the gtkam interface now included in GIMP. No additional configuration should be necessary other than plugging the camera into the USB port.

I have been a contented user of the Kodak DX-3500 and DX-6340 point-and-shoot cameras. These and many other cameras from a wide variety of manufacturers adhere to the standard PTP (Photographic Transfer Protocol) defined by the International Industry Imaging Association (I3A). These cameras are supported by gtkam.

Prior to availability of gtkam, I created mmptp, a command line utility for batch download of images from a PTP camera. I keep MMPTP around because I prefer it's ability to download with names based on photo date rather than the meaningless internal names used by the cameras. Also, because the code is so simple and clear, I can easily diagnose problems.


5. External USB CD Burner

Many external CD and CD/DVD burners adhere to the USB Mass Storage Device specification and are supported by the usb-storage module. You should be able to plug the device into a USB port and see the device with cdrecord -scanbus

I have used a Memorex External CD-RW Drive (product #32023234) which provides 52x recording speed, although it drops to 2x speed if your computer only has a USB version 1 port. The /proc/bus/usb/devices listing is:

	T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
	D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
	P:  Vendor=12f7 ProdID=2520 Rev= 0.01
	S:  Manufacturer=Memorex
	S:  Product=MRX523252AJEL
	S:  SerialNumber=DEF1095F39D9
	C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
	I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
	E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
	E:  Ad=88(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

The drive can also be used as a CD reader, although you may need to mount the device manually. The /var/log/messages listing is:

	May  9 18:56:53 kernel: scsi0 : SCSI emulation for USB Mass Storage devices
	May  9 18:56:53 kernel:   Vendor: Memorex   Model: 52MAXX 3252AJ1 Rev: 4WS2
	May  9 18:56:53 kernel:   Type:   CD-ROM ANSI SCSI revision: 02
	May  9 18:56:53 kernel: USB Mass Storage support registered.
	May  9 18:56:54 kernel: Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
	May  9 18:56:54 kernel: sr0: scsi-1 drive
	May  9 18:57:00 devlabel: devlabel service started/restarted

Although this gives the drive as /dev/sr0, there is no such device and the actual name is /dev/scd0. Create a directory mount point (such as /mnt/external) and mount the device with the mount command. Your data CD files will be visible under the directory /mnt/external. Audio CDs cannot be mounted.

	mkdir /mnt/external
	mount /dev/scd0 /mnt/external

CD writing is a bit more complicated process described on my Linux command line page.


6. External USB Storage

Most commodity USB external storage devices use the standard USB Storage device class and are handled by the usb_storage module, which provides SCSI emulation and makes the devices appear as /dev/sda1, /dev/sda1, etc.

You can verify emulation by plugging the device into a USB port and viewing system messages by issuing the "dmesg" command or looking at the bottom of the system log /var/log/messages file for something like the following listing for a Western Digital Passport external hard drive:

	SCSI subsystem initialized
	Initializing USB Mass Storage driver...
	scsi0 : SCSI emulation for USB Mass Storage devices
	  Vendor: WDC WD60  Model: 0UE-00HCT0        Rev: 0000
	  Type:   Direct-Access                      ANSI SCSI revision: 02
	USB Mass Storage device found at 2
	usbcore: registered new driver usb-storage
	USB Mass Storage support registered.
	SCSI device sda: 117210240 512-byte hdwr sectors (60012 MB)
	sda: assuming drive cache: write through
	 sda: sda1
	Attached scsi disk sda at scsi0, channel 0, id 0, lun 0

If the device has multiple partitions, each partition will have a separate device (i.e. sda1, sda2, sda3, etc.). However most devices (like flash drives) only have one partition.

In order to access the drive, it must be mounted to a mount point in the file system. These external devices usually have a VFAT filesystem and can be mounted explicitly (as root) with the following commands (replacing the sda1 with the appropriate device number, when necessary):

	mkdir /mnt/external
	mount /dev/sda1 /mnt/external

If you use the device frequently, you may want to put a line in the /etc/fstab file so you can mount the device as a non-root user with the simpler "mount /mnt/external" command:

	/dev/sda1	/mnt/external	vfat	noauto,user,exec	0 0

Once mounted, the contents of the drive can be accessed through the /mnt directory specified in the mount command.

6.1 Reformatting an External USB Hard Drive

USB drives can be repartitioned and reformatted. You will probably want to use a FAT32 partition to permit Windoze compatibility.

	/sbin/fdisk /dev/sda 

	p to list current partitions

	d to delete existing partitions

	n to create a new partition. Accept default 
	  cylinder numbers to create one big partition.

	t to change the partition type (0b for FAT32)

	w to write the partition table and exit fdisk

	/sbin/mkdosfs -F 32 /dev/sda1

6.2 Western Digital Passport Portable USB Drive

Western Digital Passport drives are simply Western Digital hard drives (in a variety of sizes) enclosed in a case with a standard USB connector. They are supported by the usb_storage module and can be mounted as described above.

6.3 Lexar JumpDrive USB Flash Memory

USB flash drives are produced by a number of manufacturers and are a commodity product. Lexar JumpDrives are a common example. They are supported by the usb_storage module and can be mounted out-of-the-box as described above.

6.4 CompUSA USB HDD Enclosure

The CompUSA 2.5" USB 2.0 One Button Back-Up HDD Enclosure (Product #HDB-250, SKU 317156, UPC 41808 0059) is an inexpensive external hard drive enclosure for 2.5" hard drives. Note that 2.5" drives are usually used in laptops, while (less expensive) 3.5" drives are used in desktops. This device is supported by the usb_storage module and can be mounted out-of-the-box as described above.

The /proc/bus/usb/devices listing is as follows. Note that this is a rebranded device manufactured by VIA Technologies.

	T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
	D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
	P:  Vendor=040d ProdID=6204 Rev= 0.03
	S:  Manufacturer=VIA Technologies Inc.
	S:  Product=USB 2.0 IDE Bridge
	S:  SerialNumber=000000000001
	C:* #Ifs= 1 Cfg#= 2 Atr=c0 MxPwr=100mA
	I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=02 Prot=50 Driver=usb-storage
	E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
	E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

The /var/log/messages listing is as follows:

	May 10 12:16:09: usb 1-1: new full speed USB device using address 2
	May 10 12:16:10: SCSI subsystem initialized
	May 10 12:16:10: Initializing USB Mass Storage driver...
	May 10 12:16:10: scsi0 : SCSI emulation for USB Mass Storage devices
	May 10 12:16:10:   Vendor: IBM-DARA  Model: -206000           Rev: AR2O
	May 10 12:16:10:   Type:   Direct-Access                      ANSI SCSI revision: 02 
	May 10 12:16:10: usbcore: registered new driver usb-storage
	May 10 12:16:10: USB Mass Storage support registered.
	May 10 12:16:10 toshiba1905 scsi.agent[1771]: disk at 
			/devices/pci0000:00/0000:00:05.2/usb1/1-1/1-1:2.0/host0/0:0:0:0
	May 10 12:16:10: SCSI device sda: 11733120 512-byte hdwr sectors (6007 MB)
	May 10 12:16:10: sda: assuming drive cache: write through
	May 10 12:16:11:  sda: sda1 sda2 sda3
	May 10 12:16:11: Attached scsi disk sda at scsi0, channel 0, id 0, lun 0

In this case, the disk has three partitions. To mount the drive, you should create a directory mountpoint to mount the drive - in this example the third partition sda3

	mkdir /mnt/external
	mount /dev/sda3 /mnt/external

Note that external hard drives use alot of power and the USB port, especially on older machines, may not be capable of supplying adequate power. The CompUSA drive has provisions for an external 5v adapter, which you can pick up at Radio Shack. When I initially used the Norwood box, I could hear the hard drive cyclically powering up and down. There were numerous messages in /var/log/messages similar to the following:

	May  9 12:25:47: hub.c: new USB device 00:05.2-1, assigned address 2
	May  9 12:25:47: usb.c: USB device 2 (vend/prod 0x4b4/0x6830) 
		is not claimed by any active driver.
	May  9 12:25:48: hub.c: already running port 1 disabled by hub (EMI?), 
		re-enabling...
	May  9 12:25:48: usb.c: USB disconnect on device 00:05.2-1 address 2
	May  9 12:25:48: hub.c: new USB device 00:05.2-1, assigned address 3
	May  9 12:25:48: usb.c: USB device 3 (vend/prod 0x4b4/0x6830) 
		is not claimed by any active driver.
	May  9 12:25:49 devlabel: devlabel service started/restarted
	May  9 12:25:52: hub.c: already running port 1 disabled by hub (EMI?), 
		re-enabling...
	May  9 12:25:52: usb.c: USB disconnect on device 00:05.2-1 address 3
	May  9 12:25:52: Initializing USB Mass Storage driver...

Turns out that the port could not supply enough power when the drive motor started. The port was encountering an overcurrent condition and shutting the device down. The EMI message was erroneous.

6.4 Norwood Micro USB External Hard Drive Enclosure

The Norwood Micro 2.5" USB 2.0 External Hard Drive Enclosure (Product #UE-203, UPC 41808 00567) is another small, stylish box that can be used to connect an external 2.5" hard drive. It is supported by the usb_storage module and can be mounted out-of-the-box as described above.

The /proc/bus/usb/devices listing is as follows. Note that this is a rebranded device manufactured by Cypress Semiconductor.

	T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 37 Spd=12  MxCh= 0
	D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
	P:  Vendor=04b4 ProdID=6830 Rev= 0.01
	S:  Manufacturer=Cypress Semiconductor
	S:  Product=USB2.0 Storage Device
	S:  SeralNumber=DEF109BB7104
	C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
	I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
	E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
	E:  Ad=88(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

7. HP CD-Writer Plus 7200

My first CD burner was an HP CD-Writer Plus 7200, bought in 1998, that could attach to my x486 laptop via the parallel port. It theoretically supported 2x recording, but I was never able to get consistent performance over 1x. The device is supported by the http://cyberelk.net/tim/parport/paride.html paride parallel port device support modules that connect it as an emulated SCSI device. It can be used with the cdrecord utility that comes with most significant Linux distributions. It still works, although it does not work with all current blank CD media.

As of Fedora Core 2, I have had problems figuring out how to get paride working with this hardware. This became an issue because I had some old CDs I had burned in 1999 with large .wav files that could not be read by any of my other CD drives. However, they could be read (albeit slowly) by this old drive. The problem came because the old paride modules don't seem to be included with the newer Fedora distros.

Damn Small Linux, a 50MB live CD came to the rescue with all the old parport modules. It requires booting from the CD, but you can mount your hard drive copy the needed files, and reboot.

To mount and read a data CD, after connecting the device, the driver modules must be manually loaded as root. pcd is the module for reading. The cdrecord command is only necessary for a diagnostic list of the drive by SCSI number, and may not work.

	/sbin/modprobe parport
	/sbin/modprobe paride
	/sbin/modprobe epat
	/sbin/modprobe pcd
	cdrecord -scanbus
	mount /dev/pcd0 /mnt/cdrom

There is a pg module for writing. If you try to load the pg and pcd modules at the same time, you may have a hard time mounting for reading. Given the age of these devices and the potential for incompatibility with new media, I would vociferously dissuade you from using this hardware to write. For example, I had problems with the following cryptic messages being issued when trying to burn onto TDK 700MB blank CD media. Supposedly this is a firmware problem that does not allow this old drive to support some contemporary media.

	Starting to write CD/DVD at speed 1 in real TAO mode for single session.
	Last chance to quit, starting real write    0 seconds. Operation starts.
	Waiting for reader process to fill input buffer ... input buffer ready.
	Performing OPC...
	cdrecord: Input/output error. send opc: scsi sendcmd: no error
	CDB:  54 01 00 00 00 00 00 00 00 00
	status: 0x2 (CHECK CONDITION)
	Sense Bytes: F0 00 03 00 00 00 00 19 00 01 A2 DF 73 02 00 00 00 00
	Sense Key: 0x3 Medium Error, Segment 0
	Sense Code: 0x73 Qual 0x02 (power calibration area is full) Fru 0x0
	Sense flags: Blk 0 (valid) 
	cmd finished after 20.042s timeout 60s
	cdrecord: OPC failed.
	Writing  time:   20.178s
	cdrecord: fifo had 128 puts and 0 gets.
	cdrecord: fifo was 0 times empty and 0 times full, min fill was 100%.

8. NetGear MA111 (version 1)

The Netgear MA111 (no version) is a $50 USB gadget for 802.11b wireless communication that uses the Prism 2/2.5/3 chipset (Manufacturer site). Note that version 2 of this device uses a different, unsupported chip.

Instructions for this driver are included with the driver, although some of the later steps in the documentation seem unnecessary.

Download: Download the Linux-WLAN driver from their FTP server. I am using linux-wlan-ng-0.2.1-pre26.

Kludge for 2.6 Kernel: When I initially tried to compile the driver under Fedora Core 2, I got a number of errors similar to these:

	linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x_usb.c:3300: 
		error: `USB_QUEUE_BULK' undeclared (first use in this function)
	linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x_usb.c: 
		In function `hfa384x_usbctlx_cancel_async':
	linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x_usb.c:3388: 
		error: `USB_ASYNC_UNLINK' undeclared (first use in this function)
	linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x_usb.c: 
		In function `hfa384x_usbctlx_re

This is caused by changes in the Linux USB subsystem code for kernel version 2.6. Edit the src/include/wlan/wlan_compat.h file and find the following code around line 561

	#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
	#define URB_ASYNC_UNLINK  USB_ASYNC_UNLINK
	#define usb_fill_bulk_urb  FILL_BULK_URB
	#define usb_kill_urb  usb_unlink_urb
	#else
	#define USB_QUEUE_BULK 0
	#endif

Delete those lines and add:

	#define usb_kill_urb  usb_unlink_urb
	#define USB_QUEUE_BULK 0

Make: Untar and make as superuser

	tar -zxvf 
	make config
	make all
	make install

Configuration File: Create the /etc/sysconfig/network-scripts/ifcfg-wlan0 file. If you have the SSID for your access point, you should include that as well

	DEVICE=wlan0
	NAME=wlan0
	BOOTPROTO=dhcp
	ONBOOT=yes
	ESSID=MYNETWORK461

Plug in the Device: The module should load itself and start the interface when you plug in the device. You can verify:

Configuration Files: The linux-wlan driver does not fully implement the options listed in the ifcfg-wlanx files and has it's own, cumbersome, set of configuration files in /etc/wlan. /etc/wlan/wlan.conf contains general configuration options and an entry that points to additional options in /etc/wlan/wlan-xxx, where xxx is a configuration name or DEFAULT for the default configuration.

The configuration files as initially installed will attach to the nearest access point:

	/etc/wlan/wlan.conf
		SSID_wlan0=""

	/etc/wlan/wlancfg-DEFAULT
		IS_ADHOC=n

	/etc/sysconfig/network-scripts/ifcfg-wlan0
		DEVICE=wlan0
		NAME=wlan0
		BOOTPROTO=dhcp
		ONBOOT=no
		AP=xx:xx:xx:xx:xx:xx

For an ad-hoc network (named homenet in this example):

	/etc/wlan/wlan.conf
		SSID_wlan0="homenet"

	/etc/wlan/wlancfg-homenet
		IS_ADHOC=y
	
	/etc/sysconfig/network-scripts/ifcfg-wlan0
		DEVICE=wlan0
		NAME=wlan0
		BOOTPROTO=static
		ONBOOT=no
		ESSID=homenet
		IPADDR=192.168.0.1

Device Reset: If you change configuration, you need to reset the device. Although there is some kind of configuration utility, the easiest thing is to just bring the interface down, unload the driver and unplug/replug the device:

	/sbin/ifconfig wlan0 down
	/sbin/rmmod prism2_usb 
	(unplug and replug device)

Note that use of airsnort or tcpdump causes loss of connection and requires reset.

9. Belkin F5D6020 (version 3)

The Belkin F5D6020 version 3 is a PCMCIA (32-bit CardBus) wireless 802.11b network interface card that uses the Realtek RTL8180L Chipset. As with many PC manufacturers, Belkin often makes significant changes the internal hardware of a device without changing the model number and/or outward appearance of the card. Thankfully, Belkin usually lists version numbers on the packaging (oddly as "Ver. 3000"). Note that the version 3 card described in this document uses a different chipset than other versions of this card. Version 2 uses the Atmel chipset (see atmelwlandriver.sourceforge.net). The unversioned release uses the Prism 2, 2.5 and 3 chipsets (see www.goonda.org/wireless/prism2/). To find chipsets used in other cards, see this list of WLAN cards.

Personally, I prefer ndiswrapper over linux-wlan. Although ndiswrapper does not provide rfmon support that can be used with kismet or airsnort, it does permit iwlist scans, which linux-wlan does not. Ndiswrapper also does not use cryptic specialized configuration files line linux-wlan

Verify Card: Verify that you have the correct card. Insert the card in the PCMCIA slot. The listing from "cat /proc/pci" should contain:

	Bus  7, device   0, function  0:
	  Ethernet controller: PCI device 1799:6020 (rev 32).
	  IRQ 11.
	  Master Capable.  No bursts.  Min Gnt=32.Max Lat=64.
	  I/O at 0x4c00 [0x4cff].
	  Non-prefetchable 32 bit memory at 0x21000000 [0x210001ff].

The listing for "/sbin/lspci - v" should contain:

	07:00.0 Ethernet controller: Belkin: Unknown device 6020 (rev 20)
	        Subsystem: Belkin: Unknown device 6020
	        Flags: medium devsel, IRQ 11
	        I/O ports at 4c00 [size=256]
	        Memory at 21000000 (32-bit, non-prefetchable) [size=512]
	        Capabilities: [50] Power Management version 2

The listing for "/sbin/cardctl ident" should contain:

	Socket 0:
	  product info: "Realtek", "Rtl8180"
	  manfid: 0x0000, 0x024c
	  function: 6 (network)

NDISWRAPPER: For reasons listed below, I use a Windoze driver for this card with NDISWRAPPER an open source project that implements the Network Driver Interface Specification (NDIS), a standard API that provides a standardized programming interface for network interface cards that is used by Windoze.

Download the most current version of NDISWRAPPER from ndiswrapper.sourceforge.net, untar, make and install it.

	tar -zxvf ndiswrapper-0.10.tar.gz
	cd ndiswrapper-0.10
	make
	make install

Network Configuration Script: The Linux networking subsystem uses configuration scripts in /etc/sysconfig/network OR /etc/sysconfig/network-scripts, (depending on your distribution) with names that start with "ifcfg-". The script for the new wireless card will be "ifcfg-wlan0". Create this file with the following contents:

	DEVICE=wlan0
	NAME=wlan0
	BOOTPROTO=dhcp
	ONBOOT=yes

This script assumes that you are connecting to an existing wireless network that assigns IP addresses with DHCP and does not use any kind of encryption (i.e. managed mode). If you are setting up a private home network, you should consult a networking How-To (such as this) for an appropriate config script.

Realtek Drivers: Download the Windoze XP driver for the RTL8180L from http://www.realtek.com.tw. For reasons listed below, you probably won't want to try to use either the Windoze drivers provided by Belkin or the native Linux drivers provided by Realtek. Unzip the .zip file and copy the driver files into a new system directory:

	unzip ndis5x-8180(170).zip
	mkdir /usr/local/share/belkin
	cp NET8180.INF rtl8180.sys /usr/local/share/belkin

Modify the .inf file: The driver information file NET8180.INF contains Realtek vendor and device codes that need to be replaced with the Belkin codes. Edit NET8180.INF with the text editor of your choice and replace all occurances of "VEN_10EC&DEV_8180" with "VEN_1799&DEV_6020".

Install the driver with NDISWRAPPER: NDISWRAPPER comes with both a kernel module and an administrative tool named ndiswrapper. Install the driver information file:

	/usr/sbin/ndiswrapper -i /usr/local/share/belkin/NET8180.INF
	/usr/sbin/ndiswrapper -l

ndiswrapper -l should list the card as installed and present. Load the module.

	modprobe ndiswrapper

Verify Network: Assuming you are near an access point, modprobing the driver module should connect to the network and activate the wlan0 interface. You can verify this with

	/sbin/ifconfig

Daily Operation: Although ndiswrapper -m will modify the /etc/modules.conf file to load the driver on demand, I have not had success with it. Which actually works out for the best, since wireless security is a joke and you probably don't want to be leave an open wireless connection when it is not needed.

However, this requires you to modprobe ndiswrapper whenever you want to use the wireless connection. I have had problems with the interface not coming up, but this is solved by unloading the module (rmmod ndiswrapper) and reloading it (modprobe ndiswrapper).

Problems With Other Drivers

Orinoco Driver: I initially purchased the Belkin card because it was listed on the Linux PCMCIA site as supported by the orinoco_cs driver that comes with most modern distributions. However, orinoco_cs only supports version 1 of this card, not the version 3 card I purchased, so modprobe orinoco_cs does nothing.

Belkin Drivers: The card does come with drivers on a CD (Bel6020.inf and Bel6020.sys), but these drivers caused my keyboard to behave eratically with long delays between the time a key was pressed and when it was displayed. Perhaps an interrupt conflict of some kind.

Realtek Linux Drivers: Realtek provides Linux drivers for the RTL8180L chip used in the Belkin F5D6020 V.3. The tarball includes both C code for the interface as well as a precompiled proprietary object code file (priv_part.o). The standard Fedora Core 1 kernel is compiled with CONFIG_MODVERSIONS to restrict modules compiled for a different kernel versions from accidentally loaded. The proprietary object module was NOT compiled with modversioning, so loading (modprobe) the driver module will fail and depmod -e will give numerous unresolved symbols:

	/lib/modules/2.4.22-1.2115.nptl/kernel/drivers/net/wireless/rtl8180_24x.o: 
		unresolved symbol info
	depmod:         eth_type_trans
	depmod:         alloc_skb
	depmod:         pci_register_driver

For more information on modversions, see the Linux Kernel Module Guide.

For those without kernel modversion problems, you might try the linux module:

Download the Linux driver for the RTL8180L from Realtek.com.tw. Make sure to chose the appropriate kernel version, usually Linux kernel 2.4.20 (gcc version 3.2.2). Unzip the file.

As with the Windoze driver, you will need to modify the code to reflect the Vendor/Device number for the Belkin card rather than the Realtek card. Edit r8180_pci_init.c, find the following line and change it to this:

	static struct pci_device_id rtl8180_pci_id_tbl[] = {
	// { 0x10EC, 0x8180 /*0x8139*/, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
	{ 0x1799, 0x6020 /*0x8139*/, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
	{0,},

You should them be able to make install

The Realtek driver uses scripts that are included with the driver for bringing the interface up/down: wlanup and wlandown

10. External Modems

While there are a number of cheap external USB modems available for PC, almost all of them are WinModems. While I have seen reports of working configurations, you should probably not waste your time with them. I strongly suggest using an external serial modem with your RS-232 port (if you have one) or a USB-to-Serial convertor.

The Linux kernel contains ftdi_sio, a driver for for USB-to-Serial convertors based on FTDI chips. I use use a VScom USB Serial Adapter (FT232BM chip) purchased from byterunner.com along with a U.S. Robotics external V.92 serial modem. When the device is plugged in, it should be accessible from /dev/ttyUSB0. There is a bug in the file released with the drivers in kernels up to 2.6.5 that can easily fixed (see below) My /etc/wvdial.conf file is:

	[Dialer Defaults]
	Modem = /dev/ttyUSB0
	Phone = (ISP phone #)
	Username = (ISP username)
	Password = (ISP password)

The PPP daemon that controls the connection will get the names of DNS servers from the ISP and place them in the /var/run/ppp/resolv.conf file. Linux uses /etc/resolv.conf for name resolution, so you will need to create a soft link:

	ln -s /var/run/ppp/resolv.conf /etc/resolv.conf

On some distributions, the PPP nameserver file is /etc/ppp/resolv.conf file.

The driver bug is located in the /usr/src/*/drivers/usb/serial/ftdi_sio.c file. The problem is that on init, wvdial (and minicom) toggle the DTR line by setting the baud rate to B0 then restoring it. The corresponding code in ftdi_set_termios() lowers DTR and RTS when setting B0, BUT NEVER RESTORES THOSE LINES when setting the baud rate. This prevents successful communication with the modem. The fix is to add a set_dtr(HIGH) and set_rts(HIGH) after change_speed() when setting the baud rate to anything other than B0. Code is listed below.

--- ftdi_sio.old        2004-05-08 08:56:41.000000000 -0400
+++ ftdi_sio.c  2004-11-17 11:45:54.558102344 -0500
@@ -1838,6 +1838,13 @@
                if (change_speed(port)) {
                        err("%s urb failed to set baurdrate", __FUNCTION__);
                }
+               /* Raise RTS and DTR */
+               if (set_dtr(port, HIGH) < 0){
+                       err("%s Error from DTR HIGH urb", __FUNCTION__);
+               }
+               if (set_rts(port, HIGH) < 0){
+                       err("%s Error from RTS HIGH urb", __FUNCTION__);
+               }
        }
 
        /* Set flow control */

Radio Shack sells a USB-to-Serial convertor that supposedly works under Linux. Although the packaging gives no technical details, it is supposedly based on th PL2303 chipset (reference)


11. Additional Wireless Cards

My initial steps in going wireless in October, 2004 involved research into finding a PCMCIA or USB wireless device that I could use with my laptop. A search of a major computer retailer came up with the following results. The situation will be considerably different if you do a search now, but I provide the following information if you come across any of this older hardware.


12. XM-PCR

The XM-PCR was an inexpensive USB box you could attach to your computer to receive XM Satellite Radio. The company stopped selling it supposedly because of digital rights management concerns, although you might be able to find one on ebay. There are a few programs out there to support the device, although I am understandably fond of my own MMXMPCR module and GUI.


14. Hewlett Packard HP350CBi Printer

I have an ancient Hewlett Packard HP350CBi portable printer. The following instructions are specific to that printer, but the general flow of setup operations may be helpful for determining specific instructions for other Linux printers. As with most hardware, before purchasing any printer, make sure to check a Linux hardware compatibility list such as the Linux USB DevList.

USB: Since most currently manufactured laptops do not provide parallel ports, you will need a USB printer cable. I use a cable sold by Radio Shack and described in the next section.

CUPS: Local printer access is handled by CUPS (Common Unix Printing System). which should be configured to start at boot time:

	/sbin/chkconfig cups on
	/etc/init.d/cups start

Configuration: Because CUPS supports such a wide range of technologies, the configuration files are very complex. The easiest way to configure CUPS is through the web interface, which can be reached by typing the following URL in a browser on the machine to which the printer is attached.

	http://localhost:631

Add New Printer: Go to the "Printers" screen, then "Add Printer" and follow the screens. Choose an arbitrary name (HPDeskJet, perhaps)

Device: Device for HP350CBi: HP DESKJET 350 USB #1 (HP DESKJET 350)

Model/Driver: You will be given opions for three drivers for this machine: cdj500, hpijs and pcl3. Use the pcl3 driver, NOT the "recommended" HP DeskJet 350C Foomatic/hpijs (recommended) (en)

Password: When prompted, provide the root username and password

Set Printer Options: The defaults are fine for printing on letter paper with a color cartridge. If, like me, you normally use the monochrome cartridge, make sure to change the Color Mode to "Normal Grayscale" or the machine will attempt to do three passes in black, giving a nasty looking printout.

Printing: Graphical Linux applications (such as OpenOffice) should be able to recognize a correctly configured printer. You can also print text files or postscript files directly from the command line with the lp or lpr commands:

	lp <file>.txt
	lp <file>.ps

Other Command Line Utilities: There are a number of command line utilities for manipulating printer configurations and print jobs:

Debugging: The primary CUPS configuration file is /etc/cups/printers.conf, which you can inspect if you still have configuration problems. Individual printers have their own configuration files in /etc/cups/ppd. CUPS error messages are written to /var/log/cups/error_log.

The hpijs and cjd500 drivers didn't work for me in grayscale mode, giving the error, "/usr/lib/cups/filter/foomatic-rip failed." Using the pcl3 driver seemed to solve the problem

The CUPS that came with Fedora 2 had problems changing color mode to grayscale and downloading and installing the most recent version of CUPS solved the problem. The CUPS shipped with later versions of Fedora had no such problems and worked out of the box.


15. Radio Shack USB to Parallel Printer Cable

Radio Shack sells a 6-Ft. USB to Parallel Printer Cable (part 26-184) that connects a printer with an IEEE-1284 (i.e. Centronics connector, like the HP 350CBi) to a machine that has USB but no parallel port. I bought the cable in July of 2005 for $37, which was a few dollars cheaper than a comparable Belkin device at CompUSA.

To my surprise and delight, the device is supported by the usblp USB printer driver and makes the printer available as /dev/usb/lp0.

CUPS (Common Unix Printing System) must be installed and running on the machine. Because the configuration file structure is complex, the printer is best configured via a web browser through the CUPS configuration system:

	http://localhost:631

FYI: The /proc/bus/usb/devices listing is:

	T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
	D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
	P:  Vendor=1453 ProdID=2000 Rev= 2.02
	S:  Manufacturer=RadioShack USB to Parallel Printer Cable
	S:  Product=RadioShack USB to Parallel Printer Cable
	C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
	I:  If#= 0 Alt= 0 #EPs= 1 Cls=07(print) Sub=01 Prot=01 Driver=usblp
	E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
	I:  If#= 0 Alt= 1 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=usblp
	E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
	E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
	I:  If#= 0 Alt= 2 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=ff Driver=usblp
	E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
	E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
	E:  Ad=83(I) Atr=03(Int.) MxPS=   4 Ivl=1ms

16. Linksys PCM100 EtherFast 10/100 Integrated PC Card

The Linksys PCM100 EtherFast 10/100 Integrated PC Card is supported by the pcnet_cs and 8390 modules. They will load automatically when you plug the device in or power up your machine with the card plugged in. The Ethernet interface can be configured with any number of GUI tools or by creating a /etc/sysconfig/network-scripts/ifcfg-eth0 file.


17. Netgear WG111T Wireless USB Adapter

The Netgear WG111T is a Super-G wireless USB 2.0 adapter that works under Linux using NDISwrapper and the Windoze driver supplied by the manufacturer. NDISwrapper is a Linux kernal module that implements the Windoze kernel API and NDIS (Network Driver Interface Specification) API within Linux kernel, thus permitting the use of native Windoze networking device drivers under Linux. Setup is fairly straightforward, but does require a little bit of effort.

Download the Windoze Driver: Get a copy of the Windoze driver the Netgear website. To be safe, I downloaded the last version available for Windoze XP, version 1.3. Because the driver comes as a self-extracting installer, you will need a Windoze machine to run the installation program and extract the driver files. The driver files you need are in the directory c:\Program Files\NETGEAR\WG111T\Driver: netwg11t.inf and wg11tnd5.sys. You can copy them onto a flash drive or, if you have a dual-boot system, copy them directly from the Windoze partition. Create a directory for them in Linux:

	mkdir /usr/local/share/wg111t
	cp netwg11t.inf wg11tnd5.sys /usr/local/share/wg111t

NDISwrapper in Ubuntu: If you're using a Debian-based system like Ubuntu, NDISwrapper is available in a package. You will need both the kernel module and the utility programs:

	sudo apt-get install ndiswrapper-common
	sudo apt-get install ndiswrapper-utils-1.9

To instruct the kernel to load the module at boot time, edit the /sbin/modprobe file and add one line to the bottom of the file:

	ndiswrapper

For additional help installing NDISwrapper on Ubuntu, see the Ubuntu help page HERE...

Installing NDISwrapper from Source Code: If your system's package manager doesn't have NDISwrapper available or you just want a scintillating experience, you can build and install NDISwrapper from source. Download the most recent source from a mirror given on the NDISwrapper page on SourceForge. Compilation and installation as superuser is as usual. There is no configure script:

	tar -zxvf ndiswrapper*
	cd ndiswrapper*
	make uninstall
	make 
	make install

On my Fedora 5 system (2.6.15 kernel) I got the following compilation errors

	ndiswrapper-1.52/driver/ntoskernel.c: 
		In function ‘ntoskernel_init’:
	ndiswrapper-1.52/driver/ntoskernel.c:2550: 
		warning: implicit declaration of function ‘for_each_possible_cpu’
	ndiswrapper-1.52/driver/ntoskernel.c:2550: error: 
		expected ‘;’ before ‘{’ token

The patch is simple: edit driver/ntoskernel.c and replace "for_each_possible_cpu" with "for_each_cpu". Compilation completes fine with that fix.

Install the Driver: Using the NDISwrapper utility, install the Windoze driver. (Ubuntu users type "sudo" before the ndiswrapper command)

	ndiswrapper -i /usr/local/share/wg111t/netwg11t.inf
	ndiswrapper -m
	/sbin/modprobe ndiswrapper

After plugging in the device, your wireless networks should be visible

Network Configuration Script: With Fedora and some other distributions (not Ubuntu) you will need to create a Network configuration script in /etc/sysconfig/network-scripts. The script for the new wireless card will be "ifcfg-wlan0". Create this file with the following contents:

	DEVICE=wlan0
	NAME=wlan0
	BOOTPROTO=dhcp
	ONBOOT=yes

A man of genius can hardly be sociable, for what dialogues could indeed be so intelligent and entertaining as his own monologues? (Arthur Schopenhauer)