<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>J-Doc &#187; D610</title>
	<atom:link href="http://jsilva.komodoopenlab.com/blog/archives/tag/d610/feed" rel="self" type="application/rss+xml" />
	<link>http://jsilva.komodoopenlab.com/blog</link>
	<description>inclusion, equity, open source</description>
	<lastBuildDate>Tue, 17 Aug 2010 20:06:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Dell D610 lid switch on Ubuntu 8.04</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/119</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/119#comments</comments>
		<pubDate>Tue, 07 Oct 2008 19:10:58 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[GNU | Linux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[D610]]></category>
		<category><![CDATA[GNU linux]]></category>
		<category><![CDATA[Ubuntu 8.04]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=119</guid>
		<description><![CDATA[The lid switch makes the laptop’s screen turn off when the lid is closed and turns it back on when the lid opens. This already worked well in Ubuntu but I needed to tweak the behavior a bit. Sometimes I use a projector as the main display and turn off the laptop’s screen to save [...]]]></description>
			<content:encoded><![CDATA[<p>The lid switch makes the laptop’s screen turn off when the lid is closed and turns it back on when the lid opens. This already worked well in Ubuntu but I needed to tweak the behavior a bit. Sometimes I use a projector as the main display and turn off the laptop’s screen to save some battery, however, Ubuntu turns off ALL displays (including the analog output) when the panel lid is closed, which then leaves me with no screen at all!</p>
<h2>How it Works</h2>
<p>You can determine the state of the lid switch by doing:</p>
<pre>$ cat /proc/acpi/button/lid/LID/state</pre>
<p>In order to turn on/off the backlight of the LCD panel, you can use <code>radeontool</code>. This tool is part of the Ubuntu distribution so you can install it with <a href="https://help.ubuntu.com/community/SynapticHowto">Synaptic</a> (if it is not already installed). After installing both, the <code>laptop-mode-tools</code> (also part of Ubuntu) and <code>radeontool</code> packages, I created the following script:</p>
<pre>#!/bin/bash

LIGHT=$(radeontool light | grep "looks on")

if [ "$LIGHT" = "" ]; then
        radeontool light on
else
        radeontool light off
fi</pre>
<p>This script toggles on/off the backlight of the LCD panel. You can then use <a href="http://hocwp.free.fr/xbindkeys/xbindkeys.html"><code>xbindkeys</code></a> to assign a keyboard shortcut and control the LCD backlight at will.</p>
<h2>Tweaking the Lid Switch Behavior</h2>
<p>In order to set and maintain the state of the backlight when the lid is closed, you can create a daemon and call it with <code>laptop-mode-tools.</code> This is specially handy if some of your applications (usually games) like to turn the panel backlight back on when resetting the video resolution or when going into full screen.</p>
<h3>Step 1</h3>
<p>Comment everything on <code>/etc/acpi/lid.sh</code> and add the following at the end of the script:</p>
<pre>LID_CLOSED=$(cat /proc/acpi/button/lid/LID/state | grep open)
if [ "$LID_CLOSED" = "" ]; then
  /usr/sbin/blightoffd &amp;
else
  /usr/sbin/radeontool light on
fi</pre>
<h3>Step 2</h3>
<p>Save the following script as <code>/usr/sbin/blightoffd</code></p>
<pre>#!/bin/bash

#
# Keeps panel backlight off when computer lid is closed.
#

LID_CLOSED=$(cat /proc/acpi/button/lid/LID/state | grep open)

while [ "$LID_CLOSED" = "" ]; do

  LIGHT_ON=$(/usr/sbin/radeontool light | grep "looks off")
  if [ "$LIGHT_ON" = "" ]; then
    /usr/sbin/radeontool light off
  fi
  sleep 1
  LID_CLOSED=$(cat /proc/acpi/button/lid/LID/state | grep open)

done</pre>
<h3>Step 3</h3>
<p>Disable or uninstall both <code>kpowersave</code> and <code>klaptop</code>.</p>
<h2>Making it all work with <code>powersave</code></h2>
<p>I installed <code>powersaved</code> which is great tool for enabling dynamic control of the CPU speed and save additional power. However, that bugger messed up the scripts controlling the lid switch events. Here is how to fix the problem:</p>
<p>Find the following line in <code>/etc/powersave/events</code>:</p>
<pre>EVENT_BUTTON_LID_CLOSED="xxxxxxx"</pre>
<p>and make sure it says:</p>
<pre>EVENT_BUTTON_LID_CLOSED="ignore"</pre>
<p>This will make <code>powersave</code> ignore lid switch events</p>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/119/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
