[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZjKT9QYB1ScvYeIo@google.com>
Date: Wed, 1 May 2024 12:11:49 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Jason Andryuk <jandryuk@...il.com>
Cc: linux-input@...r.kernel.org, Hans de Goede <hdegoede@...hat.com>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Peter Hutterer <peter.hutterer@...-t.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] Input: try trimming too long modalias strings
On Tue, Apr 30, 2024 at 06:25:13PM -0400, Jason Andryuk wrote:
> On Mon, Apr 29, 2024 at 9:04 PM Jason Andryuk <jandryuk@...il.com> wrote:
> >
> > On Mon, Apr 29, 2024 at 5:50 PM Dmitry Torokhov
> > <dmitry.torokhov@...il.com> wrote:
> > >
> > > If an input device declares too many capability bits then modalias
> > > string for such device may become too long and not fit into uevent
> > > buffer, resulting in failure of sending said uevent. This, in turn,
> > > may prevent userspace from recognizing existence of such devices.
> > >
> > > This is typically not a concern for real hardware devices as they have
> > > limited number of keys, but happen with synthetic devices such as
> > > ones created by xen-kbdfront driver, which creates devices as being
> > > capable of delivering all possible keys, since it doesn't know what
> > > keys the backend may produce.
> > >
> > > To deal with such devices input core will attempt to trim key data,
> > > in the hope that the rest of modalias string will fit in the given
> > > buffer. When trimming key data it will indicate that it is not
> > > complete by placing "+," sign, resulting in conversions like this:
> > >
> > > old: k71,72,73,74,78,7A,7B,7C,7D,8E,9E,A4,AD,E0,E1,E4,F8,174,
> > > new: k71,72,73,74,78,7A,7B,7C,+,
> > >
> > > This should allow existing udev rules continue to work with existing
> > > devices, and will also allow writing more complex rules that would
> > > recognize trimmed modalias and check input device characteristics by
> > > other means (for example by parsing KEY= data in uevent or parsing
> > > input device sysfs attributes).
> > >
> > > Note that the driver core may try adding more uevent environment
> > > variables once input core is done adding its own, so when forming
> > > modalias we can not use the entire available buffer, so we reduce
> > > it by somewhat an arbitrary amount (96 bytes).
> > >
> > > Reported-by: Jason Andryuk <jandryuk@...il.com>
> > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> >
> > Tested-by: Jason Andryuk <jandryuk@...il.com>
> >
> > I don't have the gdm setup available to test, but loginctl looks good
> > showing the Xen Virtual Keyboard assigned to a seat:
> > # loginctl seat-status seat0
> > seat0
> > Devices:
> > ├─/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
> > │ input:input0 "Power Button"
> > ├─/sys/devices/LNXSYSTM:00/LNXSLPBN:00/input/input1
> > │ input:input1 "Sleep Button"
> > ├─/sys/devices/platform/i8042/serio0/input/input2
> > │ input:input2 "AT Translated Set 2 keyboard"
> > ├─/sys/devices/platform/i8042/serio1/input/input4
> > │ input:input4 "ImExPS/2 Generic Explorer Mouse"
> > ├─/sys/devices/virtual/input/input5
> > │ input:input5 "Xen Virtual Keyboard"
> > │ └─/sys/devices/virtual/input/input5/event4
> > │ input:event4
> > └─/sys/devices/virtual/input/input6
> > input:input6 "Xen Virtual Pointer"
>
> What do you think about Cc: stable@...r.kernel.org? I'd like to get
> the Xen Keyboard working as widely as possible, so I'd like it
> backported if possible.
I am open to it, but I'd like Benjamin/Hans to take a look at this
as well (I see Peter already gave his Reviewed-by).
Thanks.
--
Dmitry
Powered by blists - more mailing lists