Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp148542ybg; Wed, 18 Mar 2020 19:25:19 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv99efOwCtJ9lVasJNTCSxWJ4ZbKwqGLWXnJ4P3qhNu7rdcxOzFowM1D+kWy970T3yN0nkq X-Received: by 2002:aca:3386:: with SMTP id z128mr791555oiz.40.1584584719636; Wed, 18 Mar 2020 19:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584584719; cv=none; d=google.com; s=arc-20160816; b=O9icSS+XqPDvhZboSR3dNJpYqE7jzd+wWbhAjT6aV7CzOiJnIsYKSJvSXKoy7Azm7G FqYtjp5dFAdgFML+XJnPtYZG3viyhdQiSBBEgWplVJ1FS8OfgHxNhYqs0OspEpIcW7l0 QiXSg6FhfJ0B8V4+eWx31DpgiqlAhazx+vigcqcBWc4zeQp5ATUVLw8eYZMlJE62YP/H Fyn0vKsbvGpLNIi2APOSWX4jfzsZi+X4QXYYVy33H3Oonn/3/PJYYx+GKIkmZiA1JF7B EbERnMPuV2bs0r7UOtze1KhSCX4MOofKANCChDUEVfNii2ka597mmZHN5zTfQ87ifh1/ IzLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=QJ6VgA9GCMrQDzsqr9+ykTR/nUPvG0fbwxidI4X0tLM=; b=lSEsCeDVgCPDnNgo6f3TBmBv0uDERW5xWMk3oUpoaCXC0/XIT7eMKmDDyzqD1TaOsL q5hiAV/EJyy0zVSUadoxpSX4F0lwJbqR3BXtAqcDNvW6H8LAjzouYcGm2OyJUCpv+iDV ZesgSAB0GUwiklCzuhAEj1bgwx52zlepfrbBL/temoRWYy7SlnqInZUONaKufbkg7ept EwzPv8RiRvwpt7wbiXWN5wju/5eUZXkEPIIV7SG2Bt+wt8sfXbJkgAxCa9bm3fi7S183 /K6fg15AbXID5htqyOVtSAKnpydqPVeT3rt3Vk6KQeyaJiOiS+tQXRSvEnTRH17Hhhyn 1nrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@who-t.net header.s=fm2 header.b=FdtRg9aC; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=1ilLJKOH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w83si284196oie.244.2020.03.18.19.25.05; Wed, 18 Mar 2020 19:25:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@who-t.net header.s=fm2 header.b=FdtRg9aC; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=1ilLJKOH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726840AbgCSCXl (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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