From patchwork Mon Nov 2 13:35:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WEN Pingbo X-Patchwork-Id: 7536691 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 517FFBF90C for ; Mon, 2 Nov 2015 13:36:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7389F20608 for ; Mon, 2 Nov 2015 13:36:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A6C9204AF for ; Mon, 2 Nov 2015 13:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752788AbbKBNgn (ORCPT ); Mon, 2 Nov 2015 08:36:43 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:34690 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752532AbbKBNgm (ORCPT ); Mon, 2 Nov 2015 08:36:42 -0500 Received: by padec8 with SMTP id ec8so40337902pad.1 for ; Mon, 02 Nov 2015 05:36:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y2/dcWEl8dzN5Qh0ZL7e/beIb5bQzHkVCjsbjBb5AFA=; b=DhegbeyXTDKYpTrjA4jTS5Jo4UyKuVV3+4heRIMNcAy9Yx292e2a7uUHB6A7/2hmpU SBoyWJlRj4uXsdN+LPOb3lYNd71UVjNgPgR88rc+BD2gVZczvn8fLxJ6oCGCvUJQQ50a I0Qhjn9KbLyuMQ7i8WKXPV2cjt2a0PjHOD9D5RNoIZrMM2glmt51+MZvejqC8LtBOKmL 6XGbkN8lS3QlHQYNLOl3CQVLS4q4KWZMsPmGl8l5fd8GzBPqf7Fo3Ik2KkgwwUUosSNN TE4aGH3Z8/dcCOc5EEfuKtCZMLudEPMp2jRadoW4Yf6CWK7RV+z4diKzpYXJI+4sy8bb 2fxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y2/dcWEl8dzN5Qh0ZL7e/beIb5bQzHkVCjsbjBb5AFA=; b=Cz9xBWXN5NEDYslkd4uD1jlBgfZ+/7fbpu2nadn+r8rQmqkiozZ3I4JyZAoSiltN5/ S7fc9jfR3aN3V+ufOSQUuUWGrQN6aeHv5ZjCep2j31Ip7BdkMvBq0ucejX9ETZe9QIob 0HRkJrYSSzKcCT6r1ytkGStLOzHV8NycNNc1CZpWtmAx9gGEiUKtnLGuCZhHVvbwrSUR t/pRQiXpvfJslz+lzwD+oKejdm1NlNXuvMu/YQ0WOKbfk1gNPsS9Va9xXqe3KzV/aS1K 2dyODtct8gRRZ2+cq6Kmb1y/MJ03ga3glSJfsvTxAHwxTo8AVkZMYHKAgouJxfOH8a6W nDsg== X-Gm-Message-State: ALoCoQkNXvU75yIaMSYn4eT19hXCRHvkVS2+1XcnkuPlhyu5S8w0c+2XG/a1kyw6D3/wYo9nJZw7 X-Received: by 10.66.153.139 with SMTP id vg11mr27254627pab.118.1446471402585; Mon, 02 Nov 2015 05:36:42 -0800 (PST) Received: from localhost.localdomain (edge03.meizu.com. [202.130.115.78]) by smtp.gmail.com with ESMTPSA id si10sm24240302pab.15.2015.11.02.05.36.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Nov 2015 05:36:42 -0800 (PST) From: WEN Pingbo To: linux-input@vger.kernel.org Cc: y2038@lists.linaro.org, arnd@arndb.de, dmitry.torokhov@gmail.com, WEN Pingbo Subject: [PATCH 2/3] evdev: add new ioctl EVIOCSEVENT / EVIOCGEVENT Date: Mon, 2 Nov 2015 21:35:38 +0800 Message-Id: <1446471339-25464-3-git-send-email-pingbo.wen@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446471339-25464-1-git-send-email-pingbo.wen@linaro.org> References: <1446471339-25464-1-git-send-email-pingbo.wen@linaro.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The two ioctl command is used to set is_input_event64 flag. All userspace programs must set this flag to true, before using the new input_event64 structure. Signed-off-by: WEN Pingbo --- drivers/input/evdev.c | 9 +++++++++ include/uapi/linux/input.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 815487f..990a083 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -863,6 +863,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, int __user *ip = (int __user *)p; unsigned int i, t, u, v; unsigned int size; + int event_flag; int error; /* First we check for fixed-length commands */ @@ -937,6 +938,14 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, case EVIOCSKEYCODE_V2: return evdev_handle_set_keycode_v2(dev, p); + case EVIOCSEVENT: + if (get_user(event_flag, ip)) + return -EFAULT; + client->is_input_event64 = !!event_flag; + + return 0; + case EVIOCGEVENT: + return put_user(client->is_input_event64, ip); } size = _IOC_SIZE(cmd); diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 1e252ff..966ce8f 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -171,6 +171,9 @@ struct input_keymap_entry { #define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ +#define EVIOCSEVENT _IOW('E', 0xa1, int) /* Set input_event64 flag*/ +#define EVIOCGEVENT _IOR('E', 0xa2, int) /* Get input_event64 flag*/ + /* * Device properties and quirks */