Results 1 to 8 of 8

Thread: Need to intercept acpi events for thinkpad. Where are the controls these days?

  1. #1
    Join Date
    May 2011
    Location
    BMore City
    Posts
    36

    Default Need to intercept acpi events for thinkpad. Where are the controls these days?

    I've been trying to configure events under /etc/acpi/events. I see a thinkpad_handler in under /etc/acpi/events/thinkpad , but, it doesn't seem to receive any events. I think someone has usurped power with a kernel module "fix" and hasn't told anyone. The X61 tablet is 90% of the way there with buttons. It's much better than it used to be, but, I can't re-use all the old scripts because someone has "fixed" everything without telling people.

    If you know who did this, can you ask them to post to this forum to tell everyone how things now are. I'm really getting tired of experimenting. Do I have to use setkeycodes to register the buttons or are they already handled somewhere? Where do I put handlers? I need to configure the screen rotation on tablet swivel position. This used to be handled by looking for:

    event=ibm/hotkey HKEY 00000080 0000500a
    event=ibm/hotkey HKEY 00000080 00005009

    What should people be doing now?

  2. #2
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Need to intercept acpi events for thinkpad. Where are the controlsthese days?

    On 06/04/2011 10:36 PM, X61 usr wrote:
    >
    > I think someone has usurped power with a kernel module "fix" and hasn't told anyone.


    perhaps you wish to interact directly with the folks that "fixed"
    everything and didn't tell anyone....by and large they don't come her to
    read questions or post information...

    this is a forum of (mostly) users helping (or trying to help) other users...

    but, the SUSE developers are available and you are welcome to ask them
    your questions on either IRC or in mail lists....both, easily accessed
    by you...details here:

    http://en.opensuse.org/openSUSE:Communication_channels

    be sure and ask'em why they hide such info....that will get you started
    off on the right foot with them!

    but, if it was (as you surmise) only the kernel hackers who conspired to
    ruin your day, you will need to touch base with them more directly,
    somehow....but, i wouldn't know if it was the openSUSE kernel crunchers,
    or the ones keeping secrets from Linus over at kernel.org so, you might
    want to begin here: http://en.opensuse.org/Kernel

    ps: some of the stuff they have hidden from the world might actually be
    uncovered somewhere in this secret cave:

    http://en.opensuse.org/openSUSE:Kernel_git

    Have a lot of fun!

    --
    dd CAVEAT: http://is.gd/bpoMD
    via NNTP openSUSE 11.4 [2.6.37.6-0.5] + KDE 4.6.0 + Thunderbird 3.1.10
    Acer Aspire One D255, 1.66 GHz Atom, 1 GB RAM, Intel Pineview graphics
    * When your gecko is broken you have a reptile dysfunction! *

  3. #3
    Join Date
    May 2011
    Location
    BMore City
    Posts
    36

    Default Re: Need to intercept acpi events for thinkpad. Where are the controlsthese days?

    You obviously think you're doing a good job with the communication. Well, it's not happening. Why should I have to dig through the kernel to get a few buttons to work? They were already working. Now, they're not controllable. I have a cron job running every five minutes to reset my wireless adaptor because thaw from sleep or suspend sometimes doesn't obey the commands I snuck into the video command file. Basically, there is no clear communication on where to put user commands to fix various problems at start time, suspend, sleep, thaw from sleep, thaw from suspend. It would be nice to know and to actually have it work.

    If I have to rip the guts out of a distro just to get screen rotation, I'm not going to be polite at all. As far as developers conspiring to do anything, that would imply communication. I'm happy that the developers fixed a few things. But if they're going to do it unilaterally, they need to tell people how it's going to be. They're not doing that, and, you're implying that I have the problem. Not at all. It's them that has the problem.

    Let me explain it this way: Imagine that you have a nice car that you give away to your friend. But shortly after investing a lot of time in getting it roadworthy, your friend finds out that he has to learn to fix the car's transmission and create some engineering changes to the engine computer to get it to be reliable. Your friend complains that he thought it was a conveyance to get him where he wanted to go, not a new hobby sucking up all his time. You say to your now angry friend that you just gave him a beautiful car and he should be a lot more respectful and thankful. You've clearly created problems for your friend by not being honest about the state of things. And, friend, that's how I feel about now.

    I'll talk to the developers. Hopefully they appreciate the fact that they broke stuff and that I'm willing to fix it. If not, it's off to some other distro.

  4. #4
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Need to intercept acpi events for thinkpad. Where are the controlsthese days?

    On 06/06/2011 07:36 AM, X61 usr wrote:
    >
    > Let me explain it this way: Imagine that you have a nice car that you
    > give away to your friend. But shortly after investing a lot of time in
    > getting it roadworthy, your friend finds out that he has to learn to fix
    > the car's transmission and create some engineering changes to the engine
    > computer to get it to be reliable. Your friend complains that he
    > thought it was a conveyance to get him where he wanted to go, not a new
    > hobby sucking up all his time. You say to your now angry friend that
    > you just gave him a beautiful car and he should be a lot more respectful
    > and thankful. You've clearly created problems for your friend by not
    > being honest about the state of things. And, friend, that's how I feel
    > about now.


    if my imaginary friend does not like the car i gave him, i should give
    him his money back [wait, he has none to expect back]..

    and move on to another car that does exactly what he wishes without
    frustration, fuss or re-engineering.

    no need to get angry...just move on and find someone else with a
    _better_ car, for free.

    --
    dd CAVEAT: http://is.gd/bpoMD
    via NNTP openSUSE 11.4 [2.6.37.6-0.5] + KDE 4.6.0 + Thunderbird 3.1.10
    Acer Aspire One D255, 1.66 GHz Atom, 1 GB RAM, Intel Pineview graphics
    * When your gecko is broken you have a reptile dysfunction! *

  5. #5
    Join Date
    May 2011
    Location
    BMore City
    Posts
    36

    Default Re: Need to intercept acpi events for thinkpad. Where are the controls these days?

    The developers offered help but ultimately didn't know the answer.

    Here's a temporary solution:
    Install the xbindkeys package. XBindKeys There is a repository which has it, but, I compiled from source. Run "configure --disable-guile" then "make" then "make install". The default installation puts things in good places. There is something up with the guile libraries from opensuse repositories that the code doesn't like.

    xbindkeys will allow you to intercept a keycode and execute a program in response. If you want to see the keycodes, install & use "xev" the X Event Viewer. You set up xbindkeys on a per-user basis by running "xbindkeys --defaults" from the user account. It creates the file .xbindkeysrc in the user's home directory. You need to configure this file, or, you can use mine. Keep in mind that the default .xbindkeysrc hooks control-f to open a terminal. This is A Bad Thing(TM) because it hooks it from absolutely every application, breaking the control-f that you typically use to open a search window. Keep in mind that I'm using KDE, so, I selected "Konsole" for my terminal window in .xbindkeysrc. You may want xterm or your favorite shell window. I also use xournal as my tablet writing software. This comes up when you press the tablet button right below rotate screen. This really should invoke a virtual keyboard, but, I haven't figured out that part yet.

    My .xbindkeysrc:

    # For the benefit of emacs users: -*- shell-script -*-
    ###########################
    # xbindkeys configuration #
    ###########################
    #
    # Version: 1.8.5
    #
    # If you edit this file, do not forget to uncomment any lines
    # that you change.
    # The pound(#) symbol may be used anywhere for comments.
    #
    # To specify a key, you can use 'xbindkeys --key' or
    # 'xbindkeys --multikey' and put one of the two lines in this file.
    #
    # The format of a command line is:
    # "command to start"
    # associated key
    #
    #
    # A list of keys is in /usr/include/X11/keysym.h and in
    # /usr/include/X11/keysymdef.h
    # The XK_ is not needed.
    #
    # List of modifier:
    # Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),
    # Mod3 (CapsLock), Mod4, Mod5 (Scroll).
    #

    # The release modifier is not a standard X modifier, but you can
    # use it if you want to catch release events instead of press events

    # By defaults, xbindkeys does not pay attention with the modifiers
    # NumLock, CapsLock and ScrollLock.
    # Uncomment the lines above if you want to pay attention to them.

    #keystate_numlock = enable
    #keystate_capslock = enable
    #keystate_scrolllock= enable

    # Examples of commands:

    "xbindkeys_show"
    control+shift + q

    # set directly keycode (here control + f with my keyboard)
    # "konsole"
    # c:41 + m:0x4

    # specify a mouse button for opening a shell window
    "konsole"
    control + b:2

    # Open file manager
    "/usr/bin/thunar"
    control+Mod1 + f

    # rotate screen
    "/usr/sbin/x61_rotate 4"
    XF86TouchpadToggle

    # Throw up xournal
    "/usr/bin/xournal"
    XF86ScreenSaver


    #"xterm -geom 50x20+20+20"
    # Shift+Mod2+alt + s
    #
    ## set directly keycode (here control+alt+mod2 + f with my keyboard)
    #"xterm"
    # alt + c:0x29 + m:4 + mod2
    #
    ## Control+Shift+a release event starts rxvt
    #"rxvt"
    # release+control+shift + a
    #
    ## Control + mouse button 2 release event starts rxvt
    #"rxvt"
    # Control + b:2 + Release

    ##################################
    # End of xbindkeys configuration #
    ##################################
    I've installed a script /usr/sbin/x61_rotate. You'll need to install a similar script or use mine. My script has been hacked together from one originally from dmg. As you can see it's kind of crufty and requires xrandr and xsetwacom (make sure you have those installed). There is allegedly a way to do everything from xrandr, but, I haven't figured it out yet.

    My rotation script. Make sure you have perl installed and at the right place. My perl is from the main respository, so, it shoudl work. Copy this script to /usr/sbin/x61_rotate and then "chown root:root /usr/sbin/x61_rotate" then "chmod o+x,g+x,u+x /usr/sbin/x61_rotate".
    #!/usr/bin/perl

    use strict;

    my $wacomDevice = '"Serial Wacom Tablet stylus"';

    my %rotation = (
    "normal" => 0,
    "right" => 1,
    "inverted" => 2,
    "left" => 3,
    );


    my @rotationInv = (
    "normal",
    "right",
    "inverted",
    "left"
    );

    #98 => up
    #100=> left
    #103 =>right
    #100=>down
    # Set the thumb-toggle on tablet display depending on orientation
    my @keycodesComplete = (
    "0x71 103 0x6f 108 0x6e 105 0x6d 106",
    "0x71 105 0x6f 106 0x6e 108 0x6d 103",
    "0x71 108 0x6f 103 0x6e 106 0x6d 105",
    "0x71 106 0x6f 105 0x6e 103 0x6d 108");


    my @keycodes = ('111', '113','116','114');
    my @mapKeys = ('Up', 'Left', 'Down', 'Right');

    # Translate current rotation into the rotation values of this script
    my $current = Find_Display_Rotation();

    my @wacom = ('"NONE"', '"CW"', '"HALF"', '"CCW"');
    # Get input
    my $next = $ARGV[0];

    # The + is rotation clockwise, - rotation counterclockwise
    # The 0-3 correspond to %rotation & @wacom arrays
    if ($next >= 0 && $next <= 3) {
    $current = $next;
    }
    elsif ($next eq "4") {
    if ($current == 0) {
    $current = 3;
    }
    elsif ($current == 3) {
    $current = 0;
    }
    }
    elsif ($next eq "-") {
    $current --;
    } elsif ($next eq "+" ) {
    $current ++;
    } elsif ($next eq "") {
    $current ++;
    } else {
    $current = $next;
    }

    # Make sure we're between 0 and 3 with the rotation setting
    $current %=4;
    # print "Setting to : $current\n";

    # die "invalid current [$current]" unless $current >= 0 and $current <4;

    # set xrandr

    # print "Setting $rotationInv[$current]\n";
    print `xrandr -display :0.0 -o $rotationInv[$current]`;
    #print `xrandr -display :0.0 --output LVDS --pos 0x0 `;
    # print "xsetwacom --set $wacomDevice Rotate $wacom[$current]";
    print `xsetwacom --set $wacomDevice Rotate $wacom[$current]`;
    #print `xmodmap -e 'keycode 146 = Menu'`;
    #print `sawfish-client --display :0.0 -e '(dmg-move-current-window-inside)'`;
    #Set_Wacom_Tablet();

    # This command would set the thumb toggle buttons based on rotation
    set_keys($current);

    exit;




    sub Set_Wacom_Tablet
    {
    my ($currentRotation) = @_;
    # x1, y1, x2, y2
    my @coor = ( -27, 47, 18509, 24701);
    my @where = ("topx", "topy", "bottomx", "bottomy");
    my $command = "/usr/bin/xsetwacom";

    if ($current %2 == 1) {
    for my $i (0..3) {
    print `$command set eraser $where[$i] '$coor[$i]'`;
    print `$command set stylus $where[$i] '$coor[$i]'`;
    }
    }
    }


    sub Find_Display_Rotation
    {
    my $mode = `/usr/bin/xrandr --verbose| grep LVDS`;

    if ($mode =~ / +([a-z]+) +\(/) {
    } else {
    print STDERR "UNable to detect mode $mode\n";
    die;
    }
    die "($mode) ($1) " if ($1 ne "right" and
    $1 ne "left" and
    $1 ne "inverted" and
    $1 ne "normal");

    return $rotation{$1};
    }


    sub set_keys
    {
    my ($rotation) = @_;
    my ($a) = $keycodesComplete[$rotation];
    print `/bin/setkeycodes $a`;

    }
    This particular hack uses the screen rotate button on the tablet to toggle back and forth between the typical landscape and portrait positions. It's not the ideal behavior. The ideal behavior is for the rotate screen button to rotate sequentially to all orientations and for the tablet swivel position switch to indicate toggling between typical positions. I can't figure out where to access the tablet swivel. I'll get back here with a new post when I find it.

    @DenverD: This is what helping looks like. This level of effort wouldn't be necessary if everyone upstream had documented their changes. So, I have a right to be angry, and, you shouldn't have anything to say to me about that.

  6. #6
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Need to intercept acpi events for thinkpad. Where are the controlsthese days?

    On 06/12/2011 05:36 PM, X61 usr wrote:
    >
    > @DenverD: This is what helping looks like. This level of effort
    > wouldn't be necessary if everyone upstream had documented their changes.
    > So, I have a right to be angry, and, you shouldn't have anything to say
    > to me about that.


    thank you for your lecture on how to help...it might come in useful..

    on your anger: be angry all you want, but how is that helping you? or
    helping openSUSE, or open source or your Thinkpad?

    un-anger yourself, you will live longer and each day will be better.

    finally, why not hook your rotate work-around to Ctrl+r instead of Ctrl+f ?

    --
    dd CAVEAT: http://is.gd/bpoMD
    via NNTP openSUSE 11.4 [2.6.37.6-0.5] + KDE 4.6.0 + Thunderbird 3.1.10
    Acer Aspire One D255, 1.66 GHz Atom, 1 GB RAM, Intel Pineview graphics
    * When your gecko is broken you have a reptile dysfunction! *

  7. #7
    Join Date
    May 2011
    Location
    BMore City
    Posts
    36

    Default Re: Need to intercept acpi events for thinkpad. Where are the controlsthese days?

    Ctl-f was the default setting that comes with xbindkeys. It was just an example put there by them, which I removed because of the problem it causes. The terminal is now invoked by Ctl-button 2, and ctl-alt-f invokes the file manager. However, xbindkeys keeps dying after resuming from sleep. If only there was someone I could ask about scripts run after sleep & suspend that actually had answers. But NO..... I'm sure I'll have to research that myself. You see, DenverD, De Nile isn't just a river in Egypt. Linux makes people angry & frustrated while other OS's come pre-loaded and mostly work. If I weren't so pissed off at Microsoft, I would never consider linux.

    I have since solved all problems for screen rotation but the code isn't quite angry enough to publish. I'll probably put the finished solution up this weekend or next. It's currently written in perl and I'd like to rewrite in bash.

  8. #8
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Need to intercept acpi events for thinkpad. Where are the controlsthese days?

    On 06/14/2011 05:06 PM, X61 usr wrote:
    >
    > If I weren't so pissed off at Microsoft, I would never consider linux.


    maybe you could find more smiles with Apple??

    --
    dd
    http://is.gd/bpoMD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •