[Debian-eeepc-devel] Bug#598097: Make detect_x_display go away to solve this

Ben Armstrong synrg at sanctuary.nslug.ns.ca
Sat Nov 13 16:01:30 UTC 2010


On 13/11/10 10:05 AM, Damyan Ivanov wrote:
> -=| Ben Armstrong, Sat, Nov 13, 2010 at 08:20:15AM -0400 |=-
>> After discussing this with a member of the X team, they advise this is
>> simply a bad idea (to try to talk to X from acpi scripts).  I've heard
>> this advice before and given the difficulty we've had, I have to wonder
>> if it isn't time to finally take that seriously.
> 
> Before going there, maybe we could try using getXconsole from 
> /usr/share/acpi-support/power-funcs ? There are other useful scripts 
> in that directory, for example screenblank.

No, because that does not address the X team's objection that we should
not be talking to X from acpi at all.  I don't think we should take what
acpi-support does as "correct".  Incidentally, DISPLAY_DPMS, used by
screenblank, is used as a handler for the lid action.  But GNOME has its
own way to handle that, and arguably we should follow suit.

I have found the elusive key mapping.  It's actually the kernel input
subsystem handling it, so the place to look is in /usr/include/linux/input.h

#define KEY_DISPLAY_OFF 245 /* display device to off state */

I tested this in GNOME just now and there is no default key mapping.  I
was able to make a mapping, though, like this:

System -> Keyboard Shortcuts -> Add

Name: Turn the display off
Command: xset dpms force off

In a terminal:

sudo sleep 10 ; acpi_fakekey 245

Switch back to the Keyboard Shortcuts dialog and click the "Turn the
display off" key.  It will display "New shortcut...".  Wait.  After the
sleep runs out, the key is defined as 0xfd.  Return to the terminal and:

sudo acpi_fakekey 245

Now the display will blank.  This exercise demonstrates that if we make
this key do "acpi_fakekey 245" (really,
/usr/share/acpi-support/key-constants should be updated to include
KEY_DISPLAY_OFF = 245, and freedesktop.org should have an XKeySymDB
entry that corresponds), then all the user needs to do is go through the
dialog as I indicated above and press the key.  Then they'll have the
desired key binding.

For non-GNOME systems users should use their own native key mapping
configurators, whether that is via some GUI, or by editing config files.

Ben



More information about the Debian-eeepc-devel mailing list