YOUR FEEDBACK
IBM Buys Its Way Out of Antitrust Trouble
Plato wrote: L.L.Bean was never actually a customer of PSI. At most, they we...


2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TOP LINKS YOU MUST CLICK ON


Linux.SYS-CON.com: Device Management with udev and HAL on Fedora Core 4
Hotplugging everything on Fedora Core 4

Digg This!

Page 2 of 2   « previous page

This situation can be confusing because symbolic links can be created for devices that are not yet generated. The symbolic links will be defined and held until needed, when the device is generated. This is why you usually have many more SYMLINK rules than NAME rules, though the NAME rules actually set up device files. In the case of removable devices, devices will not have a device name generated until they are connected.

In the 50-rules.udev file you will find numerous SYMLINK rules for optical devices like the one shown here for SCSI CD-ROMs:

KERNEL="scd[0-9]*", SYMLINK="cdrom%e"

In most cases, you'll only need symbolic links for devices, using the official symbolic names. Most of these are already defined for you. Should you need to create a symbolic link, you can create a SYMLINK rule for it. However, a new SYMLINK rule needs to be placed before the name rules that name that device. The SYMLINK rules for a device are read by udev and kept until a device is named. Then those symbolic names can be used for that device. You can have as many symbolic links for the same device as you want, meaning that you could have several SYMLINK rules for the same device. When the NAME rule for the device is encountered, the previous SYMLINK keys are simply appended.

Most standard symbolic names are already defined in the 50-udev.rules file, such as audio for the audio device. In the following example, the device is referenced by its KERNEL key and the symbolic link is applied with SYMLINK key. This is only a SYMLINK rule. There is no NAME key to name the device:

KERNEL="audio0", SYMLINK="audio"

Hardware Abstraction Layer: HAL
The purpose of the Hardware Abstraction Layer (HAL) is to abstract the process of applications accessing devices. Applications should not have to know anything about a device, even its symbolic name. It should just have to request a device of a certain type, and then a service, like HAL, should provide what is available. Device implementation becomes hidden from applications. HAL is a software project of freedesktop.org, which specializes in open source desktop tools.

HAL makes devices easily available to desktops and applications using a D-BUS, device bus, structure. Device are managed as objects that applications can easily access. The D-BUS service is provided by the HAL daemon, haldaemon. Interaction with the device object is provided by the org.freedesktop.HAL service, which is managed by the /org/freedesktop/HAL/Manager.

HAL is an information service for devices. The HAL daemon maintains a dynamic database of connected hardware devices. In certain cases, this information can be used by specialized callout programs to maintain certain device configuration files. This is the case with removable file systems like CD-ROMs and USB card readers. HAL will invoke the fstab-sync callout program that will use HAL information to dynamically change managed entries in the fstab file. Removable devices are managed by fstab-sync with HAL information, telling fstab-sync when such disks are attached. The situation can be confusing. Callout programs perform the actual tasks, but HAL provides the device information. For example, though fstab-sync changes the fstab file, the options and mountpoints used for CD-ROM entries are specified in HAL device information files that set policies for storage management.

Device Information Files: fdi
Hal properties for devices are handled by device information files (fdi) in the /usr/share/hal/fdi and /etc/hal/fdi directories. The /usr/share/hal/fdi directory is used for configurations provided by the distribution, in this case, Fedora Core 4, whereas /etc/hal/fdi is used for setting user administrative configurations. In both are listed subdirectories for the different kinds of information that HAL manages, such as policy, whose subdirectories have files with policies for how to manage devices. The files, known as device information files, have rules for obtaining information about devices, as well as detecting and assigning options for removable devices. The device information files have the extension .fdi, as in storage-policy.fdi. For example, the policy directory has two subdirectories: 10osvendor and 30thirdpary. The 10osvendor holds the fdi files that have policy rules for managing removable devices on Fedora Core 4 (10osvendor replaced 90defaultpolicy, which was used in Fedora Core 3). This directory holds the 10-storage-policy.fdi policy file used for storage devices. Here you'll find the properties that specify options for removable storage devices such as CD-ROMs. The directories begin with numbers; lower numbers are read first. Unlike with udev, the last property read will override any previous property settings, so priority is given to higher-numbered directories and the fdi files they hold. This is why the default policies are in 10osvendor, whereas the user policies, which would override the defaults, would be in a higher-numbered directory like 30user, as are third-party policies, 20thirdpolicy.

