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 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html