From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Alan Jenkins <sourcejedi.lkml@googlemail.com>
Cc: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>,
linux-kernel@vger.kernel.org, len.brown@intel.com,
don@syst.com.br, linux-acpi@vger.kernel.org,
linux-input@vger.kernel.org
Subject: Re: [PATCH] cmpc_acpi: Added support for Classmate PC ACPI devices.
Date: Thu, 1 Oct 2009 09:38:57 -0700 [thread overview]
Message-ID: <20091001163857.GB22320@core.coreip.homeip.net> (raw)
In-Reply-To: <9b2b86520909290941g6295ba36i907dfda62b968529@mail.gmail.com>
On Tue, Sep 29, 2009 at 05:41:42PM +0100, Alan Jenkins wrote:
> On 9/29/09, Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> wrote:
>
> >> > +static void cmpc_tablet_idev_init(struct input_dev *inputdev)
> >> > +{
> >> > + set_bit(EV_SW, inputdev->evbit);
> >> > + set_bit(SW_TABLET_MODE, inputdev->swbit);
> >>
> >> Don't you need to initialize the switch value here?
> >>
> >
> > No, input_allocate_device does kzalloc. Otherwise, this would apply to
> > the other bitmaps as well.
>
> The other bitmaps aren't for switches though. Here's what prompted
> this comment - a snippet from the old (2.6.29) version of
> Documentation/rfkill.txt:
>
> "2. Input device switches (sources of EV_SW events) DO store their current state
> (so you *must* initialize it by issuing a gratuitous input layer event on
> driver start-up and also when resuming from sleep), and that state CAN be
> queried from userspace through IOCTLs."
>
There is a mixup betweeb capabilieies and state bitmasks. In init you
set up the capabilitis bits and you don't need to clear bitmaps. This is
true for everything - keys/buttons, switches, relatixe/absolute axis,
everything.
Now switches do naturally have a certain state. Unlke keys (which are
assumed to be normally in released state) switch can be on or off. So
the driver has (if it can) query the switch state (hardware state) and
issue appropriate input_event() to bring internal state of the device in
sync with the state of the hardware. The same on resume - the switch may
be altered while the box was asleep to upon resume we need to do the
same.
--
Dmitry
prev parent reply other threads:[~2009-10-01 16:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1254188280-29155-1-git-send-email-cascardo@holoscopio.com>
[not found] ` <9b2b86520909290220g6b5f6beal6337b17f1bdd339@mail.gmail.com>
2009-09-29 14:16 ` [PATCH] cmpc_acpi: Added support for Classmate PC ACPI devices Thadeu Lima de Souza Cascardo
2009-09-29 16:41 ` Alan Jenkins
2009-10-01 16:38 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091001163857.GB22320@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=cascardo@holoscopio.com \
--cc=don@syst.com.br \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sourcejedi.lkml@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).