Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751014AbeABVs6 (ORCPT + 1 other); Tue, 2 Jan 2018 16:48:58 -0500 Received: from mail-wr0-f179.google.com ([209.85.128.179]:44044 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbeABVs4 (ORCPT ); Tue, 2 Jan 2018 16:48:56 -0500 X-Google-Smtp-Source: ACJfBov8JcupJTca5ORAHJK0QAE/g2Jxpt3kEJFh5rZ9+GBOzZ5b+VnZMo25Mx6EOR2uyKyMQmydUQ== Date: Tue, 2 Jan 2018 22:48:52 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Bastien Nocera Cc: Dmitry Torokhov , Sebastian Reichel , Pavel Machek , Mauro Carvalho Chehab , Chuck Ebbert , Henrik Rydberg , Ivaylo Dimitrov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] input: Add disable sysfs entry for every input device Message-ID: <20180102214852.pnsocg7qaxt5y6qh@pali> References: <1482660296-8432-1-git-send-email-pali.rohar@gmail.com> <1483370825.2420.8.camel@hadess.net> <201701021809.58943@pali> <1483442481.2420.12.camel@hadess.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1483442481.2420.12.camel@hadess.net> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tuesday 03 January 2017 12:21:21 Bastien Nocera wrote: > On Mon, 2017-01-02 at 18:09 +0100, Pali Rohár wrote: > > On Monday 02 January 2017 16:27:05 Bastien Nocera wrote: > > > On Sun, 2016-12-25 at 11:04 +0100, Pali Rohár wrote: > > > > This patch allows user to disable events from any input device so > > > > events > > > > would not be delivered to userspace. > > > >  > > > > Currently there is no way to disable particular input device by > > > > kernel. > > > > User for different reasons would need it for integrated PS/2 > > > > keyboard or > > > > touchpad in notebook or touchscreen on mobile device to prevent > > > > sending > > > > events. E.g. mobile phone in pocket or broken integrated PS/2 > > > > keyboard. > > > >  > > > > This is just a RFC patch, not tested yet. Original post about > > > > motivation > > > > about this patch is there: https://lkml.org/lkml/2014/11/29/92 > > >  > > > Having implemented something of that ilk in user-space (we > > > automatically disable touch devices when the associated screen is > > > turned off/suspended), I think this might need more thought. > > > > How to implement such thing in userspace? I think you cannot do that  > > without rewriting every one userspace application which uses input. > > > > > What happens when a device is opened and the device disabled > > through > > > sysfs, are the users revoked? > > > > Applications will not receive events. Same as if input device does > > not  > > generates events. > > > > > Does this put the device in suspend in the same way that closing > > the > > > device's last user does? > > > > Current code not (this is just RFC prototype), but it should be > > possible  > > to implement. > > > > > Is this not better implemented in user-space at the session level, > > > where it knows about which output corresponds to which input > > device? > > > > How to do that without rewriting existing applications? > > > > > Is this useful enough to disable misbehaving devices on hardware, > > so > > > that the device is not effective on boot?   > > > > In case integrated device is absolutely unusable and generates > > always  > > random events, it does not solve problem at boot time. > > > > But more real case is laptop with closed LID press buttons and here > > it  > > is useful. > > There's usually a display manager in between the application and the > input device. But that is not always truth. In some cases there are applications which opens input device directly. > Whether it's X.org, or a Wayland compositor. Even David's > https://github.com/dvdhrm/kmscon could help for console applications. That kmscon needs KMS, right? So it would not work on hardware which do not have KMS drivers. -- Pali Rohár pali.rohar@gmail.com