From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933316AbdABRbp (ORCPT ); Mon, 2 Jan 2017 12:31:45 -0500 Received: from mail-wj0-f193.google.com ([209.85.210.193]:35485 "EHLO mail-wj0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932892AbdABRb3 (ORCPT ); Mon, 2 Jan 2017 12:31:29 -0500 From: Pali =?utf-8?q?Roh=C3=A1r?= To: David Herrmann Subject: Re: [RFC PATCH] input: Add disable sysfs entry for every input device Date: Mon, 2 Jan 2017 18:31:24 +0100 User-Agent: KMail/1.13.7 (Linux/4.9.0-040900-generic; KDE/4.14.2; x86_64; ; ) Cc: Dmitry Torokhov , Sebastian Reichel , Pavel Machek , Mauro Carvalho Chehab , Chuck Ebbert , Henrik Rydberg , Ivaylo Dimitrov , "open list:HID CORE LAYER" , "linux-kernel" References: <1482660296-8432-1-git-send-email-pali.rohar@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart5109114.JZWgzVA4Ac"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201701021831.24961@pali> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nextPart5109114.JZWgzVA4Ac Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Monday 02 January 2017 17:44:38 David Herrmann wrote: > Don't open the device, if you don't want events from it. Really. There are existing applications which are doing it. This advice is good=20 but not for past. > I assume the reason behind this is that you don't know how to make > your user-space ignore devices. Yes. And another reason is to disable particular keyboard in linux tty=20 console. > But with this patch in place, you now > end up with user-space trying to use the device, but not getting any > events. Exactly. Same situation as if input device does not generate any event. > Anyone trying to debug this will go nuts because the setup > looks like the device is used, but ends up being muted. Such argument can be used in any situation. E.g. I own file on disk with executable bit and I cannot execute it.=20 Looks like bug, but instead selinux policy. Proper way is to fully document behaviour and configuration. Situation=20 that somebody is something expecting and have not read needed=20 documentation and already started something debugging is wrong. > I strongly recommend improving your user-space code to do what you > want it to do (meaning, make your user-space be configurable, if you > need this). Problem with integrated notebook keyboard which press some buttons in=20 linux tty console cannot be fixed in user-space. But, my original motivation about this disabling input devices is for=20 tsc2005 touchscreen on Nokia N900. There is existing userspace code for Nokia N900, some is closed &=20 proprietary (so not possible to modify or change or fix) which already=20 expects that kernel provide "disable" sysfs option for tsc2005=20 touchscreen. But that sysfs entry was removed in commit=20 5cb81d19bae47adcb073a5e5a3bc40dd252f239e and userspace stopped=20 working... Such problems are hard to fix now, but what we can see is that any=20 userspace application can open input device and let it open for its own=20 and process events which read. It is fully valid code and fully correct. Just user and admin too cannot force kernel to stop sending events to=20 application in specific cases when those events are either invalid or=20 nor events which applications expect in current state. And this is reason why I chose and suggest to have some option which=20 "mute" input device. And which should be used when user knows that=20 events should not be generated by input kernel driver or when nobody=20 should read them. > Btw., as a workaround, you can always disable input-drivers that you > don't want. No, you cannot. If you connect external PS/2 keyboard to notebook with=20 broken integrated keyboard, then both devices are handled by one driver. Also in some cases userspace application may expect that input device=20 will exists and would not work without it. E.g. when you want to disable=20 input device temporary, just when notebook LID is closed or when screen=20 is locked (on touchscreen). > Or you can run EVIOCGRAB on a device to get the same > effect as your patch. Next part is to implement runtime pm or autosuspend of device. So this=20 will break pm. And also will break applications which grab device=20 itself. =2D-=20 Pali Roh=C3=A1r pali.rohar@gmail.com --nextPart5109114.JZWgzVA4Ac Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAlhqjmwACgkQi/DJPQPkQ1Js2gCeJsEHyn8TE/9gozU9pMGshlu/ xhYAnRchQyyeQAp6xXYSynSTEob73l+q =5AXl -----END PGP SIGNATURE----- --nextPart5109114.JZWgzVA4Ac--