From: Anisse Astier <anisse@astier.eu>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org,
Herton Ronaldo Krzesinski <herton@mandriva.com.br>,
Harald Welte <laforge@gnumonks.org>,
Corentin Chary <corentincj@iksaif.net>,
Carlos Corbacho <carlos@strangeworlds.co.uk>,
Wu Zhangjin <wuzhangjin@gmail.com>
Subject: Re: [PATCH 1/9] Input: add generic support for sparse keymaps
Date: Fri, 4 Dec 2009 15:06:21 +0100 [thread overview]
Message-ID: <20091204150621.16e4036e@destiny.ordissimo> (raw)
In-Reply-To: <20091204061158.28288.17664.stgit@localhost.localdomain>
On Thu, 03 Dec 2009 22:11:58 -0800, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote :
> +
> +/**
> + * sparse_keymap_report_event - report event corresponding to given key entry
You meant _report_entry ?
> + * @dev: Input device for which event should be reported
> + * @ke: key entry describing event
> + * @value: Value that should be reported (ignored by %KE_SW entries)
> + * @autorelease: Signals whether release event should be emitted for %KE_KEY
> + * entries right after reporting press event, ignored by all other
> + * entries
> + *
> + * This function is used to report input event described by given
> + * &struct key_entry.
> + */
> +void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke,
> + unsigned int value, bool autorelease)
> +{
> + switch (ke->type) {
> + case KE_KEY:
> + input_report_key(dev, ke->keycode, value);
> + input_sync(dev);
> + if (value && autorelease) {
> + input_report_key(dev, ke->keycode, 0);
> + input_sync(dev);
> + }
> + break;
> +
> + case KE_SW:
> + value = ke->sw.value;
> + /* fall through */
> +
> + case KE_VSW:
> + input_report_switch(dev, ke->sw.code, value);
> + break;
> + }
> +}
> +EXPORT_SYMBOL(sparse_keymap_report_entry);
> +
> +/**
> + * sparse_keymap_report_event - report event corresponding to given scancode
> + * @dev: Input device using sparse keymap
> + * @code: Scan code
> + * @value: Value that should be reported (ignored by %KE_SW entries)
> + * @autorelease: Signals whether release event should be emitted for %KE_KEY
> + * entries right after reporting press event, ignored by all other
> + * entries
> + *
> + * This function is used to perform lookup in an input device using sparse
> + * keymap and report corresponding event. Returns %true if lookup was
> + * successful and %false otherwise.
> + */
> +bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
> + unsigned int value, bool autorelease)
> +{
> + const struct key_entry *ke =
> + sparse_keymap_entry_from_scancode(dev, code);
> +
> + if (ke) {
> + sparse_keymap_report_entry(dev, ke, value, autorelease);
> + return true;
> + }
> +
> + return false;
> +}
> +EXPORT_SYMBOL(sparse_keymap_report_event);
> +
next prev parent reply other threads:[~2009-12-04 14:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-04 6:11 [PATCH v2 0/9] Implement sparse keymap library Dmitry Torokhov
2009-12-04 6:11 ` [PATCH 1/9] Input: add generic support for sparse keymaps Dmitry Torokhov
2009-12-04 8:02 ` Wu Zhangjin
2009-12-04 8:34 ` Anisse Astier
2009-12-04 9:17 ` Wu Zhangjin
2009-12-04 8:37 ` Dmitry Torokhov
2009-12-04 9:18 ` Wu Zhangjin
2009-12-04 14:06 ` Anisse Astier [this message]
2009-12-04 18:19 ` Dmitry Torokhov
2009-12-04 21:15 ` Anisse Astier
2009-12-06 22:57 ` Anisse Astier
2009-12-04 6:12 ` [PATCH 2/9] Input: wistron_btns - switch to using sparse keymap library Dmitry Torokhov
2009-12-04 6:12 ` [PATCH 3/9] Input: dm355evm_kbd " Dmitry Torokhov
2009-12-04 6:12 ` [PATCH 4/9] Input: dell-wmi " Dmitry Torokhov
2009-12-04 6:12 ` [PATCH 5/9] Input: hp-wmi " Dmitry Torokhov
2009-12-04 6:12 ` [PATCH 6/9] Input: eeepc-laptop " Dmitry Torokhov
2009-12-04 6:12 ` [PATCH 7/9] Input: asus-laptop " Dmitry Torokhov
2009-12-04 6:12 ` [PATCH 8/9] Input: topstar-laptop " Dmitry Torokhov
2010-03-29 22:19 ` Herton Ronaldo Krzesinski
2009-12-04 6:12 ` [PATCH 9/9] Input: panasonic-laptop " Dmitry Torokhov
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=20091204150621.16e4036e@destiny.ordissimo \
--to=anisse@astier.eu \
--cc=carlos@strangeworlds.co.uk \
--cc=corentincj@iksaif.net \
--cc=dmitry.torokhov@gmail.com \
--cc=herton@mandriva.com.br \
--cc=laforge@gnumonks.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=wuzhangjin@gmail.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