You are not logged in.

#1 2013-02-26 01:05:45

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

Reacting to evdev input events

Hi there.
Did anyone know where/how the evdev events are handled and how I can configure them?
I already know that the DM (in my case cinnamon/gnome) and logind (from systemd) handles some of them.
But now I discoverd that the display rotate button on my lenovo x230 tablet is working but I can't find what is responsible for this.
I got some other buttons on this tablet I would like to get working too. Like the tablet mode button when I rotate the screen.

Thanks!


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

#2 2013-02-26 01:39:23

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,548
Website

Re: Reacting to evdev input events

I'm not sure I understand the question.  Evdev just generates events for all the input hardware.  Any X11 program can register for and respond to those events.  I suspect the ones you mention could be bound with xbindkeys.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2013-02-26 09:49:19

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

Re: Reacting to evdev input events

Sorry for my vague question, was a bit late when I ask it wink

I wanted to find out which application handles the event of the "display rotate" button and then configure it to handle those other buttons (tablet-mode, direction-switch, etc.) too.
Is tracing those events in X possible?

I tried different DEs (Gnome, Cinnamon, Awesome) and this button only works in Gnome and Cinnamon. But I didn't find the settings to configure this specific event (hardcoded?).
(control-center keyboard doesn't have the entry and I couldn't find it with the (g|d)conf-editor)
The control-center doesn't recognise the "tablet mode switch" event.

Then I simply tried fuser on the input-devices:

$ ls /dev/input/
by-id  by-path  event0  event1  event10  event11  event12  event13  event14  
event15  event16  event2  event3  event4  event5  event6  event7  event8  
event9  mice  mouse0  mouse1  mouse2

$ fuser /dev/input/*
/dev/input/event0:   11104
/dev/input/event1:   11092 11096
/dev/input/event14:  11104
/dev/input/event15:  11104
/dev/input/event16:  11104
/dev/input/event2:   11092 11104
/dev/input/event3:   11092 11104
/dev/input/event4:   11092 11104
/dev/input/event6:   11092 11104

$ ps 11092 11104 11096
  PID TTY      STAT   TIME COMMAND
11092 ?        Ss     0:00 /usr/lib/systemd/systemd-logind
11096 ?        Ssl    0:00 /usr/lib/upower/upowerd
11104 tty7     Rs+    0:30 /usr/bin/X :0 vt07 -nolisten tcp

The "tablet mode switch" event is defined in "/dev/input/event7" and the xserver (and everyone else) are ignoring this device.
Edit: I was mistaken its "/dev/input/event6"
(Find this with evtest)

So what are my options? Should I configure the xserver directly to listen to this input device or do I have to configure udev for this?

I don't have much experience writing udev rules or configuring the xserver on this level, so maybe some hints would be appreciated.

I don't have xbindkeys installed but I'm looking into this.

Last edited by PyroDevil (2013-02-26 13:07:14)


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

#4 2013-02-26 11:56:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,548
Website

Re: Reacting to evdev input events

What is it you are actually trying to do?  Do you want to get your system to respond to something it is not responding to, or to stop responding to something it is?

If no process is responding to it, the tablet mode switch could be handled at a hardware/firmware level like wifi toggles often are.

xbindkeys will allow you to assign actions to any xinput event.  Xev will allow you to see what (if any) events are generated by those buttons.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2013-02-26 12:54:47

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

Re: Reacting to evdev input events

Ok, I try it step for step now.

The "tablet mode switch" is triggered if I rotate the screen. But nothing happens. No hardware or firmware does anything.
And I want to change that. I want that everytime I rotate my screen, it should rotate the interface and tablet-input devices 180°.

With evtest I get an output:

$ evtest /dev/input/event6
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x17aa product 0x5054 version 0x4101
Input device name: "ThinkPad Extra Buttons"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 142 (KEY_SLEEP)
    Event code 148 (KEY_PROG1)
    Event code 152 (KEY_SCREENLOCK)
    Event code 191 (KEY_F21)
    Event code 194 (KEY_F24)
    Event code 205 (KEY_SUSPEND)
    Event code 212 (KEY_CAMERA)
    Event code 224 (KEY_BRIGHTNESSDOWN)
    Event code 225 (KEY_BRIGHTNESSUP)
    Event code 227 (KEY_SWITCHVIDEOMODE)
    Event code 228 (KEY_KBDILLUMTOGGLE)
    Event code 236 (KEY_BATTERY)
    Event code 238 (KEY_WLAN)
    Event code 240 (KEY_UNKNOWN)
    Event code 248 (?)
    Event code 372 (KEY_ZOOM)
    Event code 466 (KEY_FN_F1)
    Event code 475 (KEY_FN_F10)
    Event code 476 (KEY_FN_F11)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
  Event type 5 (EV_SW)
    Event code 1 (SW_TABLET_MODE)
    Event code 3 (SW_RFKILL_ALL)
Properties:
Testing ... (interrupt to exit)
Event: time 1361881621.847932, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 1
Event: time 1361881621.847932, -------------- SYN_REPORT ------------
Event: time 1361881623.370297, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 0
Event: time 1361881623.370297, -------------- SYN_REPORT ------------

(Oh, I was mistaken its event6...)

Xev doesn't recognize this event.

For some time I tried it with acpid, because it could handle this event.
But everytime I started acpid, and rotated the screen, the x server crashed.
Now I deactivated acpid and I can rotate my screen, but nothing happens.
(But it's better than landing on the dm wink )

I wanted to find where the "rotate screen" button is handled, to let it handle the "tablet mode" switch too.
But maybe that is not possible, because xev does recognize this button, but not the "tablet mode" switch.
And finding which application handles which xinput event could be complicated.

What do I have to do so that the "tablet mode" switch is recognized by xev and the x server in general and therefore could be used as key binding to rotate the screen?

Sorry if I was ambiguous.


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 2013-03-01 10:11:49

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

Re: Reacting to evdev input events

I think I found why this isn't possible:
https://bugs.freedesktop.org/show_bug.cgi?id=37404

The "tablet mode" is a switch and not a button, so they don't know how it can be mapped to X events.


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

Board footer

Powered by FluxBB