All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Zhai Zhaoxuan <kxuanobj@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-input@vger.kernel.org,
	Markus Rechberger <kontakt@sundtek.de>
Subject: Re: [BUG]an input device can not support more than 568 keys due to uevent buffer too small
Date: Wed, 17 Mar 2021 18:58:16 -0700	[thread overview]
Message-ID: <YFKzuP2Phh1RRQ8V@google.com> (raw)
In-Reply-To: <CAAnY7J3YQDe1=OR0U66UnS8JE4ALfV9CzugazwAYa7c4TX6F=w@mail.gmail.com>

Hi Zhai,

On Mon, Mar 15, 2021 at 07:58:58PM +0800, Zhai Zhaoxuan wrote:
> 
> In the real world, I think, it is nearly impossible that a physical
> device contains so many keys or buttons.
> 
> But I think a virtual device may need this. Such as a server remote
> management card, it simulates a virtual keyboard,
> registers keys and forwards all keys from user's computer to server.
> And the user's computer may have any keys. So the card needs to
> register all possible keys and send them to the kernel.

I believe the best approach is to forward input devices to the remote
system one by one, exactly as they are on the local end, instead of
trying to crate a frankenstein monster out of them. You will not be able
to do that in a meaningful way anyway, as for example a touchscreen
needs to be handled differently from a touchpad, and if you smash them
all together into one composite device you will get a mess on your
hands.

> 
> I have tried to register only all **known** keys instead of all keys,
> but it still fails on the kernel.
> (The userspace source file has been placed in attachment.)
> 
> > What functionality does it allow that we do not have today?
> 
> If programs are unable to register all known keys on only 1 uinput
> device, programs have to register
> keys on two or more devices. But this may result in unexpected behavior.
> 
> For example, the program registers Key A on device1, and registers Key
> B on device2.
> When the program needs to send a key combination A+B to a target
> application, it has to:
>      1. emit Key A down on device 1
>      2. emit Key B down on device 2
>      3. SYN_REPORT on device 1
>      4. SYN_REPORT on device 2
>      5. emit Key A up on device 1
>      6. emit Key B up on device 2
>      7. SYN_REPORT on device 1
>      8. SYN_REPORT on device 2
> 
> Then, the target application polls input events on both devices 1 & 2.
> It reads on device 1, and gets Key A pressed down and then released,
> so it does feature A.
> Then, it reads on device 2, and gets Key B pressed down and then
> released, so it does feature B.
> Finally, the target application loses the A+B key combination.

Which is exactly what would happen in a real life with 2 hardware
devices.

Thanks.

-- 
Dmitry

  reply	other threads:[~2021-03-18  1:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-13  6:32 [BUG]an input device can not support more than 568 keys due to uevent buffer too small Zhai Zhaoxuan
2021-03-13 13:07 ` Greg Kroah-Hartman
2021-03-15  6:58   ` Zhai Zhaoxuan
2021-03-15  7:30     ` Greg Kroah-Hartman
2021-03-15 11:58       ` Zhai Zhaoxuan
2021-03-18  1:58         ` Dmitry Torokhov [this message]
2021-03-18  4:54           ` Zhai Zhaoxuan
2021-03-20  4:05             ` Dmitry Torokhov
2021-03-20 19:00               ` Zhai Zhaoxuan

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=YFKzuP2Phh1RRQ8V@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kontakt@sundtek.de \
    --cc=kxuanobj@gmail.com \
    --cc=linux-input@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.