From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAEB2C4332D for ; Thu, 19 Mar 2020 02:23:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9969420724 for ; Thu, 19 Mar 2020 02:23:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=who-t.net header.i=@who-t.net header.b="FdtRg9aC"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="1ilLJKOH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbgCSCXl (ORCPT ); Wed, 18 Mar 2020 22:23:41 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:59757 "EHLO wout1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbgCSCXl (ORCPT ); Wed, 18 Mar 2020 22:23:41 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id B4164731; Wed, 18 Mar 2020 22:23:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 18 Mar 2020 22:23:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=who-t.net; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=fm2; bh=Q J6VgA9GCMrQDzsqr9+ykTR/nUPvG0fbwxidI4X0tLM=; b=FdtRg9aCnX1I9InM4 VVdeu3YFDXCBgOJlO4nqW+gwggY/MxecYBZdk2a8cYRCwsVcWA1d518IZVcQ92dn 2pzFvXAFEHF3uyer8vZJhW3xF9AX1DpLTVqLjtWmo3e+90vlebJeft/y6nnbWXBD CWZmcFUOwSscd4VuQXTQmMScQpF1Fw32FiYoPGXo8fMWaodyExy8EETUXdovh67p bC7gDoHaBKDE/aRuz6eTZGTp+aLFBsWbA5+PByMr10nQLZu0Quko9lMsVpHgUwsj a6kAkzbMt/75UfDfB0OIYx5wSjzKQu+h6i7zj3txtv9PY4JRiRd4Pi3/8m7+2IO5 18M7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=QJ6VgA9GCMrQDzsqr9+ykTR/nUPvG0fbwxidI4X0t LM=; b=1ilLJKOHYLMFzD/cXAvNgy+EAXggg+angcm5t7egRpBPnG1TTr4EUlRZq LFgLGuqeLj601lVN4vRyyi2xzIToHx7U2GhZeOf6Ddhl5Cu45TIcqseoACv9w342 OBF0ILomIA+f721pD5iZos4tUVaszRqTooL+ERdQFoGiDU5ybRNgcqVnSK7u+26/ qw+EfZPE6IXf1YaxBkX4gb7kzOjo4WhliT9yD/Z6qIuFLfvpozuOqFJ7xVBjkYQx R2HVJLhZNa2O8qQfxQ4NcME51G3F2nTNxrcr/yRg3BgAL99fBxeCbqVcIlqNkPZo l0C6griq2aKZ4Tb8KD8Q6L9I4Zsew== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudefkedggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtugfgjgesthekredttddtudenucfhrhhomheprfgvthgv rhcujfhuthhtvghrvghruceophgvthgvrhdrhhhuthhtvghrvghrseifhhhoqdhtrdhnvg htqeenucfkphepuddujedrvddtrdejuddruddtleenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdhhuhhtthgvrhgvrhesfihhoh dqthdrnhgvth X-ME-Proxy: Received: from jelly (117-20-71-109.751447.bne.nbn.aussiebb.net [117.20.71.109]) by mail.messagingengine.com (Postfix) with ESMTPA id ECC3F328005A; Wed, 18 Mar 2020 22:23:35 -0400 (EDT) Date: Thu, 19 Mar 2020 12:23:31 +1000 From: Peter Hutterer To: Hans de Goede Cc: Mario Limonciello , Filipe =?iso-8859-1?Q?La=EDns?= , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Hutterer , Richard Hughes Subject: Re: [PATCH] HID: logitech-dj: issue udev change event on device connection Message-ID: <20200319022331.GA2384843@jelly> References: <20200318161906.3340959-1-lains@archlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org On Wed, Mar 18, 2020 at 06:20:03PM +0100, Hans de Goede wrote: > Hi, > > On 3/18/20 6:15 PM, Mario Limonciello wrote: > > On Wed, Mar 18, 2020 at 11:19 AM Filipe Laíns wrote: > > > > > > As discussed in the mailing list: > > > > > > > Right now the hid-logitech-dj driver will export one node for each > > > > connected device, even when the device is not connected. That causes > > > > some trouble because in userspace we don't have have any way to know if > > > > the device is connected or not, so when we try to communicate, if the > > > > device is disconnected it will fail. > > > > > > The solution reached to solve this issue is to trigger an udev change > > > event when the device connects, this way userspace can just wait on > > > those connections instead of trying to ping the device. > > > > > > Signed-off-by: Filipe Laíns > > > --- > > > drivers/hid/hid-logitech-dj.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c > > > index 48dff5d6b605..fcd481a0be1f 100644 > > > --- a/drivers/hid/hid-logitech-dj.c > > > +++ b/drivers/hid/hid-logitech-dj.c > > > @@ -1464,6 +1464,8 @@ static int logi_dj_dj_event(struct hid_device *hdev, > > > if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] == > > > STATUS_LINKLOSS) { > > > logi_dj_recv_forward_null_report(djrcv_dev, dj_report); > > > + } else { > > > + kobject_uevent(&hdev->dev.kobj, KOBJ_CHANGE); > > > } > > > break; > > > default: > > > -- > > > 2.25.1 > > > > The problem that will remain here is the transition period for > > userspace to start to rely upon > > this. It will have no idea whether the kernel is expected to send > > events or not. What do you > > think about adding a syfs attribute to indicate that events are being > > sent? Or something similar? > > Then we would need to support that attribute forever. IMHO the best > option is to just make a uname call and check the kernel version, with > the code marked to be removed in the future when kernels older then > $version are no longer something we want to support. Also note that we may not have access to /sys. Cheers, Peter