Hi Stefan,

Stefan Momita wrote:
Hello. I'm running Debian SID on a Dell Inspiron 6400 laptop with acpi-support
version 0-95.2. I too am having problems with the getXconsole() function
present in /usr/share/acpi-support/power-funcs, mainly the line which is meant
to set $displaynum.

The value of the COLUMNS variable has no positive effect, and mr. Chung-chieh
Shan's perl-using patch-line does not work on my system (i.e. it returns -
nothing).

I'm trying to get ACPI to play with my Laptop lid, and thus I'm looking at
/etc/acpi/lid.sh, which is the one calling getXconsole. However:

-- from /etc/acpi/lid.sh: --

        grep -q closed /proc/acpi/button/lid/*/state
        if [ $? = 0 ]
        then
            for x in /tmp/.X11-unix/*; do
                displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
                getXconsole;

but:

-- from /usr/share/acpi-support/power-funcs: --

        getXconsole() {
                console=`fgconsole`;
                displaynum=`ps ax | grep -e 'X .* vt'$console | grep
-v grep | sed -re 's!.*/X .*:([0-9]+).*!\1!'`


I suppose I do not understand why $displaynum is first set in lid.sh only to
be then re-set in getXconsole. lid.sh sets $displaynum (here) to "0", but
getXconsole empties the variable.

Hmmm. I guess the lid.sh way of doing things is a nice fallback for the other mechanism.

I hope the following will clarify the situation a bit:

        # ps ax | grep X
         3214 tty1     S+     0:00 xinit /home/stefan/.xinitrc --
/etc/X11/xinit/xserverrc -auth /home/stefan/.serverauth.3198
         3215 tty7     Ss+    0:04 /usr/bin/X11/X -dpi 100 -nolisten tcp
         3230 tty1     S      0:00 /bin/sh /etc/xdg/xfce4/xinitrc --
/etc/X11/xinit/xserverrc
         3234 tty1     S      0:00 /bin/sh /etc/xdg/xfce4/xinitrc --
/etc/X11/xinit/xserverrc
         3327 pts/4    S+     0:00 grep --color=auto X

( This explains why the displaynum=`ps ax..` line in getXconsole and the
perl-using patch do not work on my machine. )

Let me guess, you're not starting X with gdm / kdm? It seems your X doesn't have anything associated with it on the command line -- no display numbers, no virtual console, nothing. The lid.sh trick apparently works, so maybe I should add this as a fallback if the getXconsole() thing doesn't work.

Cheers,
Bart


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to