You are not logged in.

#1 2012-10-14 19:19:20

Ponder
Member
Registered: 2012-10-14
Posts: 5

acpid crashes X server on Thinkpad X201t

At least I hope this classifies as an laptop issue.

Anyway. The problem is that if, I start the acpid daemon from a different vt as the one X in running on, X crashes if swivel the display into tablet mode. This is the output from the X server. The weird thing is, that if I start a terminal emulator inside X and start acpid from there, everything works just fine.

I'm not sure whether acpid clashes with thinkpad-acpi or something else, because "ps aux | grep acpid" tells that there is also a "[ktpacpid]" running. But I don't to what this one belongs.

I actually only want to use acpid to detect whether the PC is in tablet mode or not so if anybody has a pointer on how I could detect this otherwise, that would be nice too.

Offline

#2 2012-10-14 19:24:01

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: acpid crashes X server on Thinkpad X201t

I think that it is probably indicated somewhere is /sys, so if you can figure that out, you can simply apply a udev rule to it.

Offline

#3 2012-10-14 21:04:59

mind_the_gap
Member
Registered: 2010-07-27
Posts: 14

Re: acpid crashes X server on Thinkpad X201t

This problem occurs to me and to some others as well and we started to discuss it here. Unfortunately, I can't provide a solution yet. There also seems to be a related bug report: here. There is said that downgrading acpid might help for now. However, I didn't try yet. The reason seems to be related to a recent introduction of a new tablet mode event in acpid.

Offline

#4 2012-10-15 02:37:22

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: acpid crashes X server on Thinkpad X201t

Here is instruction on how to use a udev rule to run a script when one's laptop is plugged/unplugged.  Using it for your purposes would be quite similar.  Of course you would have to figure out what value is changing in /sys when you flip the screen. 
https://wiki.archlinux.org/index.php/La … _udev_rule

That said, here is some info on how to get started writing udev rules.
http://www.reactivated.net/writing_udev_rules.html

It is a bit outdated, in that the command is now udevadm.  So to find the necessary parameters to put into your rule, you would do something like

$ udevadm info --attribute-walk --path=/bus/usb/devices/usb1

for the usb1 device located at /sys/bus/devices/usb1 (notice in the udevadm command, you leave out the initial /sys).

Good luck!

Offline

#5 2012-10-15 17:29:46

PyroDevil
Member
Registered: 2012-06-25
Posts: 33

Re: acpid crashes X server on Thinkpad X201t

Hi!
I got the same problem with my X230t.
I think that this problem is not related to udev, because if acpid is disabled the rotation switch is ignored and the x server doesn't break.
I only can think of 2 possibilities here:
1. bug in the new acpi "video/tabletmode" event
2. bug in x-server or gnome by handling the acpi event. (I didn't tried kde or others)

I tried to write a acpid configuration file for this event and it works fine (automatic tablet-rotation) till the x server breaks but only after acpid handled this event.

Here a log from this:

Oct 15 19:10:04 Orrorin acpid[19119]: client connected from 19453[0:0]
Oct 15 19:10:04 Orrorin acpid[19119]: 1 client rule loaded
Oct 15 19:10:07 Orrorin logger[20107]: ACPI action: Tabletmode on
Oct 15 19:10:07 Orrorin logger[20113]: ACPI group/action undefined: video/tabletmode / TBLT
Oct 15 19:10:07 Orrorin gnome-session[19547]: Gdk-WARNING: gnome-session: Fatal IO error 11 (The resource is not currently available) on X server :3.
Oct 15 19:10:07 Orrorin systemd-logind[9580]: Removed session 137.

So maybe waiting for a fix would be the solution...

Last edited by PyroDevil (2012-10-15 17:31:08)


Probably the last man who knew how it worked had been tortured to death years before.
Or as soon as it was installed. Killing the creator was a traditional method of patent protection.
(Small Gods)

Offline

#6 2012-10-15 18:05:34

Ponder
Member
Registered: 2012-10-14
Posts: 5

Re: acpid crashes X server on Thinkpad X201t

mind_the_gap wrote:

This problem occurs to me and to some others as well and we started to discuss it here. Unfortunately, I can't provide a solution yet. There also seems to be a related bug report: here. There is said that downgrading acpid might help for now. However, I didn't try yet. The reason seems to be related to a recent introduction of a new tablet mode event in acpid.

Thanks for that, I thought I had bricked something.

WonderWoofy wrote:

Good luck!

Thanks for the pointers, going to investigate that, let the quest begin!

Last edited by Ponder (2012-10-15 18:09:05)

Offline

#7 2012-10-15 20:34:20

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: acpid crashes X server on Thinkpad X201t

There's also related bug - some distros don't compile xorg-server with ACPI support.

Offline

#8 2012-10-20 08:31:40

Ponder
Member
Registered: 2012-10-14
Posts: 5

Re: acpid crashes X server on Thinkpad X201t

@WonderWuffy
Found it, the file /sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode holds 0 or 1, whether it is in "normal mode" or in tablet mode.
Thanks for the help again.
EDIT: I don't think I'm using a udev rule, though. I'll just have my script look the sys file up.

Last edited by Ponder (2012-10-20 23:59:18)

Offline

#9 2013-02-28 19:42:48

brad
Member
From: Eugene, Oregon, USA
Registered: 2013-01-25
Posts: 18
Website

Re: acpid crashes X server on Thinkpad X201t

@Ponder, good find. Thanks for that! It's the same on the x230t btw.

Offline

#10 2013-04-08 09:14:16

Guillaume
Member
Registered: 2013-04-08
Posts: 2

Re: acpid crashes X server on Thinkpad X201t

As of version 2.0.18, acpid now sends "correct" string, and X does not crash anymore!!

If it interests anybody, on a lenovo X230T, you can turn on auto rotation by:

-------- start of /etc/acpi/events/rotate ---------
event=video*
action=/your/homedirectory/bin/thinkpad_handler.sh "%e"
-------- end of /etc/acpi/events/rotate ---------

-------- start of /your/homedirectory/bin/thinkpad_handler.sh ---------
#!/bin/bash

USER=`who | grep ':0' | grep -o '^\w*' | head -n1`
sudo -u $USER -i /home/$USER/bin/smart_rotate $@
-------- end of /your/homedirectory/bin/thinkpad_handler.sh ---------

-------- start of /your/homedirectory/bin/smart_rotate ---------
#!/usr/bin/perl -w

if($ARGV[0] !~ /video\/tabletmode/){
  die;
}

$tabletmodefile="/sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode";

if(-e "$tabletmodefile"){
  $tabletmode=`cat $tabletmodefile`;
  chomp($tabletmode);
  if(!$tabletmode){
    system("export DISPLAY=:0; xrandr --output LVDS1 --rotate normal");
    system("export DISPLAY=:0; xsetwacom --set \"Wacom ISDv4 90 Pen stylus\" rotate none");
  }else{
    system("export DISPLAY=:0; xrandr --output LVDS1 --rotate inverted");
    system("export DISPLAY=:0; xsetwacom --set \"Wacom ISDv4 90 Pen stylus\" rotate half");
  }
}
-------- end of /your/homedirectory/bin/smart_rotate ---------

Offline

Board footer

Powered by FluxBB