Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1390349rdg; Fri, 13 Oct 2023 23:33:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGq+XKKCUY1o9X4xd9UsPZrpogbjkIyaT88nBr1SsWj7OYw8UPrhhjjD6xtNKayH3maqj3l X-Received: by 2002:a17:902:d490:b0:1c6:19da:b29d with SMTP id c16-20020a170902d49000b001c619dab29dmr30188035plg.44.1697265181371; Fri, 13 Oct 2023 23:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697265181; cv=none; d=google.com; s=arc-20160816; b=igZY5O3FsDMB1GkpqCa15OPe6OFIGckQPwa79VJRqqrUbhmaSFRWDu2HoPehaMfY9y nXBOv2AOfVXm+H+P5DMuuk40eUZNwddNjeU3WlWod77WHRTBfk1sX/IdGmPtwTVCHfq4 5C4CqUrqrxYQS+NSnxZovfgZUKr+KdTILA84DEEuA5Gty+uvjwLQK+U4ofowblIgG2Kz eAUNGV0VfyffaFds4EgRHT2HJoUIQLyUZtuYueDoonCY6VqvwTB2BhACk+8r/ygJlHhH y/uBxBBaRv/uw+WD2zM987J/4kfbDTjDh2n9k4EoVaDPlKpU+NEtRraNqA3kKhkK12aA GCGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=k5xaWOo1D+HhhlwPdSC9+vAnZB9g/JHmWJaQdfHTbHA=; fh=r5Yb3/qWpFxoWwj7APldqrOdAQVIGmwyIMClmgwb3Fo=; b=bmIkLrkZ9c6tSDQRC0lTvp22tan1tYaJfs2kQ0Ktxfp8EVpEkcEZl0XrtTAbvorqta tatTwaKZ+2Qba3XWUz5s9vQtwAsO5FdPIE1YAicZW5LjLnXtUTw6aU0UUjDtTxgwn0d+ 1nZ3d3pOibIhAFWOehKT+TW6STsxuUmU9UJYtqtgUHlo9gyRdoY8RIYpoKJaP5Su6f7e Mvgwmzrcco+TnY5jYv0tqQ30PE5Ko3azd8xZH0GhzGkEUUJvct2iQmaejf/ipHzTD6yw 7EtM6P7xGhfvbccZ2iKjk2m5gmsjgsfBI1W98m10DL415JQnvf2sGbwytFAvTALgDKgt xlUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GW74oVZt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id x19-20020a170902ea9300b001c5eb1706d3si5134218plb.171.2023.10.13.23.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 23:33:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GW74oVZt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 0928680227E6; Fri, 13 Oct 2023 23:32:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232859AbjJNGcu (ORCPT + 99 others); Sat, 14 Oct 2023 02:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232834AbjJNGct (ORCPT ); Sat, 14 Oct 2023 02:32:49 -0400 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61E6DBF; Fri, 13 Oct 2023 23:32:48 -0700 (PDT) Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-d852b28ec3bso3047139276.2; Fri, 13 Oct 2023 23:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697265167; x=1697869967; 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=k5xaWOo1D+HhhlwPdSC9+vAnZB9g/JHmWJaQdfHTbHA=; b=GW74oVZtoD83QmniCy5H3KOl78xBU+hvJ2YZJTxAt7zXRD2tRq12teVeW6h0wgxQyU 5BUcp4zx6Akgogw3B+s5Z2dr/slLOgpMUVbhKjIX0HcI54mQJ5EXQCBiNZA47EnRTdpC qnwqzLZSHVHxApReghe5e072hEwdsYg4hjKNaXvLfLm2Hw0mLnCl9mXyxNQ9Q3hwBc80 Zn4Su+uiBjV08nnjtvCUPHJ36omLjaW4ULpFh7mdAodvBJdqh1nAai52Ul1jN+NcfgNC 0XNVzvh3bTn8fsoKve6+RX5tDTLvF5IUmiN7aFArCrI3GHlgtJjS/huJuOCWcWVUsWgh XvOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697265167; x=1697869967; 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=k5xaWOo1D+HhhlwPdSC9+vAnZB9g/JHmWJaQdfHTbHA=; b=sSVj57VxC24PWmCACfh7Eea0X0S1gNDo7xQWgCyUUHamd51rteZFWpJC/fVskzA34Z rSxFMrJxa2QfK9OL6+lnKyCElNXU1BoFdntjzMVChYLAZD5oluK2iNV0UmgiDG8xxtZX esVnxPa2jtqSxAQMqwCkkpavaLhuutKpDaRPW81TsAB+V7r3tPodePQiskhyrT85gsnM mebBtTNu6/y++0mVHzQltv2gxxJZtJnR6X/Esuou9xJAaA4MkAwAe1aXDsMjzEs3gI0R WPTP1OQ/5AJAjqNDSS9/YIko2p07HYHyyXUlJbj4gS9J6pgvhkHUJ4jKWLFr1zjIOyH0 Ax5Q== X-Gm-Message-State: AOJu0YzWukohOZQ/kkMgBDfX2S7IfE04WEGxc1GyzszI91IJpeSQvNiX TbDcF1EuNOUzkw0ha95Joiw45TWDKbzex9NqjzIT4RjGCEA= X-Received: by 2002:a25:230e:0:b0:d9a:b9fe:a318 with SMTP id j14-20020a25230e000000b00d9ab9fea318mr6951399ybj.58.1697265167476; Fri, 13 Oct 2023 23:32:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: John Salamon Date: Sat, 14 Oct 2023 17:02:35 +1030 Message-ID: Subject: Re: uinput: waiting for UI_FF_UPLOAD events will not inform user when allocation is required To: Dmitry Torokhov Cc: rydberg@bitmath.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 23:32:59 -0700 (PDT) Hi Dmitry, Thank you for the clarification. > The handler of force feedback effects should know what effects (with > what IDs) have been uploaded to the device so far, so whenever it sees a > request for an effect with previously unseen effect_id it should > recognize this as a signal that a new effect/id has been allocated by > the kernel. In that case, would you consider accepting a patch adding a sentence or two explaining that handlers will need to keep track of effect IDs in this manner? Either in uinput documentation or just in the comment describing how to implement upload_effect() in uinput.h. Something along the lines of "Effects received here will never have an ID of -1. Handlers of these effects must recognize previously unseen effect IDs to know when a new effect has been allocated.". Cheers, John On Sat, Oct 14, 2023 at 8:29=E2=80=AFAM Dmitry Torokhov wrote: > > Hi John, > > On Tue, Oct 10, 2023 at 05:38:27PM +1030, John Salamon wrote: > > Currently the "fake" input events generated by uinput in response to > > effect uploads will return an effect with an id that has already been > > handled by input_ff_upload in ff-core.c, which can modify the effect > > id. This causes a problem specifically when the effect originally > > uploaded via the EVIOCSFF ioctl contained an effect with -1, as the > > userspace code handling UI_FF_UPLOAD receives an effect with an id > > other than -1, and therefore will not know an allocation was > > requested. > > The kernel never changes ID of an existing effect, the only time ID is > changed is when userspace indicates that a new effect should be created > by setting effect ID to -1. > > The handler of force feedback effects should know what effects (with > what IDs) have been uploaded to the device so far, so whenever it sees a > request for an effect with previously unseen effect_id it should > recognize this as a signal that a new effect/id has been allocated by > the kernel. > > > > > I notice that the "old" field on the ff_effect struct is set to NULL > > when the -1 id is changed (in input_ff_upload), which can serve as a > > flag that an allocation was requested. If it is the intention is that > > uinput users check if old =3D=3D NULL to know when allocations are need= ed > > I think uinput documentation should describe this. > > No, not really, as explained above. > > > > > I first noticed this using python-evdev, see my issue report here: > > https://github.com/gvalkov/python-evdev/issues/199 > > Thanks. > > -- > Dmitry