Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1719140lqa; Mon, 29 Apr 2024 18:04:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+NkFCRr8yjPYSjBLNlGDt5CO/ng+PhmLJAyfqzqr1JqHPRExW6mUAkR/5xqEkJoZ3Oi84bzdmVSujD4z3++Wm8KGEhNEhqp89/Zg0Sw== X-Google-Smtp-Source: AGHT+IE+Bga4pwTYvVuofi9ivU+F9/oZQpl+wh1zqinYdy5o4i10kf30xhhtimDr1ER847NvPqNx X-Received: by 2002:a05:6e02:1c89:b0:36a:2556:3721 with SMTP id w9-20020a056e021c8900b0036a25563721mr16751164ill.26.1714439092619; Mon, 29 Apr 2024 18:04:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714439092; cv=pass; d=google.com; s=arc-20160816; b=LwwteYq83HPmXDNV7HzP8DkQ3sn7tPR6/nTM6jHvcDSL6QoHlVY+JSCVw4ugGzVBsV m2tHoah9OOWYLT0Feo5bC9ufagI+1giiTnO/SuNygUe79z/3ml3woSCw8Bck/ZJMjU+P Abv0ps2Bf5ax91FoXwfUekaB7kc5oOhRpFCrwedlsvrFwq46SFiya/AvvtxYgCt+bzUq PAFxeV1UiiPJQVmxadz6qjKSPDmPu33xjJh1ynLuJ6BAT2fc9XcEraVzt9saySOjNXYE mQIC1wuc8dL/PgPBjGUUevG5aCFQYAr2cs+kHya5yuUoFbMEzutP0XnbJk8bkk61RT+5 1WUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=HmlXHYTP1JU1chg3YaCZTEhfqyjw0+XCv0tIk9SD3Mg=; fh=EWd0DSFLz0f8ha/tyq4RxMskAfPGJ7G1GJNdgI5xXoU=; b=pl41al1kFc7FlaAWeTxm6x/E6IIPDJtcHthSCs7CtzCZqEnc0xVodpkAOaNYWIRyHf TBMYmGM+/5Jf+0p4u9fNNYFbh1vlzDDiEC0P3qfuMG/RgMiFX0OCoaBE7EBcwtKWHk+m HF9YiZYXk3NjNzcjND5GDC5xrD6/9TjWY/awxLM0tQWDwBx6VffC08JIuRSFOEaHO6Fw 9n1JbOksYY3UJflVOdiD6l9OYKgnLa0VLpkg7ag58xb0AfQfgXnFgtzsr/2sNsdskhGE gGwZv6RjSb6XcuY1me69wYi1A5rxuzscu4NlObmmo/sqOvqb6E4leYzQWUp5Q4kDkx20 Vu5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kMJfN3+J; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163203-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h10-20020a63f90a000000b005dc87994572si20638316pgi.346.2024.04.29.18.04.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 18:04:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163203-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kMJfN3+J; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163203-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3932028390E for ; Tue, 30 Apr 2024 01:04:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B476879DC; Tue, 30 Apr 2024 01:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kMJfN3+J" Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 408CB1FBA; Tue, 30 Apr 2024 01:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714439078; cv=none; b=NttFJoev4rSE0b+91Ry2K4W6Tz1xQ42GDVov7TGph/ZB7cOap8N2rpTrfQxXQEAYPrXLjLBT+akqihoxQljGQkWj2++E7cbSDTbgE8kqCiarpOCXxwgD4m0pibudmEyNKadNUDI4L/Xu5k2w8s0eLPgePueWVUErHbg697I7m1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714439078; c=relaxed/simple; bh=PfIZ2OzMF7H5BdktCnUKZd+MnhBoRHx3h3/g+0pDVmw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=PYYE0RCskJSEL+1NoR7DpmNL87PM84/VlZ5PyMsq9fBMrPtWn2E+tqCRKTRZN1YHnSa7VUMwN+yyGb6mWmmn4AXPSVBMmLxKdRIr7lza7w6I9mbhM/ZgVabzP2s6r+keVXQIMvOtaSiL4O87OlTT3kQ8Ifdrl2ewjF4pMn6W150= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kMJfN3+J; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5726716a006so3819093a12.2; Mon, 29 Apr 2024 18:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714439075; x=1715043875; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HmlXHYTP1JU1chg3YaCZTEhfqyjw0+XCv0tIk9SD3Mg=; b=kMJfN3+JVJ3HvHeUx5tK00p1FTS2Uv9RpTDzgz+GcWDkR+Sew+9NY7ryukSpFxFzMe ydp1Y0cQOxWKBhphtadlu0Xuzz5k95iCF4GFUHVl4IrldfXoy5CNbMcUcD7iQDkgU3NX tUP/zMWWI5xccmov19mdHVzjiNokry29YykE6ESeyiVS/UfRswdWMG65H77ns6lCiEAP LzFaaBGCW29KWarwPz+UpbQT65R8Wxv0wWoIjRoOJN7u2D4cbylbQoJ4dFkMc53TpS7m /q39YAJiooMkkLITTLfkbTXBr8MqRUqWpXhGe98VXCyVz0pwrYBa9XUo3JpexGKAh5IN CloQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714439075; x=1715043875; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HmlXHYTP1JU1chg3YaCZTEhfqyjw0+XCv0tIk9SD3Mg=; b=Si3ztAIDNjFAKjTe/oB568F8IzJn9U0JQ7HBcjrXDxgtXlc98hL7QmbS9F65xN5ZjT CxOgoa5oAe91P0W6Tjxo5YGngq7Q5OEjlpjKycdEhpCOJ74vdDX+7PnYggGXCl0+M5FF sFb//NDUbYQ8/iTaGXhybGY8rwKAd8kyaB0+rmr73bETH0mCdlpH84eRmUubxsrGGzTd 8EaMl31ZRy124n66B1i5v9xFaLVzHyk1luWdwAHs+nJ4Oqw3+bssi6nouBMx2ykDJnFC rivw84RHKOZSTULHRu6AphjBOgZV8I1TnnFN3Ii651UFlzmajcThQDrEmx9fCXNFaTjy kKzg== X-Forwarded-Encrypted: i=1; AJvYcCWxTXGFvgCWRHhhUsiySi+1A9NQguBWu1Q6LbGNonWPWMctjyqQ/ujEfG0nghptr4kov2cyI7TRQunneeVrFfFEgZRfprHD8hbU4faI X-Gm-Message-State: AOJu0Yw9fPEVrF3bdPNoh/XT4ai2BdTcl86wVAEbY01kYZ4Ghlp/amOB QWBPByZSjI0iRxb7W6e5IR12XKDiziDx9ClbYwKaCe0kmEgH6z7wi1M22mJPXkrS5BVrxV7xtP/ QOxI9bDUT1IT5A0vCJeQZK5Lkqfc= X-Received: by 2002:a50:bb26:0:b0:572:7089:7f78 with SMTP id y35-20020a50bb26000000b0057270897f78mr5396986ede.34.1714439075311; Mon, 29 Apr 2024 18:04:35 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Jason Andryuk Date: Mon, 29 Apr 2024 21:04:23 -0400 Message-ID: Subject: Re: [PATCH v2] Input: try trimming too long modalias strings To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Hans de Goede , Benjamin Tissoires , Peter Hutterer , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 29, 2024 at 5:50=E2=80=AFPM Dmitry Torokhov 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=3D 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 > Signed-off-by: Dmitry Torokhov Tested-by: Jason Andryuk 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: =E2=94=9C=E2=94=80/sys/devices/LNXSYSTM:00/LNXPWRBN:00/in= put/input0 =E2=94=82 input:input0 "Power Button" =E2=94=9C=E2=94=80/sys/devices/LNXSYSTM:00/LNXSLPBN:00/in= put/input1 =E2=94=82 input:input1 "Sleep Button" =E2=94=9C=E2=94=80/sys/devices/platform/i8042/serio0/inpu= t/input2 =E2=94=82 input:input2 "AT Translated Set 2 keyboard" =E2=94=9C=E2=94=80/sys/devices/platform/i8042/serio1/inpu= t/input4 =E2=94=82 input:input4 "ImExPS/2 Generic Explorer Mouse" =E2=94=9C=E2=94=80/sys/devices/virtual/input/input5 =E2=94=82 input:input5 "Xen Virtual Keyboard" =E2=94=82 =E2=94=94=E2=94=80/sys/devices/virtual/input/in= put5/event4 =E2=94=82 input:event4 =E2=94=94=E2=94=80/sys/devices/virtual/input/input6 input:input6 "Xen Virtual Pointer" Thanks, Jason