Project Utopia

Users—what will they plug in next? Robert is making the computer make sense of hardware, so you don't have to.
A Project All about Utopia

Joey and I decided to create an umbrella project—a meta-project. The plan was to spur development of HAL-aware applications that can provide hardware policy on the desktop. Never should a user need to configure hardware. It should happen automatically in response to the user plugging the hardware in. Never should the user (or even the programmer) have to mess with device nodes and esoteric settings. HAL should provide all of that, on the fly, to the applications. Never should the user have to guess how to use new hardware. If I plug in a camera, my photo application should run. If I insert a DVD, it should start playing. All of this should happen magically, automatically and cleanly.

I coined the name Project Utopia. It was, after all, a bit utopian.

We did not have a central Web site or source repository or cute logo. Project Utopia was a cause and a way of thinking. We had a goal and a set of use cases and a growing disgust toward things not working. We blogged and spoke at conferences and wrote code. One by one, piece by piece, we started to build a set of policy pieces on top of HAL, guided by the following rules:

  • Make hardware just work.

  • Use HAL, udev, sysfs and 2.6 Linux kernel as our base.

  • Tie it all together with D-BUS.

  • No polling, no hacks—everything should be event-driven and automatic.

  • Carefully divide infrastructure into system and user level.

  • System level should be platform-agnostic; user level, GNOME-based.

GNOME Volume Manager

I began writing GNOME Volume Manager in late December 2003. It was originally a proof of concept—a test bed for my ideas. I wanted to see how feasible hardware management on top of HAL could be. The plan was to respond to events such as “new hardware” or “audio CD inserted” with specific actions. GNOME Volume Manager is nothing but a simple finite state machine, receiving hardware-related events on one end and replying with hardware-induced actions on the other. The tricky part was to do it all with HAL: no polling, no hacks.

GNOME Volume Manager implemented the Project Utopia policy related to block devices. When the user inserted an audio CD, GNOME Volume Manager would play it. When the user inserted a USB keychain device, GNOME Volume Manager would mount it and open a Nautilus window. When the user plugged in a camera, GNOME Volume Manager would ask if it should automatically import the photos into the user's photo management application (Figures 2 and 3). A recently added feature even found GNOME Volume Manager managing iPods!

Figure 2. GNOME Volume Manager Prompting on Discovery of New Photos

Figure 3. F-Spot, a Photo Management Application

The Rest of the Puzzle

The next step was bringing HAL support to more applications, a process Joey and I call halification. The following months witnessed additional policy pieces, such as automatic printer configuration and seamless network management (Figure 4).

Figure 4. NetworkManager's Network-Switching Applet

For printers, Joey wrote a HAL back end for CUPS, the Common UNIX Printing System, allowing CUPS to query HAL on the availability of printers. The result: plug in a printer and configure it automatically, on the spot.

The ambitious NetworkManager Project, started by hackers at Red Hat, aimed to solve networking woes. Seth Nickell, an early designer on the project, described the intended use case as an electrical outlet: “you plug it in and [it's] on.” For example, plug a laptop in to a docking station, and it instantly switches to the station's Ethernet. Walk into your favorite coffee shop and instantly begin using the wireless networking. NetworkManager made networking simple, automatically choosing the optimal solution for networking connectivity.

NetworkManager's architecture is two-part. First, a root-level dæmon sits alongside HAL, responding to HAL events and communicating with the system's networking hardware. Second, one or more user-level components implement policy and provide a user interface. Together, the components provide a complete solution for networking. Figure 5 is a diagram of the architecture.

Figure 5. NetworkManager Architecture

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Great

Anonymous's picture

Oh Great - now of course everything will just work.

- And if it doesn't you can forget about trying to fix the problem by reading the documentation and editing the config file. . .

You won't be able to.

No you can just forget it.
Until this lot get bored and the next intoxicated developer gets the inspiration to take over the world.
https://wiki.ubuntu.com/Halsectomy

Oh yes, f***ing great.

Awesome

David Siegel's picture

Robert, you're the man!

Thank you for sharing your fascinating and inspiring story. A swell of vicarious, geeky pride rushed over me when I read the example of plugging in a USB thumbdrive and having it mount and open a Nautilus window automatically -- I wish I could have been there to witness the moment you go that working! What a killer demo.

Polling + Automagic

Dave North's picture

First, it would appear that not everyone agrees that polling is evil. Even on our laptops, hald seems to wake up the disk every second or so unless the configuration file is edited to shut it up. So far, HAL has not killed anyone in the office ... your aim to avoid polling is terrific, but there are clearly other folks muddying the water.

Second, it's good to remember to give people an easy way to turn off automagic. I'm an OS butterfly, so I also have a Mac (about which you speak in good terms). One thing that drives me nuts is my clumsy inability to find a way to get it to not start the local photo import/viewing program if I plug my camera in. I have much better stuff (some of it written by my wife) that I prefer to use, just addressing the camera as a disk. But I have to wait through iPhoto first! Annoying.

Incidentally, did you ever read Thomas More's "Utopia" (1516)? In a metaphoric way, it addresses both issues.

Go for it! I like what you're doing, and the approach you wish to take. But don't forget the "get out of jail free" key.

Dave

There is on thing i disliek

Anonymous's picture

There is on thing i disliek about the policies in howl. That is that USB devices mainly memory sticks, and floppies arnt mounted with the policy to write immediately i think this is called syncronis mode. Most users would not know about unmounting devices in Linux who have come from a Windows enviroment so the default policy should be changed for these devices.

Hardware and Making it Work

Mike Chandler's picture

This was a great article. I've been wrestling with hardware since Red Hat version 4.0 and it is amazing how long it can take to get something like a wireless network card to work. Anyone that helps make that task easier is my hero.

One suggestion, I'd love to see an article that explains how the kernel recognizes that a device has been plugged in and then decides what module to load to support that device. The inclusion of an explanation of how kernel modules are loaded would be nice too. If I build a driver into the kernel and then insert a device that is supported by that driver module will it still show up with lsmod or is that only for loadable kernel modules?

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState