Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp856590ybh; Wed, 18 Mar 2020 10:22:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtLdYxxEvelc8t5ole7tiXXjHDf+Uc3PqlD+MF+gc1cPkkLr30dK03tPisZrss4R8dCt1Cv X-Received: by 2002:a05:6830:1e4e:: with SMTP id e14mr4785647otj.108.1584552123159; Wed, 18 Mar 2020 10:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584552123; cv=none; d=google.com; s=arc-20160816; b=0xYwY4Z4hnYxyd/GSNUt8vgQV6uYFvS4CHQstm0ic0MwTexRgWmWVYuDq1Hj+KKotA 70Uj6F+VyExVB0HJypiRAxqVQgRf9WdA7yzSS1pWJQmUo/1qlcblxXAzOB26ov7ifNQj CC45eQPCvSbwxW5kXUb8fCk/k2y1pmQ6lWERdLHlcNObexz5GTEsW3+55SVmdYWayUUw UQ2xY0iFfvHLecSF7uPwsOC2w55ibmpE1CMU2aSRT60Yy7SkntQdK2FUAyAVrztYP/CI Ea+sGI6XQ7P8o8hCbpo8ncdhvQ3ROkKc7hoaI7oWwWwQDx4MICH7LTbx7Li1s2BL+0FO w5rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=n3XT9uOrt7PH+M1GJzb9jqNp+v2UICWH0KuRq1shXUc=; b=C695VTMnHz8E+NOV6t+UvkF5ge3B3M19y9kE06uNHAHrW6GTr0ea+Z2RfDYw4YYbGM x4IWhx1X/O004Kc5Rcxi091zTMzZtCrmjdE43KDzgDbXCz8OXju8LQRJc6g35AGs/Tfj CL/uqpwz/JlqtGqt3wIQnuZ29CtYkBYLtJunXq09MArNL8LEm9aM5pLK5xPu5hkBJQJU 3oqI5xdWavJj1T9IeTUQGF7zdlEOx9VVznInQj8zuaYD5VS5+4bAkmUj43Usg4kfIhsE aWDYsHvSEw+msZ55c8hp8OMAFz5pCxEGBAwjbZQgyFDJxNpT9fgWtQyoLW4Yhiygkult +g0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JqQ1RckF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s11si3721643oih.95.2020.03.18.10.21.50; Wed, 18 Mar 2020 10:22:03 -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=@redhat.com header.s=mimecast20190719 header.b=JqQ1RckF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbgCRRUM (ORCPT + 99 others); Wed, 18 Mar 2020 13:20:12 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:51691 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726680AbgCRRUL (ORCPT ); Wed, 18 Mar 2020 13:20:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584552011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n3XT9uOrt7PH+M1GJzb9jqNp+v2UICWH0KuRq1shXUc=; b=JqQ1RckFSMl3ELI6OK/z6Mdp/kmcpU6LdACNoaD1ubBf4B+vQEmBGagDluBNBrxrN1sB0l kfw1fxxG6folI5Z0fYzqjKycOj5ddm4aZwY4eF97JxjOxVvt4mwCxsv237fO6yod5Q4ZpN q/jOagNuelEWsv86fZ2/szyPMFNeWNY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-248-OgobymGlO5ad5vU5Ik2vbg-1; Wed, 18 Mar 2020 13:20:06 -0400 X-MC-Unique: OgobymGlO5ad5vU5Ik2vbg-1 Received: by mail-wm1-f71.google.com with SMTP id s15so1346127wmc.0 for ; Wed, 18 Mar 2020 10:20:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=n3XT9uOrt7PH+M1GJzb9jqNp+v2UICWH0KuRq1shXUc=; b=oM7whcD4geHPEFcuMD2GXGbH6Q8xL+2rQCm0gBNCef0+ZxCa1TvxU+iNqrdqxCV3SQ Az5QU656ATzP2BPQ8ag+JKsTPAazFneSyrotqdUMnPgdLSnHkhn3BoyqBMJ8f50Nrh4I Jg9hhCluVHwYjSOFSOjYgXZYd57Gijg+aplWTXN89IKRfJAtR1vZsJjwxeePHdqMEke7 SFXUd1QnrIoX4nySAvqQAUArCOHpj5stBWNWYrj5sXCvcfmEVL4BrlxO2Sk7gU2YAPal AEb7SBsVfaq8doN/ZLUWVjB7VeZytN82w2A1+7gVTYR4IZKU+EfhcsQ2vuu+CNNz5CVA gtrg== X-Gm-Message-State: ANhLgQ1jQU3ZdqsrSAqAmeIEZWnHCgA/gFPHvTYP7YjGp+dhLxaPhsVD RDhopvG2XHd+Et2xtloFFAiU9GOwZitrXtfjf2PzKwf9gGy05F/ODuG0rJP32yWLf4Ftp9TtxmF XIwimAa9wzfSQ0bYklfCulA7W X-Received: by 2002:a05:6000:d1:: with SMTP id q17mr6725143wrx.409.1584552005533; Wed, 18 Mar 2020 10:20:05 -0700 (PDT) X-Received: by 2002:a05:6000:d1:: with SMTP id q17mr6725115wrx.409.1584552005310; Wed, 18 Mar 2020 10:20:05 -0700 (PDT) Received: from x1.localdomain (2001-1c00-0c0c-fe00-fc7e-fd47-85c1-1ab3.cable.dynamic.v6.ziggo.nl. [2001:1c00:c0c:fe00:fc7e:fd47:85c1:1ab3]) by smtp.gmail.com with ESMTPSA id f12sm4835053wmh.4.2020.03.18.10.20.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Mar 2020 10:20:04 -0700 (PDT) Subject: Re: [PATCH] HID: logitech-dj: issue udev change event on device connection To: Mario Limonciello , =?UTF-8?Q?Filipe_La=c3=adns?= Cc: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Hutterer , Richard Hughes References: <20200318161906.3340959-1-lains@archlinux.org> From: Hans de Goede Message-ID: Date: Wed, 18 Mar 2020 18:20:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Regards, Hans