Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Sep 2016 11:29:06 -0400
From:      Kurt Lidl <lidl@FreeBSD.org>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Logitech G510s keyboard fail.
Message-ID:  <336fa405-dc7d-4715-bbc9-6f1cbf049bbd@FreeBSD.org>
In-Reply-To: <CAF6rxgm8UvcSsyuj9EcwP9rYL_nd8D6m-n8KKXDmxyqxxj51HQ@mail.gmail.com>
References:  <CAF6rxgm8UvcSsyuj9EcwP9rYL_nd8D6m-n8KKXDmxyqxxj51HQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 30 September 2016 at 4:35, Eitan Adler wrote:
> On 30 September 2016 at 01:49, Zaphod Beeblebrox <zbeeble@gmail.com> wrote:
>
>> The largest number it was "skipping" was 993 ... awfully close to 10
>> bits.  was thinking that 16 bits (a short int) was a more appropriate size,
>> was all?
>>
>
> Unless there is a particualr reason to keep it small (such as memory
> pressure) lets use a fairly large number of bits.

As I understand it, the way the USB keyboards with true N-key-rollover
work is that they send a bitmap of which keys are pressed in each
usb packet.  (My terminology might be a little off here...)

The most basic mode is the "BOOT" (aka "standard") mode, where each
packet is 8 bytes in length, so you only get an array of up to six
simultaneous key-presses.

There's an "extended" mode, that can be either 16/32/64 bytes in length.
In the extended mode, there's a 2 byte overhead, so you get N-2
simultaneous key-presses in each packet.

Finally, there's the "bitmap" mode, where keyboard sends a packet
with a bunch of control data, and also 16/32/64 bytes of bitmap
data.  The bitmap represents all the keys that are pressed
simultaneously.

The number of simultaneous keypresses one can track is related to
the size of the bitmap.  With the 16 bytes of bitmap, you get up
up to 128 simultaneous key-presses, etc...  The 32 bytes of bitmap
get you up to 256 bits of presence detection.  I don't know if
there's a 128 byte variant of the bitmap support packet or not.
Someone would have to do some usb low-level debugging to figure that 
out...  It seems straightforward - there's just a byte in the middle
of the bitmap packet support that says how many bytes of bitmap
data there are present.

There's some relevant data here:

https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/USB_NKRO.txt

-Kurt





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?336fa405-dc7d-4715-bbc9-6f1cbf049bbd>