lkml.org 
[lkml]   [2011]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] Documentation: Add evdev type and code definitions
On Fri, Jan 07, 2011 at 05:03:50PM -0500, Chase Douglas wrote:
> On 01/07/2011 04:53 PM, Dmitry Torokhov wrote:
> > Hi Chase,
> >
> > On Fri, Jan 07, 2011 at 04:28:15PM -0500, Chase Douglas wrote:
> >> +
> >> +EV_SW:
> >> +----------
> >> +EV_SW events describe stateful binary switches. For example, the SW_LID code is
> >> +used to denote when a laptop lid is closed.
> >
> > Please add that drivers should refresh switch state upon binding to a
> > device and also upon resume.
>
> I've not written any switch evdev drivers, can you clarify what you
> mean, maybe give me something to paste in?
>
> Are you meaning that the switch state may have physically changed, and
> that the driver should query the physical state to be sure, or do you

Right, switch state might be physically changed while the device/system
was asleep and thus we need to ensure that kernel's (and userspace)
switch state is consistent with physical state.

Same should be done in the very beginnning, while registering input
device - it is quite possible that we start with some switches in
"on" state.

Technically speaking, some keys might be depressed as well, but we
ignore this possibility and assume that everything is released because
it is simpler, we expect that all depressed keys will be released
shortly anyway, and not all devices allow to query current state of a
button (i.e. devices that only transmit state change).

> mean that the driver must send a new event even if the state has not
> changed?

The drive should send the events and input core will filter them out if
state still matches the old state.

Thanks.

--
Dmitry


\
 
 \ /
  Last update: 2011-01-07 23:45    [W:0.057 / U:0.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site