4.1. Hardware configuration.
Linux kernel offers best support for wide range of hardware
compared with other free systems (like *BSD and Hurd).
In this section we are going to discuss many things
regarding hardware, how to configure them for best
performence or power saving ? which to buy ? and other related topics.
Section quotes:
- "Because you want to win benchmarketing exercises, not demonstrate that your
architecture has any value in the real world whatsoever. Because you know
that you can induce people with financial approval to make stupid and
irrational decisions based on irrelevant data."
-- Rodger Donaldson about benchmarking on LKML.
- "The only recomendation is ``dont''."
-- Alan Cox giving some recommendations for binary-only drivers on LKML.
- "The fact that it takes more code to parse and interpret ACPI than it does to
route traffic on the internet backbones should be a hint something is badly
wrong either in ACPI the spec, ACPI the implenentation or both."
-- Alan Cox on LKML.
Section contents:
4.1.1. Intoduction.
Linux kernel (more than 4x106 line of C code) has the ability to deal
with many types of hardware without the need to install any external driver,
for example it could handle many types of NICs (ie. Ethernet cards), and to save
memory kernel split some drivers on files called modules, a run-time loadable
part of the kernel, so only needed modules are loaded and running, you could
use 'modprobe' to add a module by hand see '4.3. Linux under microscope.' section.
The only thing you have to do is to tell the application what device (eg. '/dev/eth0')
to use and how, on the other hand XFree86 could handle many types of graphic
cards without getting external driver just by specifying the type of the card
and other settings.
Linux distribution installer could handle all types of configurations,
you may want to change some options, or reconfigure them because
you have changed a card, many distributions provide
detecting and configuration tools at next boot or on demand,
all you have to do is to reply with Okay and accept default smart
guess, this section will help you to know what those tools are talking about,
and to be able to do custom configuration , or even doing configuration
with your own hand (have you dreamed to make your own distribution?) .
A screenshot of Mandrake Control Center 'mcc'
4.1.2. Video adapter/card.
You have to distinguish between video card (video adapter)
and monitor (screen), video adapter is an internal card that
send video signals to the monitor, the monitor on the other hand
is the device that display them, it could be a usual CRT screen or
flat thin LCD screen. The most important thing about the video card
is it's chipset and model name/number for example a card chipset from
nVidia and it's model is TNT2. A model differ from another
is having better real hardware acceleration for 2D and 3D operations,
Two card from the same model could differ in the size of it's memory,
more memory provide better resolution and color depth.
Monitor most importent feature is the refresh rate at some high resolution,
in specific we care about higher vertical refresh rate
it should be larger than 72 Hz, sometimes called FPS (frame per second),
this rate differ from one resolution to another, if you ask for a high
refresh rate that the monitor could accept then X will not work,
it will exit with error and logs the problem, but if you have old
an monitor that could not tell if it can or can't then the commmon case
is that the monitor seems to be off (and may display "high frequency" or it's power led flashes,...etc)
or the worst case (a monitor from Jurassic ages) this could damage
the synchronize circuit. The monitor should support the resolution
required by the card in other words if you have a recent card sending
hgh resolution signals that you old monitor could not handle you will
see image but it will be segmented and interferenced.
There is no way but trying, guess a resolution and a color depth
that both card and monitor supports.
If want to buy a new card make sure that it's XFree86 driver
support all kines of 3D acceleration needed by games.
At the time I wrote this, the following cards do
ATI Rage128, ATI Radeon,
Matrox Mill, the no more availiable Voodoo3 card,
and some Intel cards like Intel i810 i830 i845 i85x and i865.
For old ATI visit 'http://gatos.sourceforge.net'.
Cards by nVidia like TNT and GForce have very nice fast
3D graphics but not with the XFree86 driver but you have to download
a closed source driver from nVidia.com, using this driver you will
get very high speed but the size of the file is about 7MB
and nVidia keep developing it (it update it to support kernel 2.6)
but they are not helping XFree86 nor provide the code, this put you under
their mercy special when you thing of using projects like DirectFB.
On the other hand S3 and SiS have very poor performance and
there is no open nor closed driver for them which makes XFree86 guessing.
In all cases we are talking about video card chipset not vendor,
for example Herculees cards could be based on S3 chipset
(see 'www.powervr.com' it may help you), and AOpen mostly uses SiS and sometimes nVidia.
Tip
To activate the TV Out Support on some ATI cards install 'atitvout' package.
The installation program will do it right
(not really, RedHat Linux 7.3 and before won't do that),
but let's suppose that you change the card itself, now when you turn on the
computer (and boot Linux on runlevel 5) then X will not work, some distributions
try and try ... with no use and others could handle it and ask you to fix the
configuration before it retry, to solve this problem you could start Linux
at runlevel without X (first or second) for example at LILO prompt
(the bootloader that gives you menu to boot Linux or Windows) type
'linux 2' (to exit the graphical menu and get prompt you could press TAB or CTRL+X),
if you are using GRUB put the cursor on Linux then press 'a' to append kernel parameters
then SPACE then runlevel number '2' then ENTER then press 'b' to boot.
In both cases you will get Linux as in command line mode, if you are in
multi-user mode (runlevel 2) type 'root' as login name then type root password, now
goto the folder '/etc/X11/' by typing 'cd /etc/X11'
then backup the configuration file that is
'XF86Config-4' or XF86Config and with distributions
that uses X.org (another X implementation) it will be 'xorg.conf'
(you could see X logs found on the folder '/var/log' it will tell you which configuration it uses),
you could name the backup copy with your old card name for example:
XF86Config-4.S3 XF86Config-4.SiS XF86Config-4.ATI and XF86Config-4.nVidia,
so you could use it when you put back the old card.
Tip
We will assume that X configuration is saved on '/etc/X11/XF86Config-4',
replace it with yours, the X implementation,it's configuration filename and it's format
changes! (that's why we call X the Linux virus!!), useful information
could be found at your distribution 'REALEASE-NOTES' at the first CD.
you could use 'lspci' which will show all PCI cards (including AGP)
your video card usually will be one of them, you could search using 'grep'
bash$ lspci | grep -i 'vga'
this will tell you your video type.
Tip
You could enhance the performance by installing a package called 'powertweak'
which tunes PCI devices (not just video crads) to use
optimal settings and enables performance enhancing features of the CPU(s).
It includes 'powertweakd', 'powertweak-extra' and 'powertweak-gtk'.
After you know the type of the card, you could run any configuration
tool like
- Xconfigurator (from RedHat Linux before 8.0, common with other distributions)
- redhat-config-xfree86 (found on RedHat Linux 8.0 and more)
- system-config-display (the new name of the previous RedHat tool, found on Fedora)
- XFdrake (the Mandrake utility, found at Mandrake Control Center 'mcc')
- dexconf (the script used by Debian 'dpkg-reconfigure')
- xdebconfigurator (infamous Debian tool, unlike the pervious one, it could work in non-interactive mode and do every thing automatically)
- SaX (used with SuSE, a tcl/tk script)
- XF86Setup (a program from XFree86 that uses a generic configuration
then show many GUI dialog boxes to do the configurations)
- XFree86 -configure (the XFree86 server do the check itself and generate
a configuration file and save it as '~/XF86Config.new'
you could use it as a starting point)
- xf86config a console that asks too many as a numbered list to pick one
by entering the number (NOT RECOMMENDED), it can't detect any thing.
avoid the last three methods, to best way is to use your distribution
utilities,for example, Debian users could use package reconfiguration like this:
bash# dpkg-reconfigure --priority=low xserver-common xserver-xfree86
You also could do configuration by hand for example
set resolution and color depth like this (part of 'XF86Config-4')
...
Section "Screen"
Identifier "Screen1"
DefaultDepth 16
...
Subsection Depth 16
Modes "1024x768" "800x600" "640x480"
End Subsection
...
End Section
...
we are still on non-X runlevel, now to test our new X configuration
use 'Xtest' or 'XFree86 -xf86config ./XF86Config-4
(if it works with XFree86 press CTRL+ALT+BKSP to exit)
if there is something wrong read the log file '/var/log/XFree86.0.log',
if every thing is fine type as root 'gdm','kdm' or even 'xdm',
or as regular user type 'startx', this is a complete session:
# type those commands
bash# man XF86Config
bash# cd /etc/X11
bash# cp XF86Config-4 XF86C-ATI
# that will save a backup copy of the configurations
bash# XFree86 -configure
bash# cp ~/XF86Config.new XF86Config-4
# use any console text editor like 'mcedit', 'nano', 'vim'...
# I'll pick 'mcedit'
bash# mcedit XF86Config-4
# search (press F7 ) for 'DefaultDepth'
# edit, save and exit, then test
bash# Xtest
bash# gdm
If you could not configure it properly use 'xf86config' and when it asks about
the card driver select 'vesa' (a generic slow standard),
it will be useful to read you card specific documentation
that comes with XFree86 package, there are some options could make it run
(eg. disable a buggy feature or hardware acceleration).
If you fail and you want to get the old configuration (the one we have saved it):
bash# cd /etc/X11
bash# cp XF86C-old XF86Config-4
If your X servers starts with no errors and running
but you still can't see any graphical output no matter how long you wait,
it seems that it hangs but you could move to any pseudo terminal (by CTRL+ALT+F1)
then you may have more than one video card, for example on could be built-in
and the other is on an AGP slot, the problem could be because X sends
output to a card other than the one connected to the monitor,
you should select the card using it's PCI BusID number in "Device"
section of vedio card at the X configuration file 'XF86Config-4',
like this:
Section "Device"
#...
BusID "PCI:1:0:0"
#...
End Section
You could get the BusID number from 'lspci' output
(replacing dots '.' with colons ':'), the following output is for a computer
having two cards: Intel 82815 CGC and SiS630 the previous configuration
is to use the second one.
bash# lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corp. 82815 CGC [Chipset Graphics Controller] (rev 02)
01:00.0 VGA compatible controller: Silicon Integrated Systems [SiS] SiS630 GUI Accelerator+3D (rev 31)
Also if your X server exit with errors (or enter infinite loop)
and the log file says that it can't find the specified video card
then someone or something have specified wrong BusID, edit the configuration
file and set it to correct one or if you have only one graphic adapter
comment the BusID line.
If you notice poor performance with some 3D games (eg. TuxRacer),
that's because they use OpenGL, there are two types of it: software and hardware
accelerated, if it's too slow then you use the first! to make sure type:
bash$ glxinfo
bash$ glxinfo | grep direct
if it prints 'no' then you are using software functions.
To test the speed of OpenGL functions on your card type 'glxgears'
on an X terminal, you should see three rotating gears, and notice the framerate information
on the terminal.
If you have a video card with nVidia chipset then you could
get 'nvidia' hardware accelerated OpenGL (GLX) driver from wwww.nvidia.com
it's better than 'nv' driver that comes with XFree86, you have to download
a file named NVIDIA-Linux-x86-VER-BUILD-pkgN.run,
then read the README.txt file
(visit www.nVidia.com for the latest driver),
put the file at your home and make sure kernel development packages
are installed like kernel-headers or kernel-source,
make sure that the link /usr/src/linux points
to the kernel source you are using with :
bash# uname -r
bash# ln -sf /usr/src/linux-2.6.7 /usr/src/linux
now jump to a console mode runlevel (close the X server),
with RedHat and Mandrake it's runlevel two or three, to do this type
'/sbin/telinit 2' or 'telinit 3' both as root,
but Debian runlevels 2-5 are running X ! X in Debian is a normal service
stop it like this '/etc/init.d/gdm stop' (it could be 'kdm' or 'xdm'),
after you stop X (no matter which way), be root then goto where you put
nVidia driver,we put it in your home folder (we will assume that your
login name is 'ali'), now run it by typing 'sh ./NVIDIA' then press
TAB to complete the name of the driver file then press ENTER, use arrows to move
to select ACCEPT the agreement then press ENTER after you read it, use your favorite text editor
like 'mcedit' to edit '/etc/X11/XF86Config-4'
then search for 'nv' and replace it with 'nvidia' then go back
to runlevel 5 by typing 'telinit 5' or with Debian
'/etc/init.d/gdm start'. This is a full session:
bash# cd ~ali
bash# sh NVIDIA-Linux-x86-1.0-4496-pkg2.run
# read then accept the agreement
bash# mcedit /etc/X11/XF86Config-4
# press F7 to search for 'Driver "nv"'
# then edit it to be 'Driver "nvidia"'
# press F2 to save
bash# telinit 5
# notice the nVidia logo when the X server starts
bash$ glinfo | grep direct
notice the nVidia logo when the X server is restarted.
4.1.3. Keyboard and Mouse.
Of course, if the kernel does not see the keyboard then there is no way
to fix it. The only case this may heppen if that the keyboard is not plugged!
If you use a USB keyboard make sure that the 'legacy keyboard emulation'
or a like (if any) option is turn on in your BIOS settings.
For local keyboard layouts see section '3.6. Local support.'.
If you have some special keys that do not work in X,
open the X configuration file and search it for 'Section InputDevice'
related to your keyboard (there are one for keyboard and another for mouse)
and specific the right keyboard module like
'Option "XkbModel" "pc105"' (instead of 'pc102' for example).
If your keyboard has extra non-standard keys (called Internet/Multimedia buttons)
you could teach your GNOME or KDE what should each do
(from Control Center or using 'acme' for GNOME)
by pressing the key and selecting a task from a menu (like volume up) or
a program to be launched.
There are some window manager independent daemons for the same task like
'hotkeys' or Linux support for Easy Access and Internet Keyboards
LinEAK ('lineakd' see http://lineak.sf.net).
RedHat provides a tool called 'mouseconfig', it's also shipped with
other distributions, just run it if you have it. The default mouse device
is '/dev/mouse' but it's just a symbolic link to a read mouse device
like:
'/dev/psaux' - for PS/2 mice
'/dev/ttyS0' - serial mouse on first serial port (COM1)
'/dev/input/mice' - USB mouse
to create or update the link use something like:
bash# ln -sf /dev/psaux /dev/mouse
there is a program called General Purpose Mouse daemon (GPM)
it provile a mouse cursor for console applications to copy and paste
selections and interact with menu driven console applications like 'mc',
to use it try at one of the VTs:
bash# gpm -t help
# for serial mice
bash# gpm -m /dev/ttyS0 -t ms
# or for PS/2 mice use
bash# gpm -m /dev/psaux -t ps2
instead calling it by hand, distributions offers services to call it
like '/etc/rc.d/init.d/gpm', make it executable then
edit it (or the configuration file it includes using '.' source command)
to set the type of the mouse.
To configure the mouse for X we edit the same '/etc/X11/XF86Config-4'
configuration file, search it for 'Section InputDevice'
(there are one for keyboard and another for mouse)
edit this section then restart X, there is a trick to
change mouse protocol without restarting X, by telling X to use 'gpm'
and let '/dev/mouse' points to '/dev/gpmdata',
then all you have to do when you want to change the mouse (from serial to PS/2 or vice versa)
is to restart 'gpm', but many documentations do not recommend 'gpm' for X.
Touchpad acts just like a PS/2 mouse, but for some reason there are
configuration tools for them see subsection ' 4.1.11. Power managment and Laptops.' below.
4.1.4. Sound card.
You could use any of those to configure your sounmd card:
- 'sndconfig' - a utility provided by RedHat and shipped with
other distributtions until know (even though that RedHat is no more shipping it after 8.0),
it's very powerful tool that uses old OSS drivers not the new ALSA.
- 'redhat-config-sound' - starting from RedHat Linux 8.0, this tool
forgets to set permissions for sound related device files.
- 'system-config-sound' - the new name for the previous tool (shipped with Fedora)
- SoundDrake - a Mandrake tool, found at Mandrake Control Center.
those tools could detect your card automattically.
What those tools do is just do 'modprobe' to insert modules to kernel.
Tip
With some distributions (specially Fedora) it seems that it did right, it tells
you the name of the card and maybe play a test, XMMS seems to work but you
hear nothing! after some days it works without doing anything,
any way make sure the you have proper pemissions for files
'/dev/dsp*', '/dev/adsp*', '/dev/audio*'
and all those found on '/dev/snd/' using
'chown' and 'chmod'.
you could configure it by hand (NOT RECOMMENDED), first use 'lspci' to tell what card do you have
then use 'modprobe' to add modules to kernel, the following example using OSS
modules:
# for my historical crystal ISA card
modprobe isapnp
modprobe sound
modprobe ad1848
modprobe uart401
# replace cs4232 with sb for SoundBlaster
modprobe cs4232 io=0x534 irq=5 dma=0
modprobe opl3 io=0x388
# for a C-Media PCI card
modprobe cmpci
to configure you sound card using the new Advanced Linux Sound Architecure(ALSA),
a script called 'alsaconfig' could be used, which will use 'modprobe'
to insert other modules having names that start with 'snd-card',
then 'modprobe' 'snd-pcm1-oss' and 'snd-mixer-oss' for OSS compatibility,
you could see information about the currently loaded ALSA module for
sound cards, type:
bash# cat /proc/asound/cards
the following table lists cards and it's ALSA modules from
'Alsa-sound-mini-HOWTO' by Valentijn Sessink:
Gravis UltraSound Extreme: modprobe snd-card-gusextreme
Gravis UltraSound MAX: modprobe snd-card-gusmax
ESS AudioDrive ES-(1)688: modprobe snd-card-audiodrive1688
ESS AudioDrive 18xx: modprobe snd-card-audiodrive18xx
Gravis UltraSound PnP:
Gravis UltraSound PnP, Dynasonic 3-D/Pro, STB Sound Rage 32,
ExpertColor MED3201 and other soundcards based on AMD InterWave(TM)
modprobe snd-card-interwave
UltraSound 32-Pro(TEA6330T)
UltraSound 32-Pro (soundcard from STB used by Compaq) and other
soundcards based on AMD InterWave (tm) chip with TEA6330T circuit
modprobe snd-card-interwave-stb
Soundblaster 1.0,2.0 and pro(8-bit)
modprobe snd-card-sb8
Soundblaster 16 SoundBlaster AWE 32/64 NOT VibraX16
modprobe snd-card-sb16
OAK Mozart: modprobe snd-mozart
OPTi 82C9xx:
Audio 16 Pro EPC-SOUN9301 (82C930 based), ExpertColor MED-3931 v2.0 (82C931
based), ExpertMedia Sound 16 MED-1600 (82C928 based - AD1848), Mozart
S601206-G (OPTI601 based - CS4231) and Sound Player S-928
modprobe snd-card-opti9xx
AD1847/48 and CS4248 : modprobe snd-card-ad1848
Yamaha OPL3-SA2/SA3 soundcards: (NO autoprobing)
modprobe snd-card-opl3sa snd_port=0xNNN \
snd_wss_port=0x530 snd_midi_port=-1 snd_fm_port=0x388\
snd_irq=5 snd_dma1=0 snd_dma1_size=NN snd_dma2=1 snd_dma2_size=NN
S3 SonicVibes(PINE Schubert 32 PCI):
modprobe snd-card-sonicvibes
Ensoniq(ES1370/1371)/Soundblaster PCI64:
modprobe snd-card-audiopci
CS4231:(NO auto-probing)
modprobe snd-card-cs4231 snd_port=0x534\
snd_mpu_port=-1 snd_irq=5 snd_dma1=0 snd_dma1_size=NN\
snd_dma2=1 snd_dma2_size=NN
CS4232/4232A:(NO auto-probing)
modprobe snd-card-cs4232 snd_port=0x534\
snd_cport=0x120 snd_mpu_port=-1 snd_fm_port=0x388\
snd_jport=-1 snd_irq=5 snd_dma1=0 snd_dma1_size=NN\
snd_dma2=1 snd_dma2_size=NN
CS4235 and higher: CS4235/CS4236/CS4236B/CS4237B/CS4238B/CS4239 chips
modprobe snd-card-cs4236 snd_port=0x534\
snd_cport=0x120 snd_mpu_port=-1 snd_fm_port=0x388 snd_jport=-1\
snd_irq=5 snd_dma1=0 snd_dma1_size=NN snd_dma2=1 snd_dma2_size=NN
CS4610/4612/4615 and 4680: modprobe snd-card-cs461x
ESS Solo 1(128iPCI,es1938): modprobe snd-card-esssolo1
Trident 4DWave DX/NX:
Best Union Miss Melody 4DWave PCI, HIS 4DWave PCI, Warpspeed
ONSpeed 4DWave PCI, AzTech PCI 64-Q3D, Addonics SV 750, CHIC True
Sound 4Dwave, Shark Predator4D-PCI, Jaton SonicWave 4D.
modprobe snd-card-trident
ForteMedia FM801: modprobe snd-card-fm801
To configure non-pnp ISA cards found on museum
you should read BootPrompt-HowTO by Paul Gortmaker.
4.1.5. Printers.
Linux is a very powerful system, thanks to Common Unix Printing System (CUPS) from
Easy Software Products (www.easysw.com), Foomatic from LinuxPrinting.org and other
free software projects, Linux now could print postsript files
on non-postscript printers and drive them with PPD files!
It could access to a remote printer shared on a Windows/Samba network
and automatically gets it's driver. Linux could act as a printing server
for Windows clients even for a printer that is not supported on Linux!
What does all that suppose to mean ?
You can live with just installing CUPS and foomatic and use GUI
tools like your distribution specific tools and KDE Print
http://printing.kde.org
which could be configured from KDE Control Center, also it supports most spoolers
(eg. CUPS and LPD) and the dialog let you preview pages before you print
through KGhostView (or other PS viewers) and provide some virtual
printers (like email,fax and PDF virtual printers), if you like
it, you could use it even with non-KDE applications by specifying kprinter
as the printing command (instead of 'lpr'), there are other GUIs
for 'lpr' (like the GTK+ based 'gpr' and 'xpp' from CUPS
which used FLTK GUI) but they are not common.
Let's first take a tour in histroy of printing.
Printers produce their output in many several ways.
Line printers (Dot matrix printers) use pins that hit ink ribbon.
Inkjet printers spray the ink into the paper (although the ink in the cartridge could be a dry ink),
Laser printers work like photo copy machines, a laser beam charges areas
of optical sensitive layer on the drummer to
create an image of the whole page that attract toner then
the page image is rolled into paper at once! that's why they are too fast,
the last step is to wiped out the image on drummer.
| \ | device cost | cost per page (eg. ink) | quality | other features |
| Dot Matrix | very cheap | cheap | poor | forms and continous paper |
| Inkjets | relatively cheap | very expensive | good | - |
| Laser | expensive | relatively cheap | best | heavy duty and fast |
Color printing is achieved by using at least 3 colors CYM (not RGB),
most printers add a fourth black (K) color (instead of mixing other colors
to get black) to reduce the cost, a few printers use 6 or 7 colors (CYMKcmy),
to know how to convert CYMK to RGB and vice versa see section 8.5 Introduction to 2D Graphics..
The printed output is composed of small points, the more points (in an inch)
the better, points per inch (PPI) is used to measure quality, one point
need not be a single dot of ink, for example to form a single
point of 50% gray, you need some balck dots (with gaps), this mean
there are more dots than points (DPI > PPI).
First printers were intended to print text, so instead of drawing text
dot by dot or visiting the same character many times (on each time printing
a raw of the glyph dots), a font is loaded into the printer memory (or built in it's ROM)
a courage moving from left to right having 8-24 vertical pins (as the height of the fonts)
so it could print a whole line with one trip from left to right
(that's why they are called line printers).
Line feed (LF, hex 0x0A, dec 10) moves a line downward, courage return (CR, hex 0x0D, dec 13)
back to column 0, the sequence (LF) (CR) skips the rest of the line and jump to the next line.
Poor graphics could be printed on line printers by controling the pins
instead of using the loaded font to control them.
Linux kernel could handle many types of printers, the device
'/dev/lp' is linked to the actual printer device (the 'lp' name back to the age of line printers)
which could be '/dev/lp0' (for the one pluged into
the first parallel port), or could be '/dev/usr/lp0' (if it's the first USB printer).
Usually the kernel modules needed to access those devices are
loaded by default. If you have enough privileges (member of the group owning the device)
you could send the text file directely to the device, but if the printer
expects LF (a Unix text file having lines ending with just CR), you could
pass it to 'unix2dos', and to make the text file looks nicer use 'pr'
with something like 'pr -l70 -h "This is myfile." myfile | unix2dox > /dev/lp',
here 'pr' justifies it's output for 70 column and adds the comment "This is myfile."
in the header of each page, those are very simple filters, keep that word in mind.
Direct access to printers is not a good idea, what if the printer is used ?
what if two users want it at the same time ? what if I have 10 files to be printed
each of 30 page, should I print them one by one, waiting the previous job to end!
and who on earth wants to print plain texts in a fixed width font!
Here it comes the rule of printing spooler system like CUPS, LPRng, LPD, GNU lpr, PPR and PDQ.
Usually you have a document written in a format
regardless of the type of the printer you use (eg. html, pdf, dvi,...etc),
the spooler has a set of filters to transform it internally to any
device independent format that the driver could feed it to that
specific printers, some printers could handle complex formats others
expect it to be rendered (to a bitmap) by software (driver/filter),
the driver use another filter convert it to your specific printer commands.
The file to be printed waits it's turn in the
queue, the spooler saves a copy of it somewhere like '/var/spool/lpd/myprinter/',
so the application could continue it's job normally, and offer a tool to manage the queue.
Many decades ago Adobe invented PostScript format, which is a programming
language for both graphics,fonts and complex texts, it's was very popular from
the early days of desktop publishing on MacIntosh. Because it was an open
specifications, most Unix tools and free software could generate
output in PS format, the aim of PS as a device independent format
is to be a portable interchange format that could be printed everywhere
(for example fonts could be embedded in the same file). PS was not popular
on Windows, later Adobe adds some features to it like compression and
hyperlinks the result was a new format called PDF which is popular
on all platforms specially for e-books.
There are many printers (usually expensive laser printers) that could
handle the PS formats directly in the firmware, they have a CPU
in order to interprete it, they give you very high quality and speed,
the driver of those printers are distributed as
Postscript Printer Definition (PPD file), this file specifies the commands
needed to feed the printer with a Postscript file.
Other printers (called non-Postscript printers) relays on software
called Raster Image Processor (RIP) that render the input
into a standard format like PCL or a proprietary format (may God help you!),
rendered data is usually larger thus need more time to be transmitted,
and the rendering process requires CPU time and consumes memory,
this is called host-based PostScript printing, a program called
Ghostscript 'gs' provide this functionality on Linux.
We have three implementations of Ghostscript, the GNU GPLed version
(the usual most common) and the Easy Software Products (www.easysw.com the origin of CUPS)
and the non-free Aladdin version (available for free only for personal usage),
they are called in Debian 'gs-gpl', 'gs-esp' and 'gs-afpl'.
Warning
Postscript is a real programming language that could be risky (even though it's
a script of text) so when you use 'gs' pass '-dSAFER' argument to disable file
access trials.
Line Printing Daemon (LPD) was one of the first spoolers,
the daemon runs the background waits for jobs, printers are
configured using printer capabilities file
'/etc/printcap' which lists printer devices,
names, spooler queue directory (a subdirectory of '/var/spool/lpd/'),
maximum limit on it's size and specifies a filter (like apsfilter or magicfilter).
The file '/etc/hosts.lpd' lists hosts allowed to print remotely.
There are two LPD command sets the BSD style and the System V style,
BSD styled commands (most common on Linux) are 'lpr' (to print),
'lpq' (to display queue), 'lprm' (to remove a job)
and 'lpc' (to control the queue, eg. pause a job).
The System V styled commands are 'lp' (to print), lpstat (to display queue)
and cancel (to remove a job).
We will discuss BSD styled commands, pass the file name to 'lpr'
as an argument or pipe it's contents, for example
to print the text file 'myfile.txt' and the compressed text file 'COPYING.gz',
one could use:
bash$ lpr myfile.txt
bash$ zcat COPYING.gz | lpr
if you have the right filter installed, just pass the file name,
for example 'apsfilter' supports (with the help of external programs like
html2ps, pdf2ps, dvips,...etc.):
gzip, bzip2, compress, freeze, pack,
ASCII, BMP, data (PCL, etc.), DVI, FBM, FIG, FITS, GIF, Group 3 fax,
HTML, IFF ILBM, JPEG, Kodak Photo CD, MGR, MIFF, PBM/PGM/PNM/PPM, PDF,
PNG, PostScript, RLE, SGI, Sketch, Sun raster, Targa, TIFF, troff, WPG,
X pixmap and XCF, in this case there is no need to decompress the file
'COPYING.GZ' with 'zcat'. One could use something like
bash$ lpr -#3 article.html
bash$ lpr -P laserjet -s mybook.pdf
to print 3 copies of 'article.html' on the default printer
and a copy of 'mybook.pdf' on a printer named 'laserjet',
and instead of copying it to the spooler directory just put a symbolic link
(because of the '-s' option, which saves a lot of space).
If you changed your mind about 'mybook.pdf' and you want to cancel that job,
type ' lprm -' which removes the last queued job,
to remove a specific job pass it's number to 'lprm',
to know it type 'lpq', which displays
the printer status, jobs in the queue and the status of each.
Nowadays most distributions replaced LPD with a new spooler called CUPS,
it's more easy to configure, supports more printers,
and could work as a server or client for
Internet Printing Protocol (IPP) beside ethernet socket printers,
remote LPD Unix printing and Mirosoft/Samba shared printers.
The good news that you don't have to learn much, CUPS supports
both BSD styled commands (eg. 'lpr') and System V styled commands (eg. 'lp'),
just activate this service on some runlevel using your distribution GUI or console tools
(eg. 'chkconfig --level 2345 cups on' then 'service cups start')
You could configure your printers using your distribution tools, the CUPS command line tool 'lpadmin',
CUPS web interface using your browser, or less likely by editing '/etc/cups/cupsd.conf'
which has a format similar to Apache configuration file.
To enable CUPS web administration tool (it's safely running behind 'xinetd')
edit '/etc/xinetd.d/cups-lpd' to have the line
'disable = no' then open any web browser
('mozilla', 'epiphany', 'konquror' or even 'links')
then goto the address 'http://localhost:631'
then interact and follow the instructions, this page is only visible to local host (127.0.0.1)
by default, see 5.3.8. subsection of Setting up servers section..
|

|
You could manage CUPS system from command line using
'lpadmin' for example to add a parallel printer and call it 'MyPrinter'
and make it the default printer (-d option) use something like this:
bash# lpadmin -p MyPrinter -v parallel:/dev/lp0 -P /PATH/DRIVER.ppd
bash# /usr/bin/enable MyPrinter
bash# /usr/sbin/accept MyPrinter
bash# lpadmin -d MyPrinter
to add a shared printer found on a remote Samba(or Microsoft) network
and call it HisPrinter and make it the default, use:
bash# lpaddin -p HisPrinter -v smb://myname:mypass@WINNT/INKJET -P /PATH/DRIVER.ppd
bash# /usr/bin/enable HisPrinter
bash# /usr/sbin/accept HisPrinter
bash# lpadmin -d HisPrinter
note that you don't need to have the PPD, Samba download it for you.
Be aware that the password will be shown on 'ps' command.
refere to 5.2.3. subsection of ' 5.2. Working in networks.' section,
to know how to find shared items in a Samba network using 'smbclient'.
Free drivers shipped with CUPS are simple generic drivers and you
need better drivers for professional printing. Thank God, professional
optimized photo-quality drivers from www.LinuxPrinting.org
are shipped as packages with most distributions, it's called 'foomatic'
(see www.linuxprinting.org/foomatic.html),
it also offers support for larger number of printers (visit 'www.LinuxPrinting.org' to check a list of supported printers)
and PPD files are used to drive all priners (even non-Postscript printers),
'foomatic' comes with a smart filter called 'foomatic-rip'
that works for all kinds of spoolers.
There is a GUI tool in another package called
'foomatic-gui' a GNOME based application to setup your printers.
More photo-quality PPD drivers could be found on Gimp Print packages.
Besides LinuxPrinting.org drivers and tools you could find some
tools and drivers from your printer vendor,
If you have a Postscript printer you could take the PPD file from
the Windows driver (it could found on the CD that come with the printer)
or from Adobe www.adobe.com/products/printerdrivers/winppd.html.
Hewlett-Packard (HP) printers are very common and they offer good support,
you may check related resources like
'http://hp.sf.net',
'http://hpinkjet.sf.net'
(in Debian there is a package called 'hpijs'), and
'http://hpoj.sf.net'
the last one provides support(tools and drivers) for most "all-in-one" peripherals
like OfficeJet, LaserJet, Printer/Scanner/Copier ("PSC"), and PhotoSmart printer products
(in Debian they put the GUI tool to display 'hpoj' LCD panel in another package called 'hpoj-xojpanel').
If you want to buy a new printer make sure to visit the
Linux Printing site before you buy, no matter from which vendor,
for example HP offers good help to open source developers, but there are
some models of HP printers that does not work in Linux!
check the database of supported printers and the state of the support at
www.linuxprinting.org/database.html.
Most home users buy an Inkjet printer then all what they print is less than
a dozen of pages per year, because about 3 ink cartridge
replacements costs the same as a new printer!! most Inkjets are cheap
but the cost per paper is very high, this is not bad for home users
who want to have a cheap high quality colored printer
(although they could generate a PDF file, put it on a floppy or a flash memory
then print it on any computer services store having a mono laser printer).
For real work usually you don't need colors (bills, forms, reports,...etc),
you need a long lasting heavy duty printer that produce more pages in a
short time, and low cost per page,
black and white laser printers are the first choice fort this task.
Some companies still use dot matrix printers,
this is the choice for poor line printing of text in a single fixed width font
but they are cheap (both the printer and the cost per page) and could print
on forms of continous paper, although some Laser printer could do that!
If you want an advice visit www.linuxprinting.org/suggested.html,
to support the future of printing in Linux,
buy from vendors that contribute to Linux printing
listed at www.linuxprinting.org/affiliate.html.
References:
- Debian and Windows Shared Printing mini-HOWTO
- The Linux Printing HOWTO
- The Linux Printing Usage HOWTO
- The Linux Print2Win mini-HOWTO
4.1.6. Scanner.
All you have to do is to tell programs that use the scanner (eg. 'xsane' and 'gimp')
which device to use (eg. /dev/usb/scanner0),
you could link /dev/scanner to point to the real scanner device.
4.1.7. Digital cameras and video capturing.
Digital still cameras could be treated using usual media
mounting using 'mount' command (as a SCSI disk, see devices list below), or through specific programs
like 'gtkam' or 'kamera'.
TV tuners, web cameras or any type of motion-picture-capturing (video capturing)
can be accessed through a unified interface called Video4Linux (V4L) provided by Linux kernel (as modules),
there are many applications that use Video4Linux mainly 'xawtv' or 'tvtime' (tvtime.net)
all you have to do is to configure them to use the right device (see devices list below)
throught the GUI or through 'v4l-conf' package (and may be through your distribution specific tools, as in Mandrake).
There are some applications designed specially for web cameras
the best example is 'gnomemeeting', a network video conference application
see 2.6.4. Interactive Internet. subsection.
Many years ago people started to watch TVs in color!
have you ever thought to watch your TV in ASCII Art text!!
a package called 'ttv' uses 'aalib' to show the motion picture
on your 'tty' console. If you don't have X and you still want to watch
it in real colors, you could use 'fbtv' that uses Linux Frame Buffer instead of X11.
There are many more packages related to Video4Linux found on my Debian:
- 'came' a rewrite of the 'xawtv' webcam app using 'imlib2'.
- 'scantv' scan TV channels for all stations at once and
write them into 'xawtv' configuration file (and others)
- 'libdscaler' a Video deinterlacer plugins for 'tvtime' using DScaler DLLs loaded by Wine
- 'kvdr' DVB (digital TV) Video Disk Recorder for KDE
- 'wmtv' Dockable Video4Linux TV player for WindowMaker and alike.
- 'camorama' a small GNOME2 utility to view, alter and save images from a Video4Linux device (including webcams).
- 'vgrabbj' a command line tool to grab a image from a Video4Linux device and save it in JPEG/PNG format.
- 'camstream' a nice QT GUI for Video4Linux that support Webcamming, Video conferencing, Recording movie clips (AVI, Quicktime)
and Using a webcam as a security camera, it could be found on 'www.smcc.demon.nl/camstream'.
- 'motion' V4L Capture Program supporting Movement Detection, MPEG output and webcams (may be used for secrity).
- 'webcam' capture images from a Video4Linux device and upload them to web server using FTP or SSH.
- 'camserv' takes a video-for-linux video stream, generally from a camera, and
streams it out live to requesting clients (web browsers)
If you are interested in recording captured images into video file
see Multimedia and graphic design sections.
4.1.8. Network adapter and Modems.
If your computers is connected to a LAN it's usually uses Ethernet cards,
the device for the first Ethernet cards is '/dev/eth0'
to tell more use something like:
bash# dmesg | grep eth
bash# lspci -v | grep eth
see section ' 5.2. Working in networks.'
for details. If you are using a Dialup connection (usual phone lines)
then you are using a modem device with 'ppp+' interface (point to point protocol).
If you have a ISDN subscription a special phone line that offer higher speed
and receive incoming calls while you are connecting to the internet,
it uses a protocol called 'ippp+'.
Another type of WAN lines is xDSL (ADSL, IDSL or SDSL),
they use a PPPoE protocol (Point to Point Protocol over Ethernet)
(it could be passed to programs as usual 'ppp+' interface)
and sometimes it uses DHCP accoding to your ISP.
Back to modems, if you are using a real serial modem (an external serial modem)
then you need no driver just point to the modem driver for example:
bash# ln -sf /dev/ttyS0 /dev/modem
'ttyS0' is the first serial port (called COM1 in Windows),
replace it with the proper one, for example in some cases COM1 is used by mouse
so the modem could be pluged to COM3 this mean ' /dev/ttyS2'.
This also apply to the few real internal modems like
IBM 33L4618 or any modem having real Universal Asynchronous Receiver Transmitter
(UART) like those modems:
Lucent Venus chipset:
Multitech MT5634ZPX-PCI,
Zoom 2920 (Digitan DS550-558),
Actiontec PCI56012 (IBM 33L4618 or GVC MD0223)
USR/TI Kermit chipset:
the 3Com/USR 3CP5610 family, which includes models 5613, 5609, and OEM models 2976, 2977, and 3258
TOPIC TP560i chipset:
Well Communications FM-56PCI-TP (GVC MD0321), and
Archtek Smartlink 5634PCV.
Conexant RC56D-PCI chipset:
none observed yet ???!
If you have a 'winmodem','softmodem' (like most internal modems) or a modem without HCF controller
(called controllerless, like most external USB modems), those are fake modems
you have to get the driver from the chipset maker, you could know what internal
pci modem you have by using ' lspci | grep -i modem',
when you now visit the company you read it's name.
bash$ lspci -vv | grep -i 'modem'
if you have MS Windows and the modem works there properly you could tell
it's name from control panel. When you know the chipset name, you could
download a binary driver the match you kernel version, but you had better
get it as source code and compile it yourself
(to do that you need the source code of the kernel you are using),
Conexant (previously known as Rockwell) both HSF and HCF
are very widely used fake modems (at the time of writing this section)
but Conexant does NOT offer any Linux drivers for them, instead another
company offer those drivers for Linux, visit their sitte at ' www.linuxant.com',
it offer full-featured commercial drivers (you have to pay) or an evolutionary
half-open source drivers for free (it lakes some features like fax and work
at less than the maximum speed), there are full speed beta driver that could
be found on the internet at http://naboo.homelinux.org/~daniel/download/hsf_hcf_riptide-beta/
, if you don't like this (having to pay twice, once for the modem, then for the driver)
complain to the modem vendor not to chipset maker (Conexant)
Warning
If you are buying a new modem make it an external serial (not USB) modem,
most internal modems are fake, even if there are a full-featured open source
driver that make it work, it still a fake modem, it's driver
(on any OS) uses your CPU and RAM to do what the modem missing controller
chip should do, also you can't be sure that the driver will be updated with
all kernels in future. If you can't afford an external serial modem
at least buy a real internal modem (with real controller chip) and in worst
cases a fake modem but with open source free driver like IBM ACP-mwave
(the driver is called 'mwavem' in Debian)
You should avoid fake modems that have closed source drivers or half-open source
drivers, any fake modem makes you computer 25% slower and it's not always cheaper.
let's assume you get the free (as price) version of the driver from
' www.linuxant.com'
and downloaded the source tarball
hsfmodem-X.XX.XXlnxtXXXXXXXXfree.tar.gz
or
hcfpcimodem-X.XXlnxtXXXXXXXXfree.tar.gz
(the first is for HSF like most Conexant internal modems and the other HCF is usually for external USB modems),
put it at your home and do the following:
bash$ su -
bash# cd ~ali # goto the home folder of the user having the drivers
bash# pwd
/home/ali
bash# tar -xvzf hsfmodem-X.XX.XXlnxtXXXXXXXXfree.tar.gz # use TAB to type the filename
bash# make install
bash# hsfconfig --help
bash# hsfconfig
bash# hsfconfig --region # select your counrty code.
bash# cd /dev
bash# ln -sf ttySHSF0 modem
bash# ls -l ttySHSF0 # see permissions
bash# chmod 777 ttySHSF0 # insecure! allow everybody to use it
bash# exit
bash$ hsfconfig
bash$ hsfconfig --region
this example is for HSF Conexant modems replace
'hsfconfig' with
'hcfpciconfig' or
'hcfusbconfig'
and replace the device '/dev/ttySHSF0' with
'/dev/ttySHCF0' or '/dev/ttySHCFUSB0'.
You could get generic RPM package (it's a source package that build itself)
named 'hsfmodem-VER.rpm.zip'
or 'hcfmodem-VER.rpm.zip'
they are installed easily, put them at your home folder and do:
bash$ su -
bash# cd ~ali # goto where you put the driver
bash# pwd
/home/ali
bash# unzip hsf*.zip # also you could press TAB
bash# rpm -Uvh hsf*.rpm # also you could press TAB
bash# cd /dev
bash# ln -sf ttySHSF0 modem
bash# ls -l ttySHSF0 # look at the permissions
bash# chmod 777 ttySHSF0 # allow every body to use it.
bash# hsfconfig --region # select your country code
bash# exit
bash$ hsfconfig
bash$ hsfconfig --region
Another fake modem that had been used widely is Motorola SM56,
Motorola had stoped producing it,selling it and supporting it
but it did not release the source code of it's old Linux driver so that
Linux community do it's job, the latest and last driver from it
was for RedHat Linux 7.1 (in other words Linux kernel 2.4.5, I'm not sure),
the first method to use this modem is to install that old kernel
(from source or from package repositories) then install that driver,
a better solution is to download a new driver found at
'www.sm56.tk'
this site lists files for different GCC versions (rrecent distibutions uses GCC version 3.x)
after you extract it issue 'make install'
then set the proper permissions for the device file '/dev/sm56'.
Please note that you should give the specific modem device proper permissions
and owned by proper user and group, issue 'ls -l /dev/ttyS0'
to see what your distribution did with the first serial port so you could
do something like it, you could create a group called 'modem'
and let it the group of the device file then allow reading and writing
for members, then when you want any user to be allowed to dialup the modem
add him to this group.
There are some fake modems having open source drivers like 'IBM ACP-mwave',
but most fame modems have a closed binary only driver of half-open drivers
(they say that drivers contain top-secret confidential hardware specification!
or it need extra cost) this is very annoying but it's changing, people
now know that they are fake.
If you are using Mandrake, after you install the drivers (if needed, ie. having a fake modem)
goto Mandrake Control Center and select Networks then Connection
then select auto detect then select normal modem and enter the device
to be '/dev/modem' (the is better than something like '/dev/ttyS2'),
follow the wizard then try to connect.
When every thing is Okay use 'kppp' or 'gnome-ppp' to dialup your ISP,
set them to use the device '/dev/modem'.
If it fails, try running them as root if it succeed then it must be permission problem,
use 'chmod' and 'chown' to fix it.
The following links could be useful regarding softmodems.
4.1.9. Storage media.
Storage media are two types fixed and removable, we handle
it with 'mount' that will map (mount or load)
the content of the media (ie. a file system) to a folder in the Linux
root file system, in specific to an empty folder (if it's not empty it's content
will be hidden until it's umounted), but in fact the content of the folder
is not change and there is no copying it's just a virtual process, this folder
usually is a sub folder of '/mnt', in other words we create
an empty folder there then tell Linux kernel to let me access to some device
file system there using 'mount', each and every change
to any file there will be writtten to the device. Mount syntax is like
mount [-t FS_TYPE] [-o OPTIONS] DEVICE MOUNT_POINT
where DEVICE is the device file for example ' /dev/fd0'
for first floppy, see appendix in this section and examples,
MOUNT_POINT is the folder name that device is mapped to,
FS_TYPE is the type of the file system found on the device, it could be one of
th e following ' ext3, ext2, reiserfs, vfat, ntfs ...',
you could use 'auto' as FS_TYPE if you don't know or don't want to specify it,
in this case the kernel will try them one by one as found on
' /etc/filesystems' or if it does not exist it use the file
' /proc/filesystems' (for example, it's good to put 'vfat' before 'msdos' in the first file)
and OPTIONS are some extra options like
'ro' to mount it for read only, 'rw' for read and write,
many other options like ' remount,loop,umask=VALUE,noauto,users...'
see 'mount' manual page.
When you are done with the device (in specific removable media) you
could unmount it, the kernel will finish all writing process and flush
all related buffers
(modern operating systems like Linux schedule some slow tasks
to be done later so that the system runs smoothly, if you remove the media
before it realy write them physically data will be lost, it's important to
tell the OS before you remove the media)
to unmount it use 'umount' like this:
umount DEVICE
umount MOUNT_POINT
for example to mount the floppy ' /dev/fd0' to the folder
' /mnt/floppy' and we want it to guess the file system
'auto' type (as root)
bash# mount -t auto /dev/fd0 /mnt/floppy
to unmount it type before you remove the floppy disk
Warning
While some device is mounted to a folder, DO NOT rename the folder,
move it or do any other change on it, you should work with the mapped folder
contents not the folder itself, if you want to rename it you should unmount
it first. The same way you can't format a device while it's mounted
and you may check it if it's mount it for read only or not mounted.
Mounted devices will disappear in next boot so you have to issue
'mount' command again, if you want a device to be mounted by default
on each startup (useful for fixed drives), you have to edit the file systems
table '/etc/fstab' in which each line has the following syntax:
device then (after white spaces), then the mount point folder, then the file
system type (you could use 'auto'), then it's options
(that used to be after '-o' with 'mount' tool) if there is no options
use 'defaults'(you can't leave it empty), then the order of dump backup tool
(not widely used) put '0' if you don't want this device to be included with
this backup and at last the order of file system consistency checking (if check is needed)
if you don't want any checking (even if the file system is inconsistence)
put '0'. The following is a sample 'fstab' file:
# This is /etc/fstab those two lines are just comments they start with #
# Device Mount_Point FS_TYPE Options dump seq
/dev/hda7 / ext3 defaults 0 1
# special virtual file systems 'proc' and 'swap'
none /proc proc defaults 0 0
none /dev/pts devpts mode=0620 0 0
/dev/hda9 swap swap defaults 0 0
# some non Linux partitions
/dev/hda1 /mnt/win_c vfat umask=0 0 0
# removable media
/dev/fd0 /mnt/floppy auto noauto,users 0 0
/dev/cdrom /mnt/cdrom auto noauto,users,nohide 0 0
for devices on this table you could specify only the mount point(or the device)
like :
bash# mount /mnt/floppy
bash# mount -o remount,ro /mnt/win_c
wait a minute! what does the floppy and CDROM doing in this table ?
we have said that this table is useful for fixed drives to mount it
automatically when the system starts, but does this mean that the floppy
and the CDROM is mounted on each startp even though there is no media ?
notice the 'noauto' option which mean don't mount it when system starts,
this is useful to let you mount them by passing mount point only
and optionally omitting the rest arguments, the option 'users'
allow regular users to mount or unmount this device.
GUI provide simple way to mount devices (useful for removable media),
in GNOME right click the desktop and select disks (or double click
'computer' icon on GNOME 2.6), in KDE you could right click
the floppy/CDROM icon then select 'mount'.
Some distributions automatically mount and display devices like
CDROM or USB flash memory, but 'mount' tool is still there,
if the device is not listed on 'fstab' then you have to specify
both the device and the mount point folder, for example try this for CDROM
bash# dmesg | grep Floppy
Floppy drive(s): fd0 is 1.44M
bash# dmesg | grep -i CD
hdb: CDROM ATAPI blah blah ...
bash# mount /dev/hdb /mnt/cdrom
yes of course, distributions links the device that represents the CDROM
to ' /dev/cdrom', so you could use something like
' mount /dev/cdrom /mnt/cdrom' instead of
' mount /dev/hdb /mnt/cdrom', a nice option to be used with
CDROMs is 'nohide' which makes hidden files to be visible.
There are many SCSI fixed and removable disks, it's a standard bus for very
larg disks with high availability, many removable
disks could be handled as SCSI disks although they are not,
like CD-RW, USB flash disks, and digital cameras, this first SCSI disks
is '/dev/sda' and the first partition of it is '/dev/sda1'.
There are some tools specific to SCSI device found on 'scsitools' package,
like
- scsiinfo: displays SCSI drive low-level information and modifies SCSI drive settings.
- scsifmt: low-level SCSI formatter.
- sraw: benchmarks raw SCSI I/O rates bypassing the buffer cache.
- scsistop: low-level SCSI drive start/stop program.
- scsi-spin: program to manually spin up and down a SCSI device.
and for USB we have 'usbview' a GTK+ viewer of USB devies status,
it shows a graphical representation of the devices that are currently
plugged in.
Tip
To have faster disk reading you could disable updating 'access time',
access time is the time of last reading or writing operation,
you could use this time to find what files are no longer used in any way
for the last some days to delete them for example but if you are not interested
in it disable it to save time (usually for floppes and non Linux partitions),
add the option 'noatime' to 'fstab' file, like this:
'/dev/hda1 /mnt/win_c vfat umask=0,noatime 0 0'
or as a mount option, like this: 'mount -o noatime /mnt/win_c '.
There are many useful options, for exmpale 'nodev' means to disable device special
files on that file system, in other words files having device flag (on that file system)
(like '/dev/fd0') becomes usual files not devices
this option is used with removable media and non Linux partitions,
another option is 'noexec' which mean no file on that file system
is allowed to be executed, 'nosuid' option disables 'set user ID' flag
on executable files which (the flag) enable a user to run a program
as the owner of the file (the could be root).
The best option to use with removable media is 'sync'
which means to wait until all writing is finished before return,
unlike the default 'async' option which smoothely background writing process
until you use 'sync' or 'unmount' commands to physically write data.
Recent kernels have the so called 'supermount' file system
which enable you to mount removable media devices (eg. CDROM and floppy)
automatically when you access to related folers (exactly what Windows users
expect) and unmount them after a while of not using this device,
if your kernel does not support it compile one from source and make sure that
'CONFIG_SUPERMOUNT' option is not disabled. Mandrake uses Supermount by default,
one thing that makes it as easy as Windows! to do that yourself
let's first try it temporary by typing as root:
bash# mount -t supermont -o dev=/dev/cdrom,--,ro,users none /mnt/cdrom
this long line is not complicated, we just specify 'supermount' as file system
type, the device is none (not the CDROM), usual mount point ' /mnt/cdrom'
but the most important options here is after '-o', they are two parts
before and after '--', options after '--' are the usual mount options
like ' ro,users' in our case, options before '--' are supermount
specific options for example setting the device with ' dev=/dev/cdrom'
you could tell the real file system type with something like ' fs=vfat'
(since we take the '-t' set 'supermount').
To make supermount permanent edit your ' /etc/fstab'
to replace the usual CDROM line to look like:
#/dev/cdrom /mnt/cdrom auto ro,users 0 0
none /mnt/cdrom supermont dev=/dev/cdrom,--,ro,users 0 0
Supermount does not lock the CDROM so you could any time eject it while
it's in use (just like MS Windows), to lock the CDROM use the supermount option
' tray_lock=always', another related supermount option is
' tray_lock=onwrite' which lock the media only if it's busy writing
data.
Warning
With larg files and scratched poor disks, it could exceed the supermount timeout limit
so it get umounted, which makes it very annoying to copy a file
or just select them on the GUI, somewhere on the Internet I read about
people complaining about using OpenOffice and supermount, you had better
using usual mount/unmount. If you are using Mandrake goto Mandrake control
center then mount points then click on the CDROM or floppy and
unckeck 'supermount' checkbox, you could edit your 'fstab' by hand.
You could make using removable media easy using 'autofs'
which does not change your 'fstab' or disable the usual mount/umount method.
Another tool is called 'autofs' that automatically mount/unmount
devices just like 'supermount' but unlike 'supermount' you could specify
timeout and you don't have to touch your 'fstab' file, so you could
use mount/unmount tools. After you install 'autofs' edit '/etc/auto.master'
to specify the super folder which contain mount points subfolders,
a nice trick if to make it a dot hidden folder like '/.auto',
this is the first column, the next one is the configuration filename
then some options like the timeout in seconds which could be only one second
(like what I do) but documentations suggests much more (this depends on your usage
and the quality of disks you have),
a line in '/etc/auto.master' could be like:
/.auto /etc/auto.map --timeout=1
the configuration file specified in the second column
'/etc/auto.map' look like this:
cdrom -fstype=auto,ro,nosuid,nodev :/dev/cdrom
floppy -fstype=auto :/dev/fd0
Now create a folder called ' /.auto' but do NOT create mount points
subfolder(eg. 'cdrom' or 'floppy') in it, 'autofs' will do that.
And now create a folder called ' /auto' (or any thing like ' /mnt/auto')
and put links to the virtual mount points in ' /.auto'
then use your distribution service manager like
' Mandy Control Center->System->Services',
' Menu->Settings-> services' or the tool
'redhat-config-services' (which is renamed 'system-config-services'),
to activate the service 'autofs' or 'automount', you could do that by command
line tools like' chkconfig --level 12345 autofs on' followed
by ' service autofs start' (for RedHat).
From now on any time you want to access floppy or CDROM goto
' /auto' (from GUI or using ' cd'),
and by the way the usual 'mount' is still there at '/mnt' since
'fstab' is not changed.
The following is a complete session to enable 'autofs'
after you edit configuration files:
bash$ su
bash# mkdir /.auto /auto
bash# cd /auto
bash# ln -s ../.auto/floppy floppy
bash# ln -s ../.auto/cdrom cdrom
bash# chkconfig --level 12345 autofs on
bash# service autofs start
4.1.10. CDROM and recoding.
We have talked about how to mount and read CDROM, we will talk
about some useful CDROM related tricks and work arounds,
one of the most common problems related to CDROM reading is
poor recording qulity or poor medium qulity, another less
common problem is the annoying noise coming from fast rotating CDROMs,
a solution for those problems is any of the following equivalent commands:
bash# hdparm -E 4 /dev/cdrom
bash# setcd -x 4 /dev/cdrom
bash# echo 'current_speed:4' > /proc/ide/hdb/settings
where ' hdb' i the cdrom device and 4 is a slow speed
to decrease noise and give more time for reading (I guess it's too slow, try 32).
Another use of those commands is to make the CDROM read larger blocks
at once (1 mega at the first example), and to use (if available) fast
Direct Memory Access (DMA) which do copying without
the processor involved:
bash# echo 'file_readahead:1048576' > /proc/ide/hdb/settings
bash# echo 'unmaskirq:1' > /proc/ide/hdb/settings
bash# echo 'using_dma:1' > /proc/ide/hdb/settings
bash# hdparm -d1 -a8 -u1 /dev/cdrom
Recording CDs (called burning) using GUI or 'cdrecord' command line tool
needs to specify the recoding device (CDRW device), if you have a usual
IDE CD writer, first you have to pass 'hdX=ide-scsi'
to the kernel using bootloader where hdX is the device name of it
(eg. 'hdb' for primary slave), so we could use SCSI protocol on those IDE disks.
'cdrecord' needs the device to be passwd with 'dev=DEVICE'
option, with new 2.6 kernels, DEVICE could be usual IDE device like
'/dev/hdb' or '/dev/cdwriter'
but in general with older kernels this is NOT safe, you should specify 3 numbers
splited by comma ',' those numbers are the SCSI (or emulated) bus numbers,
type the next command to list them:
' speed' option to specify writing speed which should
be supported by both recording device anmd medium (disk), sometimes
devices can't write at the speed written on it.
If you computer is busy doing other things or reading from
source is delayed for any reason (eg. reading from pipe or network)
then writing will fail (try slower speed or test writing with 'dummy' option then do the real writing).
You could record an audio disk or data disk by specifying an ISO
image to burn or taking it from standard input '-' piped from
'mkisofs' output, like:
bash# mkisofs -J -r mydir/ | cdrecord -v speed=12 dev=0,1,0 -data -
but do it more safely by making an ISO then burn it:
bash# mkisofs -J -r -o foo.iso mydir/
bash# cdrecord -v speed=12 dev=0,1,0 -data foo.iso
if the disk is an CD-RW (rewritable) you should use ' blank=fast'.
To tell 'mkisofs' to enable long filenames using MS Joliet format
use '-J' option or using RockRidge format with '-R' option, which is suitable
for Linux because it preserve permissions and links but only 8.3 part of
filenames in this case visible to Windows, you could use both.
4.1.11. Power managment and Laptops.
Linux supports many utilities to protect out environment
see Linux Ecology-HOWTO by Werner Heuser. Linux could save
power, generate less noise by slowing downing CD spinning
and much more.
X server could use "Energy Star" monitor power saving using 'xset',
not only saves power but it may protect your monitor from burns
(more effective than screen savers see section '2.2. After Installation.').
To use 'xset', first type xset +dpms then specify times
of each stage (in seconds) with 'xset dpms standby_time suspend_time off_time',
you could manually jump from mode to mode by
'xset dpms force standby|suspend|off|on'.
Linux supports Advanced Power Managment (APM), if your BIOS supports it,
to know that type 'dmesg | grep apm', in order
to be able to manage power a daemon called 'apmd' should be running
check it with your service manager or type /etc/init.d/apmd restart
at command line, this service is just a script that in do many things
but mainly it will call 'modprobe apm' then run
'/usr/sbin/apmd', if you fail, recheck your BIOS setup
and try again.
A new standard for power managing is called
Advanced Configeration & Power Interface(ACPI)
that is supported by Linux kernels from 2.4 as patch (I found it on 2.4.19)
and for sure in 2.6 kernels, most new Intel mother boards support the
new ACPI technology. This technology offers many new features like
measuring temperature or fan speed. Most hardware supports only one
APM or ACPI, and even if both is supported you have to select
one of them (or none) in BIOS setup, options could be like this
'ACPI aware OS' for ACPI. If 'apmd' faild try 'acpid' by activating
the service or by typing '/etc/init.d/acpid restart',
this script inserts related modules using 'modprobe', those are
'button', 'battary', 'ac', 'fan', 'thermal' and 'processor' like
'modprobe ac' then run 'acpid' daemon.
A user space tool 'acpi' that controls this daemon,
for example acpi -V to display ACPI information,
also you could 'proc' file system like this:
bash# cat /proc/acpi/battery/BAT0/state
bash# cat /proc/acpi/battery/BAT0/info
Those two services could be used to tell laptop battary status,
then all you have to do is to add the GUI applet at your desktop,
right click the panel then select add then laptop battary.
Besides applets there are many nice applications to indicate power status
like many 'gdesklets' displays and themes of 'karmba' and 'superkarmba'.
There are many other applications related to Laptops or make life
much easer for Laptop users, some tools are general (work for all Laptops)
like:
- 'i8kutils' - Dell Inspiron and Latitude laptop utilities.
- 'toshset' - Access much of the Toshiba laptop hardware interface.
- 'toshutils' - Toshiba laptop utilities.
- 'tpctl' - IBM ThinkPad hardware configuration tools.
- 'tpb'- IBM ThinkPad special keys.
- 'sjog' - A program to use the "Jog Dial" on Sony Vaio Laptops.
- 'spicctrl' - Sony Vaio controller program to set LCD backlight brightness.
others are specific to some vendor like: (all of them are free software found on Debian)
- 'tpconfig' - A Debian program to configure touchpad devices.
- 'sleepd' - puts a laptop to sleep during inactivity
- 'cpudyn' - CPU dynamic frequency control for processors with scaling
- 'laptop-net' - package takes a different approach to automagic network reconfiguration.
- 'gpsdrive' - GpsDrive displays your position provided from your NMEA capable GPS
receiver on a zoomable map.
4.1.12. Memory dark corners.
We have mentioned before at subsection 8 of
'1.5 How to install Linux ?' section,
some information about BIOS settings related to shadow RAM
(a copy of subroutines on slow ROM to faster RAM) we have said that
you should disable this feature to save RAM.
BIOS setup offer an option to do parity check using an extra smaller odd chip
on the RAM slot, if the RAM slot have a no parity chip then this check
is useless, when you buy a new RAM search for this chip.
Some old BIOSs can't handle more than 64MB of memory,
if you put more than 64MB of RAM, it will tell Linux wrong size,
to see how much of RAM Linux sees type 'free' (and other information like free memory,swap,...),
also we could use 'dmesg | less LOWMEM', if the size is not
reported correctly, but we could still use all of the RAM, just tell Linux
to ignore BIOS RAM size report and pass it yourself like 'mem=128m'
using your bootloader, remeber we use 'append' with LILO
or add them after kernel command with GRUP.
4.1.13. Choosing best hardware to buy.
If you want to buy a new computer or any piece of hardware you should read
Linux Hardware Compatibility HOWTO
by Steven Pritchard , The Unix Hardware Buyer HOWTO
by Eric Raymond or other documents found at 'www.tldp.org',
search Linux forums,LUGs and newsgroups,
because it's useless to ask the salesman if it's compitable with Linux unless
he is a Linux fan or works for Linux related shops as 'www.LinuxMall.com'.
Some Linux distribution companies sells computers (Desktops and Laptops) preinstalled with Linux like
www.mandriva.com and
www.linspire.com,
also some computer vendors for example see 'www.hp.com/go/linux'
and 'www.hp.com/desktops/linux'.
For general (not Linux specific) hardware guidelines see 'www.faqs.org/faqs/pc-hardware-faq'.
The first advice is not to buy a piece with proprietary closed
hardware design having no open source driver (even if they provide a
good support with binary only drivers)
because such vendors assume that their team is smarter than
the rest of the world, they could provide support better than
the community and they are their interests are more important than you.
Richard B. Johnson comments (rejecting "confidential hardware interface specifications" excuse of binary only drivers):
"I didn't know you guys were so advanced that you didn't use
an electronic hardware interface! Your 'hardware interface specifications'
use magnetohydrodynamics, and they are top-secret, right?"
Consider the case that you use two closed source drivers
then you face a problem, how could you trace it and to whom
you report the problem, quoted from Alan Cox on LKML:
"nVidia driver loaded - bugs to nVidia. vmware loaded bugs to vmware,
both loaded, God help you, nobody else will"
the community can't help you, they don't have any thing
but reverse engineering which takes alot of time
and it's not fun (the main motive behind community-based programming),
Alan Cox comments: "If nVidia would like to pay me as much as Microsoft
is paid for driver certification then I might be able to find the time".
You should learn from what heppened to Motorola SM56 modems
(a binary only driver that was available once upon time)
they are no more producing it, developing it or supporting it,
it's not a magnetohydrodynamics-based device, it's just a simple old softmodem
even though they still consider it a confidential property and refuse to
release the source so that the community do the support for them!
The other advise is to ignore irrelevant benchmarks the look like this
"This is 20% better than that" because it should specify
in which field or for what for type of usage, taking them out of context
may lead you to wrong decisions, below we discuss the case of CPU benchmarking
as an example.
What is written on CPU in units of Hz (GHz or MHz) is called clock speed,
some times more clock speed gives faster performance
for example rough benchmarks by Ram Samudrala
(concering their researhes on protein folding simulation program, www.ram.org)
showed that Athlon 1.5 GHz is 38% faster than a PIII 1.0 GHz
which you may expect but the very Athlon 1.5 GHz was
8.66% faster than Xeon 1.7 GHz on the same benchmarks
even though the later has faster CPU clock,
the key to understand this is to know that different
CPUs have different Instructions Per Clock ratio (IPC)
for example that Xeon do 6 IPC whereas that Athlon do 9 IPC,
it's like a man walking and couting 1, 2, 3,...etc.
his counting speed need not be synchronized with his steps,
his speed at counting is worthless, and even his number of steps per second
if his steps are short while other man's steps are long,
maybe the first is faster for short-distance race while the other
is faster for long-distance stamina-challenging race,
some CPUs are faster for integer operations others are faster for float point operations,
if you overpay for a CPU designed for optimized float point operations,
while you work in system software development and most of the work time
is in compiling kernels and tools, then it's likely that you never
use any float point operation at all!! you waste your money and get nothing done.
On the other hand, if you running a research on empirical float point data
simulating an earthquake using deeply customized FORTRAN, your CPU had better
support something like 3DNow from AMD.
back to the walking man analogy, what if this man is slow but he knows shortcuts
or able to do a few things in the same time, MMX found on many recent CPUs
(including Pentium II or more from Intel and K7 or more AMD)
could do four 8-bit operations as one operation (by aligning them to a 32-bit integer),
but this mean that you will notice enhanced performance only if you use
software calling the new instructions. CPU performance is not every thing,
that one man is slow but he has a car! if you are running games all the time
and you could notice that it's more about if you have OpenGL
hardware acceleration on your video card (and it's driver)
a slow PIII with such card is for sure better than a PIV with a video card
having no hardware acceleration, those accelerated cards has what we call
attached processors they do some specific jobs even faster than the CPU,
besides that the main CPU could do other things while attached processors
works on others.
The last advice is to buy the best no matter from which vendor,
what name is written on it, don't hesitate to buy a clone, if it's better.
Don't buy an overpriced brand name computer, if you live in a country
outside the supporting plan (eg. many third world countries) of the
manufacturer, because most of the extra money goes for support you never get.
A friend of mine buy a well-known overpriced brand computer
when he call for support, it goes like this:
- "A: yes, we have the latest products, we cover all the country ..."
- "B: I know, I have one and I'm calling for support -"
- "A: no, sorry! we are just authorized dealers! call the regional office on that-far-country."
Andr D. Balsa on his Linux Benchmarking HOWTO list some
meaningless factors that you should ignore:
- Reputation of manufacturer (unmeasurable and meaningless).
- Market share of manufacturer (meaningless and irrelevant).
- Amount of marketing hype.
- Irrational parameters (for example, superstition or prejudice:
"would you buy a processor labeled 131313ZAP and painted pink ?")
- Perceived value (meaningless, unmeasurable and irrational).
- "You get what you pay for."
If you are doing researches or running heavy duty servers for a large company
that need a peformence which exceed best known computer you should
consider forming a cluster of computers see section 5.3.
or other Parallel Processing solutions, refere to Linux Parallel Processing HOWTO by Hank Dietz.
4.1.14. Devices appendix.
This is a segment of the devices list found on
'www.lanana.org/docs/device-list',
[can be mounted]
/dev/hda First whole IDE hard disk or CD
/dev/hda1 First partition on it
/dev/ram0
/dev/fd0
/dev/fd0u1440
/dev/fd0u1722
/dev/fd0u2880
/dev/loop0
/dev/sda First SCSI disk whole (as ide)
/dev/sda1 ... First partition in the 1st scsi (as ide)
/dev/st0 First SCSI tape, mode 0
/dev/st0l First SCSI tape, mode 1
/dev/nst0 First SCSI tape, mode 0, no rewind
/dev/md0 First metadisk(RAID) group
/dev/nwflash Netwinder flash memory
/dev/scd0 First SCSI CD-ROM (or SCSI emulated)
/dev/sr0 First SCSI CD-ROM (old)
/dev/rom0 First ROM card (rw)
/dev/rrom0 First ROM card (ro)
/dev/flash0 First flash memory card (rw)
/dev/fflash0 First flash memory card (ro)
[printers]
/dev/lp0 Parallel printer on parport0
/dev/usb/lp0 First USB printer
[mice]
/dev/usb/mouse0 First USB mouse
/dev/logibm Logitech bus mouse
/dev/psaux PS/2-style mouse port
/dev/inportbm Microsoft Inport bus mouse
/dev/atibm ATI XL bus mouse
/dev/jbm J-mouse
/dev/amigamouse Amiga mouse (68k/Amiga)
/dev/atarimouse Atari mouse
/dev/sunmouse Sun mouse
/dev/amigamouse1 Second Amiga mouse
/dev/smouse Simple serial mouse driver
/dev/pc110pad IBM PC-110 digitizer pad
/dev/adbmouse Apple Desktop Bus mouse
/dev/vrtpanel Vr41xx embedded touch panel
/dev/vpcmouse Connectix Virtual PC Mouse
[other input]
/dev/input/js0 First joystick
/dev/touchscreen/ucb1x00 UCB 1x00 touchscreen
/dev/touchscreen/mk712 MK712 touchscreen
/dev/usb/scanner0 USB scanner
/dev/sg0 First generic SCSI device may be scanner
/dev/scanners/cuecat CueCat barcode scanner
/dev/gs4500 Genius 4500 handheld scanner
/dev/wvisfgrab Quanta WinVision frame grabber
/dev/video0 Video capture/overlay device
/dev/radio0 Radio device
/dev/vtx0 Teletext device
/dev/vttuner TV tuner on teletext interface
/dev/dcxx0 miroVIDEO DC10/30 capture/playback card
/dev/av0 Philips SAA7146-based audio/video card
[other]
/dev/usb/cpad0 Synaptics cPad (mouse/LCD)
/dev/phone0 First telephony device
/dev/ttyTB0 First USB BlueTooth device
[symbolic links]
/dev/mouse mouse port Current mouse device
/dev/tape tape device Current tape device
/dev/cdrom CD-ROM device Current CD-ROM device
/dev/cdwriter CD-writer Current CD-writer device
/dev/scanner scanner Current scanner device
/dev/modem modem port Current dialout device
/dev/root root device Current root filesystem
/dev/swap swap device Current swap device
|
Best viewed with free web browsers
You may get more high quality software
from here for free

Generously Hosted by www.JadMadi.net
|