Re: [PATCH] input: Add soft kill switch for input devices

From: Tristan Lelong
Date: Wed Jan 07 2015 - 01:40:53 EST


On Tue, Jan 06, 2015 at 10:17:32PM +0100, Bruno Prémont wrote:
>
> One big issue I see here is that you start dropping all events at a random
> point in time.
> You may end up within a gesture or just while a button is down and remain
> so until that same button gets pressed again on unmute.
>
> On your touchscreen, how do things behave if you trigger the muting while
> you are dragging or doing some gesture (and unmute when noone touches
> the touchscreen)?

That is right, I thought of it for pointing devices, and it seemed that it should not be
too much of a problem, even thought it would be better to handle it properly.

>
> If applied to a keyboard, what happens when you mute while keys are pressed
> and unmute when they have long been released?

This case is actually a bigger problem and I didn't think of it.
>
>
> If you could send a "reset" event to input listeners when muting you could
> work around most issues as any application making use of events would know
> that after this "reset" event things should not depend on any past state.

I could definitely do something like this and make sure all the events are handled properly.

>
>
> Possibly a better way to achieve your aim is to just unbind and re-bind
> the device from device driver, causing software hotplug.
> That way you are sure no application will perform incorrect guesses while
> device is "muted".

This is another good solution that would work in my case.

If somebody think this patch can be of any interest, I'll be happy to
submit a v2 with correct handling of current events at the time of mutting.

Best regards
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/