Linux.Desktop.Hacks [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Linux.Desktop.Hacks [Electronic resources] - نسخه متنی

Jono Bacon, Nicholas Petreley

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Hack 93. Perfect USB Devices with Project Utopia

Kick your desktop into the Plug and Play world
with your USB devices.

Few would argue that USB has not had a tremendous impact on the computer
world. Everything from sound cards to network cards to lamps and
beyond is available with a USB connector hanging off the side.

Linux support for devices has traditionally been a slightly crufty
area. Devices that are plugged in usually require several manual
steps before the OS recognizes them, and they are accessible to the
user. But in the last two years the ease of hardware handling has
improved dramatically. One of the major projects to work on this
problem is Project Utopia. This collection of developers has worked
to create a software stack that enables you to plug a device into
your USB port and have it just work. This stack includes the
following tools:

udev


This tool replaces the kernel-managed /dev with
an equivalent userspace that makes it easier for devices to be
handled.


dbus


This allows programs to communicate with each other and respond to
specific events.


Hardware Abstraction Layer (HAL)


This component ties together the other technologies to provide
information about system events, as well as an abstracted layer in
which to interact with hardware. Traditionally, most programs that
deal with hardware have done it in their own way, but HAL provides a
consistent way of dealing with hardware while getting the benefits of
device detection and other features.



In addition to these tools, you need to be running a 2.6 series
kernel [Hack #89] and a recent
version of linux-hotplug. Project Utopia is a
fairly complex system to build, so I recommend you install the binary
packages that are available for your distribution. If you are intent
on compiling the source code, however, you should look at the
documentation available at http://hal.freedesktop.org.


11.3.1. Install the Packages


You need to install the
packages in the right order. If you
are using a system that figures out the dependencies and installs
them in the correct order (such as APT or
portage), this should be easy for you. If you
are installing the packages individually, here is the required order:

Kernel 2.6

linux-hotplug

udev

dbus

HAL


In addition, if you are using the GNOME desktop, you should install
the GNOME Volume Manager. This package (often named
gnome-volume-manager) requires the following
packages to be installed:

python-gnome2

libgnomeui

gnome-common

libglade2


You probably have some of these packages available already.


11.3.2. Configure the Automounter


When you plug a device into the system,
you want to be able to
automatically access the device. For units such as digital cameras
and other USB mass storage devices, you ideally want to plug in the
device and be able to use it right awayno more manual mounting
of disks. On a Linux system, mounted disks are typically managed by
/etc/fstab. One option for automatically
mounting inserted media uses this file. This program, called
fstab-sync, is part of the HAL package and it
modifies /etc/fstab each time a device is
plugged in and used. When you install the HAL package,
fstab-sync is installed automatically for you.

Another option is to use pmount, written by
Martin Pitt. This handy little tool replaces the
mount command with a version that can be used in
userspace so that nonroot programs can access devices. The Ubuntu
distribution uses this method with a good degree of success, but it
requires a little more work to get going. To use
pmount you need to use a special patched GNOME
Volume Manager. At the time of this writing the GNOME Volume Manager
does not include built-in support for pmount,
but you should check to see if a newer version with
pmount support has been released by having a
look on Google.

If the versions of GNOME Volume Manager available to you
don't contain pmount, you will
need to patch the GNOME Volume Manager source yourself and compile
it. Before you do this, be certain you have the following programs
installed:

pmount

python-gnome2-dev

libgnomeui-dev

libglade2-dev


You can download the source code to the GNOME Volume Manager from
http://ftp.gnome.org/pub/GNOME/sources/gnome-volume-manager,
and you can get the pmount patch from
http://people.debian.org/~mpitt/gnome-volume-manager.pmount.patch.
Extract the Gnome Volume Manager code to a work directory, copy the
patch to that directory, and cd to the work
directory. Then patch the code using this command:

foo@bar:~$ patch -p1 < ubuntu-pmount.diff

You might see some patch errors referring to a Debian control file.
You can safely ignore these errors when you're not
running on a Debian system. Finally, you can compile the code with
this:

foo@bar:~$ ./autogen.sh
foo@bar:~$ make
foo@bar:~$ make install (you may need to be root to do this)

Now you have a patched GNOME Volume Manager that can use
pmount.


11.3.3. Configure Your System


With the GNOME Volume Manager installed you can configure your
system to respond intelligently when devices are plugged in. You
configure this with the gnome-volume-properties
tool. You should run this tool from the command line, and then check
the "Mount removable drives when
hot-plugged," "Mount removable
media when inserted," and "Browse
removable media when inserted" checkboxes. For the
other options in the properties box, try the following commands:

Audio CDs


gnome-cd --unique --play --device %d


Blank CDs


nautilus --no-desktop burn:


DVD videos


totem dvd://


Digital cameras


/usr/share/gnome-volume-manager/gnome-volume-manager-gthumb.sh
%h



These options enable the most common actions you will want when you
insert new media into your computer.


/ 140