linuxnewbie.org.gif
Tuesday, 12-Dec-2000 10:38:35 EST
Newbized Help Files articles discussion board bookshelf sensei's log advertising info

Getting USB/Your Printer Working

By Sterling

Version 1.0

Setting up the USB Driver

2.2.x kernels do have USB built-in, but its very outdated and buggy. The 2.3.x and 2.4.x have much better USB support, but not everyone may want to use a development kernel. Luckily, the 2.3.x USB support has been "backpatched" to work with the 2.2.x kernel. So in order to get USB support working properly, we must download and apply this patch.

    Patching Procedure:
  1. Type uname -r. If it doesn't list a version number greater than 2.2.14, get the newest kernel you can (I'm using 2.2.17) and compile it for your machine. Instructions for this are in the Kernel-HOWTO, so I won't get into it here.
  2. Fire up your favorite web browser or other download program and point it at the patch. This patch is provided by Vojtech Pavlik.
  3. cd to the directory where you put the patch, and type: gunzip [patch file name]. Note that some download programs, including Mozilla, automatically unzip .gz files. So don't be alarmed if gunzip reports that the file isn't gzipped.
  4. If you aren't already root, su root and cd /usr/src/linux.
  5. Type: patch -p1 < [path to your patch file]

    For example, if I'd put the patch file in /usr/downloads/usb-2.4.0-test2-pre2-for-2.2.16-v3.diff,

    I'd type:
    patch -p1 < /usr/downloads/usb-2.4.0-test2-pre2-for-2.2.16-v3.diff

  6. Now type make menuconfig (or make xconfig if you're doing this from Xwindows)
  7. Select "USB Support" and hit enter
  8. Turn on:
    • Support for USB
    • Preliminary USB Device Filesystem
    • A USB Controller suited to your system (the help data on each is very good. If you're unsure, go for UHCI).
    • USB Printer support
    • Any other USB devices that you have (this NHF only covers printers, because that's all I've configured)
  9. Check that everything else is set right, then save the settings and exit. Then build the kernel
  10. Enter the new settings into LILO and reboot.
  11. You should see a bunch of messages about USB as your system boots. They'll vary from system to system, depending on what devices you have hooked up.
  12. Now, type: mount -t usbdevfs usbdevfs /proc/bus/usb to mount the USB filesystem.

    If you want this filesystem mounted automatically at bootup, you can add the following to /etc/fstab:

    usbdevfs  /proc/bus/usb  usbdevfs  defaults  0  0

Now, we've gotten the USB support installed. This much of the NHF applies to installing the 2.3.x USB drivers no matter what you want to use them for. From now on, I'll be discussing printer-specific configuration stuff.

Configuring Your USB Printer

Make sure that you have the RedHat Printtool program installed. Its a nice interface for changing /etc/printcap (the file where your printer data resides). It also lets you print test pages, although I think there may be a few bugs there. When I tried, I had to restart lpd after each test page. Printtool should come pre-installed on RedHat systems, as part of the control panel package. For those of us using Debian, its also available as a .deb file. The lastest version is, I think, 3.41-4. Debian users can download it from the Package Data Page. And for RedHat users, the only download URL I could find was: Linuxberg.

Now, cd /dev. If there's a usb directory here, cd into it. Otherwise, create one using mkdir and cd into it. This is where you'll put the device files for your USB printer and any other USB devices you happen to install. You should already be root if you've been following this NHF. If you aren't, use the su command to make yourself root.

If your USB directory was already there, type ls and look for a file named lp0. If its there, you can skip the rest of this paragraph and start configuring your printer with printtool. Otherwise, we've got to create the device file.
Type:
mknod /dev/usb/lp0 c 180 0

You should now have a USB printer device. If you get an error, read the USB HOWTO for more information.

Launch X. The command for this is almost always startx. Open up an XTerm (or other terminal emulator of your choice) and type: printtool &. Click on the Add button down at the bottom "Local Printer" should be selected, so click Ok. Now click in the text box beside "Printer Device," and type in /dev/usb/lp0. Now click the select button and select a driver that works with your printer and set the options as needed. Most of them are explained in the Printing HOWTO. Once that's done, click Ok again. Now highlight the printer and print the ASCII and Postscript test pages. If you've got to swap cartriges to be able to print color, do this before printing the Postscript test page.

Recompiling Your Kernel

This section is provided merely as a reference, as Kernel recompilation is required to install the 2.3.x USB drivers. The process isn't very complicated, but it is possible to screw up your system if you make a mistake a the wrong time, so I highly recommend reading the Kernel-HOWTO.

Sensei's Note:
-Kernel Compiling NHF
-Kernel Update NHF

Once you've saved the settings from make menuconfig or make xconfig, type the following commands in order:

make dep
make clean
make bzImage
make modules
make modules_install

Most of these will take quite a bit of time to complete. If any errors are reported after any of the commands complete, go back to menuconfig or read the Kernel-HOWTO and try to figure out what went wrong. The most common cause of a compile error is setting an option in menuconfig and not setting another option it depends on.

Next, we need to copy the newly created Kernel image to the /boot directory, which is presumably somewhere LILO can easily find.

cp arch/i386/boot/bzImage /boot/vmlinuz-usb

Now, cd to /etc and open up lilo.conf in your favorite editor. I recommend Pico (very easy to use) or Vim! (just plain cool). Look for a line that says something like: default=Linux. That tells you what image LILO is set up to boot by default. Now scroll down until you find an entry something like the following:

image=/boot/vmlinuz
label=Linux
read-only

Change the label=Linux line to read label=old. We can now boot this Kernel if something goes majorly wrong with our USB-enabled one by typing 'old' at the LILO: prompt. Now, we want to add the section for our new boot image. Add the following to the file. A good place for it is probably right before the lines given above.

image=/boot/vmlinuz-usb
label=Linux
read-only

Look at the other image= block of text and add any other lines that seem important and don't have a # before them to our new image=block. Now save the file and exit your editor, then type lilo. If there are no errors, type shutdown -r now. Hopefully, nothing will go wrong. If something does go wrong, check the Kernel-HOWTO.

Resources Used in Writing this NHF

This is a brief listing of some of the web sites that I found useful information on in the process of writing this NHF.

Linux-USB.org - The Linux USB web site. Hosts of the Linux USB HOWTO, and a great resource for links, documentation, and utilities. The FAQ is particularly good. If you plan on using USB in any kind of extensive manner, I highly recommend reading through this site.

Linuxdoc.org - Very good documentation site. Not quite as good for newbies as our own Linuxnewbie.org, but has some very in-depth information. The HOWTOs and Guides are very, very useful.

USB Backport Patch Page - Vojtech Pavlik's USB Backport page is where I've linked to for the backport patch. Its got some troubleshooting information and links. Go check it out.




Would you like to have your article published online? Send them in to newfiles@linuxnewbie.org
[-NHF Control Panel-]
The Linux Channel at internet.com
Linux Planet
Linux Today
Linux Central
Linuxnewbie.org
PHPBuilder
Just Linux
Linux Programming
Linux Start
BSD Today
Apache Today
Enterprise Linux Today
BSD Central
All Linux Devices
SITE DESCRIPTIONS
[-What's New-]
Order a Linuxnewbie T-Shirt
Easy Webcam NHF
Directory Navigation NHF
Installing Snort 1.6.3 on SuSE 6.x-7.x
Customizing vim
The SysVinit NHF
Installing ALSA for the VT82C686 integrated sound
USB Creative Video Blaster II for Linux
Configuring the Intellimouse Explorer in XFree86 V4+
The beginnings of a distro NHF
Getting Past Carnivore?
Getting and Installing PGP
Getting your ATI Rage 128 Working
How to create a multiple partition system
Using Fdisk
Introduction to Programming in C/C++ with Vim
Adding a Hard drive in Linux -- In five steps
Installing ALSA for the Yamaha DS-XG Sound Card
Getting your Diamond Rio Mp3 Player to work with Linux
Bash Programming Cheat Sheet
Installing NVIDIA Drivers for Mandrake
Setting up Portsentry
Hard Drive Speed Tweak for Linux
Sensei's Log
Chat room
Join: Linuxnewbie.org SETI Black Belts!
Send in your news
Click the image to add Linuxnewbie.org to your MyNetscape Page
[-LNO Newsletter-]

[-Archive-]
The beginnings of a distro NHF
Connecting to the Internet using KPPP
Getting your SBLive to work
Unreal Tournament NHF
LWE Day 2 Pictures
LWE Day 1 Pictures
The LNO FAQ!
WoW (Words of Wisdom)
Other sites news
What is Linux?
What is Linux? part deux (ups & downs)
Search newsgroups
The List
ALS Report
Feedback Form
jobs.linuxtoday.com.gif
Match: Format: Sort by:
Search:
[-Quick Links-]

Copyright 2000 internet.com Corp. All Rights Reserved. Legal Notices Privacy Policy

internet.com.gif