Re: [PATCH v2] Input: try trimming too long modalias strings

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

 



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@xxxxxxxxx> wrote:
> >
> > On Mon, Apr 29, 2024 at 5:50 PM Dmitry Torokhov
> > <dmitry.torokhov@xxxxxxxxx> 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@xxxxxxxxx>
> > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> >
> > Tested-by: Jason Andryuk <jandryuk@xxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxx?  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




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux