[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPnjgZ1rHy5Mz_RQC7v5omwSiKPSzzA6dXcqTcfYh8PD1MshUg@mail.gmail.com>
Date: Tue, 19 Feb 2013 08:58:00 -0800
From: Simon Glass <sjg@...omium.org>
To: li guang <lig.fnst@...fujitsu.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Samuel Ortiz <sameo@...ux.intel.com>,
Luigi Semenzato <semenzato@...omium.org>,
Vincent Palatin <vpalatin@...omium.org>,
Grant Likely <grant.likely@...retlab.ca>,
Rob Herring <rob.herring@...xeda.com>,
Rob Landley <rob@...dley.net>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Felipe Balbi <balbi@...com>,
Sourav Poddar <sourav.poddar@...com>,
Tony Lindgren <tony@...mide.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Mike A. Chan" <mikechan@...gle.com>,
Jun Nakajima <jun.nakajima@...el.com>,
Tom Keel <thomas.keel@...el.com>,
devicetree-discuss@...ts.ozlabs.org, linux-doc@...r.kernel.org,
linux-input@...r.kernel.org
Subject: Re: [PATCH v4 6/6] Input: Add ChromeOS EC keyboard driver
Hi,
On Tue, Feb 19, 2013 at 12:36 AM, li guang <lig.fnst@...fujitsu.com> wrote:
> 在 2013-02-15五的 20:16 -0800,Simon Glass写道:
>> Use the key-matrix layer to interpret key scan information from the EC
>> and inject input based on the FDT-supplied key map. This driver registers
>> itself with the ChromeOS EC driver to perform communications.
>
> [snip ...]
>> +/*
>> + * Returns true when there is at least one combination of pressed keys that
>> + * results in ghosting.
>> + */
>> +static bool cros_ec_keyb_has_ghosting(struct cros_ec_keyb *ckdev, uint8_t *buf)
>> +{
>> + int row;
>> +
>> + /*
>> + * Ghosting happens if for any pressed key X there are other keys
>> + * pressed both in the same row and column of X as, for instance,
>> + * in the following diagram:
>> + *
>> + * . . Y . g .
>> + * . . . . . .
>> + * . . . . . .
>> + * . . X . Z .
>> + *
>> + * In this case only X, Y, and Z are pressed, but g appears to be
>> + * pressed too (see Wikipedia).
>> + *
>> + * We can detect ghosting in a single pass (*) over the keyboard state
>> + * by maintaining two arrays. pressed_in_row counts how many pressed
>> + * keys we have found in a row. row_has_teeth is true if any of the
>> + * pressed keys for this row has other pressed keys in its column. If
>> + * at any point of the scan we find that a row has multiple pressed
>> + * keys, and at least one of them is at the intersection with a column
>> + * with multiple pressed keys, we're sure there is ghosting.
>> + * Conversely, if there is ghosting, we will detect such situation for
>> + * at least one key during the pass.
>> + *
>> + * (*) This looks linear in the number of keys, but it's not. We can
>> + * cheat because the number of rows is small.
>> + */
>> + for (row = 0; row < ckdev->rows; row++) {
>> + if (cros_ec_keyb_row_has_ghosting(ckdev, buf, row))
>> + return true;
>> + }
>> +
>> + return false;
>> +}
>
> are you sure your EC's firmware did not do ghost-key detection?
> or, did you test ghost-key with/without your own ghost-key detection?
> as far as I know, ghost-key should be take care either by keyboard
> designer or firmware.
>
Yes, the matrix scans are sent from the EC in a raw form - in fact the
EC on snow does not even know the keycode map. The EC does handle
debouncing though. The idea is to reduce code/complexity in the EC
where we are space-constrained.
[snip]
Regards,
Simon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists