[ltp] Re: Fglrx 8.28.8 promises Fn-F7 toggling. Anyone got it working?

David Abrahams linux-thinkpad@linux-thinkpad.org
Tue, 29 Aug 2006 16:44:22 -0400


--=-=-=

TNKS <0osz0s302@sneakemail.com> writes:

> David Abrahams wrote:
>
>>> Does the fglrx driver only support Fn-F7 video toggling if it's supported
>>> by ibm_acpi?
>> 
>>   echo 0xffff > /proc/acpi/ibm/hotkey
>> 
>> will help you.  I just made a long post about my experiences with
>> video toggling on this list with lots more info in it.
>> 
>
> David,
>
> So  I think the hotkey setting might be independent of the more important
> issue -- does the /proc/acpi/ibm/video interface work for you?  Because the
> hotkey stuff just handles Fn-F7.  Does 
>
>     echo video_switch > /proc/acpi/ibm video
>
> do the toggling for you?

Oh.  No it doesn't, (not even after I add the missing slash) but I
thought that was just because I have fglrx installed, which takes over
the video switching functionality.

  $ cat /proc/acpi/ibm/video
  status:		supported
  lcd:		enabled
  crt:		enabled
  dvi:		disabled
  auto:		enabled
  commands:	lcd_enable, lcd_disable
  commands:	crt_enable, crt_disable
  commands:	dvi_enable, dvi_disable
  commands:	auto_enable, auto_disable
  commands:	video_switch, expand_toggle

Interestingly, that blanks the crt briefly, but then everything is
back to the way it was before.  Same for

  # sudo echo crt_disable > /proc/acpi/ibm/video

> I'm thinking that the Fn-F7 promises of the latest fglrx driver only hold
> true on systems that had /proc/acpi/ibm/video working in the first place. 
> But I'm not sure.  Maybe someone else can support or refute this claim.

I think I basically am refuting it, but I also don't think we can tell
much about it when fglrx is installed.  If /proc/acpi/ibm/video is
going to work, it'll do so independently of special third-party
software, no?

Ooooh, duh!  There are a number of special things I did that might be
making this work.

1. Give acpid permission to adjust display-related parameters:

     xhost +local:acpid

   
   If that doesn't make it work for you I suggest skipping on to stpe
   2.

   I actually do it when X starts with the following two files:


   --- /etc/X11/Xsession.d/98local-xsession ---

--=-=-=
Content-Type: text/x-sh
Content-Disposition: inline; filename=98local-xsession
Content-Description: Xsession hook

# /etc/X11/Xsession.d/98local-xsession
# This file is sourced by Xsession(5), not executed.

if [ -x /usr/local/etc/X11/Xsession ]; then
   . /usr/local/etc/X11/Xsession;
fi

# vim:set ai et sts=2 sw=2 tw=80:

--=-=-=



   --- /usr/local/etc/X11/Xsession ---

--=-=-=
Content-Type: text/x-sh
Content-Disposition: inline; filename=Xsession
Content-Description: Local X session initialization

#!/bin/sh
# /usr/local/etc/X11/Xsession
xhost +local:acpid  # allow acpid to reconfigure screens for hotdocking
aticonfig --set-powerstate=1


--=-=-=


2. Set up the ibm-videobtn event, which I do with the following two
   files:

   --- /etc/acpi/events/ibm-videobtn ---

--=-=-=
Content-Type: text/x-sh
Content-Disposition: inline; filename=ibm-videobtn
Content-Description: /etc/acpi/events/ibm-videobtn

# /etc/acpi/events/ibmvideobtn
# This is called when the user presses the video button. It is currently
# a placeholder.

event=ibm/hotkey HKEY 00000080 00001007
action=/usr/local/etc/acpi/videobtn.sh
# action=/bin/true

--=-=-=


   --- /usr/local/etc/acpi/videobtn.sh ---

--=-=-=
Content-Type: text/x-sh
Content-Disposition: inline; filename=videobtn.sh
Content-Description: /etc/acpi/events/ibm-videobtn

#!/bin/bash
#!/bin/sh

. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs

getXconsole;

change_resolution() {
    if [ x"$XAUTHORITY" != x"" ]; then
        if [ x"`xrandr -q | grep $1[[:space:]]x[[:space:]]$2 | cut -b -1`" != x"*" ]; then
            xrandr -d $DISPLAY -s $1x$2
        fi
    fi
}

if [ x"$XAUTHORITY" != x"" ]; then
    CURRENT=`aticonfig --query-monitor | grep Enabled | cut -b 21-`
    DUAL=`echo $CURRENT | sed -e 's/.*,.*/dual/g'`
    if [ x"$DUAL" == x"dual" ]; then
        change_resolution 3200 1200
    else
        su $user -c "aticonfig --set-powerstate=1 --effective=now" &>/dev/null
    fi
fi

--=-=-=



3. Restart acpid so it will find your new event hooks
   
   TNKS@foo:~$ sudo /etc/init.d/acpid restart

In fact, I started with http://www.thinkwiki.org/wiki/Talk:Fglrx and
when I realized it was switching video before the zenity dialog came
up (really bad idea anyway because zenity puts it in an arbitrary
workspace that might not be visible), I ripped all that stuff out.

HTH,

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

--=-=-=--