There are currently three device information file directories set up in the device information file directories, each for different kinds of information: information, policy, and preprobe.

  • Information: Holds information about devices.
  • Policy: Sets policies such as storage policies. The default policies for a storage device are in a 10-storage-policy.fdi file in the policy/10osvendor directory.
  • Preprobe: Handles difficult devices such as unusual drives or drive configurations, for instance, those in preprobe/10osvendor/10-ide-drives.fdi. This contains information needed even before the device is probed.
Within these subdirectories are still other subdirectories indicating where the device information files come from, such as vendor, thirdparty, or user, and their priority. Certain critical files are listed here:
  • information/10freedesktop: Information provided by freedesktop.org
  • policy/10osvendor: Default policies (set by system administrator and OS distribution)
  • preprobe/10osvendor: Preprobe policies for difficult devices
Conclusion
Both udev and HAL usher in a radical new age of device management for Linux systems, Fedora Core in particular. As more devices become hotplugged, temporarily attached like a camera or moving from one system to another like small printers, it's crucial that device management become accommodating, automating device detection and configuration. It used to be that devices were few and rare, with only a couple used for any given system. These days numerous devices of all kinds are expected to connect and interact with your system. The old method of manually setting up a device interface is no longer practical. We are in an era where all devices are logically hotplugged, and fixed devices are just hotplugged ones that were never removed.

References


Page 2 of 2   « previous page

About Richard Petersen
Richard Petersen holds a M.L.I.S. in Library and Information Studies. He currently teaches Unix and C/C++ courses at the University of California, Berkeley.

LinuxWorld News Desk wrote: LinuxWorld: Device Management with udev and HAL on Fedora Core 4. This article discusses the implementation details for the new device management methods udev and HAL, now used on all Fedora Core 3 and 4 systems for all devices. It's time to relearn how devices are managed!
read & respond »
LATEST LINUX STORIES
Cloud Computing Expo - Novell Virtualization, Google, HP and Wind River
Novell says it's going to 'simplify' pricing and discounts on SLES for mainframes for the rest of the year. That means it's going to cut prices by 33%-47% by offering a three-year subscription for the price of a two-year subscription or a five-year subscription for the price of a three
Adobe's Kevin Lynch and Microsoft's Scott Guthrie to Keynote AJAX World RIA Conference & Expo
Two of the biggest launches in Rich Internet Application history took place in 2007/2008 when Adobe launched AIR 1.0 in February '08 and Microsoft launched Silverlight (September '07). At the 6th International AJAXWorld RIA Conference & Expo in October SYS-CON Events is delighted to be
Linspire Collapses into Xandros
Xandros acquired Linspire's Linux assets after Linspire changed its name to Digital Cornerstone. With the acquisition Xandros CEO Andy Typaldos has been telling the press, 'Xandros is already the third-largest Linux company in the world, and ... we may already be the largest private Li
Red Hat Delivers on Linux Automation
Red Hat announced advancements that extend the Company's Linux Automation strategy by providing expanded capabilities and incorporating broadened community involvement for secure management of both users and systems across virtual and physical enterprise infrastructures.
Invitrogen Standardizes on SUSE Linux Enterprise From Novell
Novell announced Invitrogen has selected SUSE Linux Enterprise as the core operating platform to standardize and virtualize the company's servers. A global provider of essential life science technologies for research, production and diagnostics, Invitrogen conducts business in more tha
Reiser's Lawyer Says He's Nuts
On Monday, nine days ahead of his sentencing on July 9 for the murder of his wife, William DuBois, the lawyer for ace Linux programmer Hans Reiser, filed a brief with the court saying - for the very first time since this case began - that under penalty of perjury that he think Reiser '
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE