justlinux.com
Sun, 06-Jul-2008 12:56:18 GMT
internet.com
Forum: Registered Users: 72406, Online: 270
nhfs Here you can view your subscribed threads, work with private messages and edit your profile and preferences Registration is free! Calendar Find other members Frequently Asked Questions Search Home Home

Help File Library: Getting USB and Your Printer Working


Written By: Sterling

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 Help File 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 Help File 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 Help File. 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.

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 Help File

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

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


internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
internet.commerce
Be a Commerce Partner
Find Project Software
Auto Insurance Quote
Desktop Computers
Car Donations
Shop Online
Promotional Items
Boat Donations
Find Software
Imprinted Promotions
Promotional Products




JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM eBook: Planning a Service Oriented Architecture
IBM eBook: Choosing the Right Architecture--What It Means for You and Your Business
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Avaya Article: Using Intelligent Presence to Create Smarter Business Applications
Intel Go Parallel Article: Getting Started with TBB on Windows
Microsoft Article: 7.0, Microsoft's Lucky Version?
Avaya Article: How to Feed Data into the Avaya Event Processor
IBM Article: Developing a Software Policy for Your Organization
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Intel Go Parallel Article: Intel Threading Tools and OpenMP
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Silverlight 2 App and Walkthrough: Leverage Silverlight 2 with SQL Server and XML
IBM Article: Enterprise Search--Do You Know What's Out There?
HP Demo: StorageWorks EVA4400
Microsoft Article: The Progress and Promise of Deep Zoom
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES