Ubuntu is a mobile-friendly Linux distribution. It will detect and configure almost any wireless hardware you can throw at it. In some cases, you will run into some hardware that, because its maker won't provide open source developers the information they need, can't run on Ubuntu. However, you can usually fiddle with the proprietary Windows drivers to get it working. And once you do get your wireless adapter up and running, you'll need to configure it to work with the various Wi-Fi networks you use. The hacks in this chapter cover all these topics and more.
For anyone who spends a lot of time away from a power source, power management is a major concern. This chapter also shows you how to put your computer into sleep and deep sleep, and provides some tricks on prolonging your battery life while you are away from a power source. You'll also learn how to work with notebook-specific peripherals, such as PC Cards and hotswappable optical drives.
Close the lid and save some power.
Part of proper power management is the ability to put your laptop to sleep. ACPI sleep is defined as a state where the system is still technically powered on, but the screen and hard disk are powered down and the computer is using just enough power to keep the contents of RAM alive. The Ubuntu development team has devoted an immense amount of effort toward getting ACPI power management working properly. As it stands, Ubuntu is power-management-friendly right out of the box, thanks to the recent addition of the gnome-power-manager package. It turns out there's not much required to get most modern laptops to sleep and wake up correctly.
The Dapper Drake release of Ubuntu Linux includes the new gnome-power-manager package, which enables ACPI sleep much like the system-tray power applet in Windows. Finally, sleep "just works" in Linux. The gnome-power-manager applet is configured to start automatically, and it lives in GNOME's panel notification area. If you right-click on the little battery icon, you'll see a menu pop up, as shown in Figure 4-1.
This deceptively simple little application gives you a lot of control over your laptop's sleep behavior. If you click on Preferences, you'll see the Power Management Preferences dialog box shown in Figure 4-2. In this dialog's Sleep tab, you can configure different behavior depending on whether you're plugged into AC power or running on battery. One of the most interesting features is your ability to control the backlight brightness of your laptop's screen depending on the machine's power state. It happens to work out that a large consumer of power in a laptop is the screen's backlight, so being able to automatically turn down that lamp while on battery will help squeeze more runtime out of the system while it's unplugged.
The Options tab (see Figure 4-3) is where you can set the default type of sleep you wish for the system to use, as well as what actions will engage the sleep mechanism. For this hack, the default sleep type is set to Suspend, which refers to ACPI sleep. (Hibernate [Hack #39]">Figure 4-3) is where you can set the default type of sleep you wish for the system to use, as well as what actions will engage the sleep mechanism. For this hack, the default sleep type is set to Suspend, which refers to ACPI sleep. (Hibernate [Hack #39] is a totally different type of sleep mechanism.) If you wish, under the Actions section of the dialog box, you can set the system to automatically sleep when the laptop lid is closed. This is a very handy feature if you're on the go: simply shut the lid and run off to your next appointment; then open the lid later, and the machine will wake up without any intervention.
The Advanced tab of the dialog (Figure 4-4) controls the notification icon's behavior. If you want the icon to appear only when you're charging or discharging, or you want to turn off the icon altogether, here's where you change those settings.
If you're not seeing the notification icon, perhaps it's because you're plugged into AC power. If you'd like to see the applet all the time, unplug your laptop for a moment and the icon should appear. You can then use the Advanced tab to change the notification icon settings.
When you have all your settings configured to your liking, simply click the Close button, and the dialog box will close, saving your configuration changes.
Your system is now ready for you to test sleep mode. Ensure that your system is running on battery; then simply shut the lid of the laptop and see what happens. You should hear the hard disk power down, and one of the power LEDs should indicate a power-state change by blinking or some other method. Hopefully, your machine went to sleep properly. Now you need to see if it wakes up correctly. Simply open the lid, and the computer should start waking up. When it's ready for use, you'll be prompted for your system password by gnome-screensaver. Enter your password, and your system should be in the exact same state as it was when you powered it off.