<div dir="ltr">The kernel version used to build Weston isn't necessarily the same as the version that will be used to run it. Weston should already work fine on older versions: the second ioctl will return an error - but it's ok as long as the first one succeeds.<div><br></div><div>Also, a compile-time check would prevent Weston built on an old kernel from taking advantage of new features when running on a new kernel.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 27, 2016 at 9:37 AM, Krzysztof Konopko <span dir="ltr"><<a href="mailto:kris@youview.com" target="_blank">kris@youview.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Tomasz SZKUTKOWSKI <<a href="mailto:tomasz.szkutkowski@youview.com">tomasz.szkutkowski@youview.<wbr>com</a>><br>
<br>
This patch disables unsupported ioctl `KDGKBMODE K_OFF` command if Weston<br>
is built against kernel older than 2.6.39, as this ioctl has been<br>
introduced in 2.6.39 kernel version.<br>
<br>
No functional changes have been observed by disabling this ioctl.<br>
<br>
Signed-off-by: Tomasz SZKUTKOWSKI <<a href="mailto:tomasz.szkutkowski@youview.com">tomasz.szkutkowski@youview.<wbr>com</a>><br>
Signed-off-by: Krzysztof Konopko <<a href="mailto:kris@youview.com">kris@youview.com</a>><br>
---<br>
libweston/launcher-direct.c | 5 +++++<br>
libweston/weston-launch.c | 5 +++++<br>
2 files changed, 10 insertions(+)<br>
<br>
diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c<br>
index 29d9c28..34fe5cd 100644<br>
--- a/libweston/launcher-direct.c<br>
+++ b/libweston/launcher-direct.c<br>
@@ -34,6 +34,7 @@<br>
#include <linux/vt.h><br>
#include <linux/kd.h><br>
#include <linux/major.h><br>
+#include <linux/version.h><br>
<br>
#include "launcher-impl.h"<br>
<br>
@@ -157,8 +158,12 @@ setup_tty(struct launcher_direct *launcher, int tty)<br>
goto err_close;<br>
}<br>
<br>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)<br>
if (ioctl(launcher->tty, KDSKBMUTE, 1) &&<br>
ioctl(launcher->tty, KDSKBMODE, K_OFF)) {<br>
+#else<br>
+ if (ioctl(launcher->tty, KDSKBMUTE, 1)) {<br>
+#endif<br>
weston_log("failed to set K_OFF keyboard mode: %m\n");<br>
goto err_close;<br>
}<br>
diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c<br>
index 140fde1..74b80dd 100644<br>
--- a/libweston/weston-launch.c<br>
+++ b/libweston/weston-launch.c<br>
@@ -49,6 +49,7 @@<br>
#include <linux/vt.h><br>
#include <linux/major.h><br>
#include <linux/kd.h><br>
+#include <linux/version.h><br>
<br>
#include <pwd.h><br>
#include <grp.h><br>
@@ -561,8 +562,12 @@ setup_tty(struct weston_launch *wl, const char *tty)<br>
if (ioctl(wl->tty, KDGKBMODE, &wl->kb_mode))<br>
error(1, errno, "failed to get current keyboard mode: %m\n");<br>
<br>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)<br>
if (ioctl(wl->tty, KDSKBMUTE, 1) &&<br>
ioctl(wl->tty, KDSKBMODE, K_OFF))<br>
+#else<br>
+ if (ioctl(wl->tty, KDSKBMUTE, 1))<br>
+#endif<br>
error(1, errno, "failed to set K_OFF keyboard mode: %m\n");<br>
<br>
if (ioctl(wl->tty, KDSETMODE, KD_GRAPHICS))<br>
--<br>
2.1.4<br>
<br>
This transmission contains information that may be confidential and contain personal views which are not necessarily those of YouView TV Ltd. YouView TV Ltd (Co No:7308805) is a limited liability company registered in England and Wales with its registered address at YouView TV Ltd, 3rd Floor, 10 Lower Thames Street, London, EC3R 6YT. For details see our web site at <a href="http://www.youview.com" rel="noreferrer" target="_blank">http://www.youview.com</a><br>
______________________________<wbr>_________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/wayland-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/wayland-devel</a><br>
</blockquote></div><br></div>