Re: [PATCH v4 6/6] Input: Add ChromeOS EC keyboard driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Feb 19, 2013 at 12:36 AM, li guang <lig.fnst@xxxxxxxxxxxxxx> 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-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux