From: Devrin Talen <dct23@cornell.edu>
To: <gentoo-user@lists.gentoo.org>
Subject: [gentoo-user] Tablet rotation button broken in <=sys-apps/systemd-226-r2
Date: Fri, 26 Aug 2016 20:25:20 -0400 [thread overview]
Message-ID: <CA+FDhMNTdR2bRASL47O6ok+m+FSiC3hcvMA9iXC17knYsur42w@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2058 bytes --]
Hey all,
I noticed recently that the screen rotation button on my Lenovo X201T
tablet was no longer working, whereas it had been working some time ago.
Long story short, there was a change around version 226 of systemd that
broke this. I wanted to document how I got it working again and send it
out in case it helps anyone else.
This issue on Github [1] explains the problem and the patch that fixes it:
[1]: https://github.com/systemd/systemd/issues/1151
Rather than unmask a newer version of systemd I decided to try applying the
pull request to the current stable version in gentoo, which is
systemd-226-r2. I created /etc/portage/patches/sys-apps/systemd and saved
the patch from the PR (cleaned up for 226-r2 and attached) there. I then
rebuilt systemd, rebooted, and - voila - the rotate button is working again.
So (as root):
# mkdir -p /etc/portage/patches/sys-apps/systemd # then copy the patch
here
# emerge --oneshot sys-apps/systemd
That took a fair amount of googling around to root cause since I had no
idea where to begin, but ended up being a pretty simple fix. When a newer
version of systemd gets stabilized I'll probably be able to drop that patch.
I do have a question though for anyone that can explain it: in the
patchfile I ended up putting in /etc/portage/patches I had to delete the
first slash in the filenames. So for instance lines 27-31 of the patchfile
that works are this:
diff --git a/Makefile.am b/Makefile.am
index 8646e55..e3e07b8 100644
--- Makefile.am
+++ Makefile.am
But in the raw git diff they were:
diff --git a/Makefile.am b/Makefile.am
index 8646e55..e3e07b8 100644
--- a/Makefile.am
+++ b/Makefile.am
If I don't delete those prefixes then portage complains when applying the
patch:
ERROR: prepare
Failed Patch: fix-keymap-aliases.patch !
( /etc/portage/patches//sys-apps/systemd/fix-keymap-aliases.patch )
But existing patches in the /usr/portage/sys-apps/systemd/files directory
have the a/ and b/ prefixes. So what gives?
Thanks,
Devrin
[-- Attachment #1.2: Type: text/html, Size: 2430 bytes --]
[-- Attachment #2: fix-keymap-aliases.patch --]
[-- Type: text/x-patch, Size: 3770 bytes --]
From 4c1482202957828a37e88e42c49e9ac8ef12c960 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Tue, 13 Oct 2015 18:20:34 +0200
Subject: [PATCH 1/3] keymap: Recognize KEY_* aliases
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
linux/input.h contains alias definitions like
#define KEY_COFFEE 152
#define KEY_SCREENLOCK KEY_COFFEE
#define KEY_ROTATE_DISPLAY 153
#define KEY_DIRECTION KEY_ROTATE_DISPLAY
But we ignored these when building keyboard-keys-list.txt. Also allow the value
to start with "K" now (for KEY_*), and drop the hardcoded COFFEE → SCREENLOCK
aliasing.
This fixes assignments to key "direction".
Fixes #1151
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 8646e55..e3e07b8 100644
--- Makefile.am
+++ Makefile.am
@@ -3483,7 +3483,7 @@ noinst_LTLIBRARIES += \
src/udev/keyboard-keys-list.txt:
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include linux/input.h - < /dev/null | $(AWK) '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@
+ $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include linux/input.h - < /dev/null | $(AWK) '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9K]/ { if ($$2 != "KEY_MAX") { print $$2 } }' > $@
src/udev/keyboard-keys-from-name.gperf: src/udev/keyboard-keys-list.txt
$(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print tolower(substr($$1 ,5)) ", " $$1 }' < $< > $@
From 1d3f8fa747b71db60872bc21df5b6489b73b740d Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Wed, 14 Oct 2015 06:52:41 +0200
Subject: [PATCH 3/3] keymap: Drop keyboard-keys-to-name.h
We don't use that anywhere any more. With the introduction of alias names it
also is not a proper mapping any more as several keys (e. g. KEY_COFFEE and
KEY_SCREENLOCK) have the same numerical mapping.
---
Makefile.am | 6 +-----
src/udev/.gitignore | 1 -
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index e3e07b8..336ba0a 100644
--- Makefile.am
+++ Makefile.am
@@ -1229,7 +1229,7 @@ BUILT_SOURCES += \
$(gperf_gperf_m4_sources:-gperf.gperf.m4=-gperf-nulstr.c) \
$(gperf_gperf_sources:-gperf.gperf=-gperf.c) \
$(gperf_txt_sources:-list.txt=-from-name.h) \
- $(gperf_txt_sources:-list.txt=-to-name.h)
+ $(filter-out %keyboard-keys-to-name.h,$(gperf_txt_sources:-list.txt=-to-name.h))
CLEANFILES += \
$(gperf_txt_sources:-list.txt=-from-name.gperf)
@@ -3491,9 +3491,6 @@ src/udev/keyboard-keys-from-name.gperf: src/udev/keyboard-keys-list.txt
src/udev/keyboard-keys-from-name.h: src/udev/keyboard-keys-from-name.gperf
$(AM_V_GPERF)$(GPERF) -L ANSI-C -t -N keyboard_lookup_key -H hash_key_name -p -C < $< > $@
-src/udev/keyboard-keys-to-name.h: src/udev/keyboard-keys-list.txt
- $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@
-
gperf_txt_sources += \
src/udev/keyboard-keys-list.txt
@@ -3520,7 +3517,6 @@ libudev_core_la_SOURCES = \
nodist_libudev_core_la_SOURCES = \
src/udev/keyboard-keys-from-name.h \
- src/udev/keyboard-keys-to-name.h \
src/udev/net/link-config-gperf.c
gperf_gperf_sources += \
diff --git a/src/udev/.gitignore b/src/udev/.gitignore
index ba112ce..f5d8be3 100644
--- src/udev/.gitignore
+++ src/udev/.gitignore
@@ -1,5 +1,4 @@
/udev.pc
/keyboard-keys-from-name.gperf
/keyboard-keys-from-name.h
-/keyboard-keys-to-name.h
/keyboard-keys-list.txt
next reply other threads:[~2016-08-27 0:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-27 0:25 Devrin Talen [this message]
2016-08-27 11:55 ` [gentoo-user] Tablet rotation button broken in <=sys-apps/systemd-226-r2 Stroller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+FDhMNTdR2bRASL47O6ok+m+FSiC3hcvMA9iXC17knYsur42w@mail.gmail.com \
--to=dct23@cornell.edu \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox