Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5154931rwb; Tue, 17 Jan 2023 09:50:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXvjZ7Lc1uvKXBP5TMxHUDRu3tAlN/s+3u4lVevYVe4uGoPZ3K+GOrn6+YVAqjhJJVAMfIMT X-Received: by 2002:a17:90b:1d08:b0:226:f63b:e26 with SMTP id on8-20020a17090b1d0800b00226f63b0e26mr4125172pjb.7.1673977852462; Tue, 17 Jan 2023 09:50:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673977852; cv=none; d=google.com; s=arc-20160816; b=rd5BAtl+BLyftlioBKQKLQhjYpFhTS3GYWtHyUdvQV0tmxpwbX9stZzHKEisv/5ki6 j15crd313GJk+wufMRUESX8hAWW4DSconT1feUJZe4dYsKY2xsftygGPUsvqhE6mOixN yuKyJ2tIR5FODQSo5oMTxa3Nq3dHCAiW+g4gM8YqJqP2d1sMRr9ieo7Mh6VEkeTEu9Ao IhXtQkLWYtXFcZT8dNpzF/6cypMAZ/xU/Ua8A/UZhrbjwPHN2p2uqmAUMztDsTUq/7W/ NsTny4FC26+gL2Vs/OOxdUM/kb7EkA78mr2goM6kCud1KsUn22XkLaePDs9ZGaIPm8c9 b+Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=kHSK6xYpIun2KgZ2W+sX2t41/vyx6kRJ7zBIBfxDTyg=; b=BhWFl7FiaVV8gWZ2FjonoDm+BFTenL75P1ZfxvdK495oEn8vxtEk7RX5n1ogk3oD7U 1CaNPhuRokkjC2R3SuH8iRkeR8s2KSrElCUK/Zlf1nwDNQ+spprHCpTPjY9Yw1l39oP2 m3gxZ5pa+8VyT2fZ0I0wCA3B/U9yzYxUkgvfMd9LOYAcO56xefGBxqqwCBQD57/nvcup slSI+Fa6X8aBOtvc3BI5fFvPMrP6ShQHC7SoxUpp0WjuxtoXF7u4vy986St9fx9v1WbU B+O7QAquAtb0b4EaX3vUEP4JTah1hqWXU4cHQm5DbPeqBVGjTAlcZgpW9bBnhKdlML6x RNJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a17090a938400b002266735a4b8si13131416pjo.81.2023.01.17.09.50.46; Tue, 17 Jan 2023 09:50:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232867AbjAQQgu convert rfc822-to-8bit (ORCPT + 48 others); Tue, 17 Jan 2023 11:36:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbjAQQgS (ORCPT ); Tue, 17 Jan 2023 11:36:18 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AED53A5A6; Tue, 17 Jan 2023 08:36:04 -0800 (PST) Received: (Authenticated sender: hadess@hadess.net) by mail.gandi.net (Postfix) with ESMTPSA id D3B6E2000F; Tue, 17 Jan 2023 16:36:01 +0000 (UTC) Message-ID: <3dc9061bd123188ed64401d1504f919162e3dd99.camel@hadess.net> Subject: Re: [RFC] USB: core: Add wireless_status sysfs attribute From: Bastien Nocera To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Benjamin Tissoires , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Date: Tue, 17 Jan 2023 17:36:01 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.46.3 (3.46.3-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2023-01-17 at 17:14 +0100, Greg Kroah-Hartman wrote: > On Tue, Jan 17, 2023 at 04:17:23PM +0100, Bastien Nocera wrote: > > Hey, > > > > TLDR: new sysfs attribute that makes it possible to leave receivers > > for > > wireless headsets plugged in. At the USB level, or at the base > > driver > > level? > > > > Longer version: > > I started working on implementing support for some wireless > > headsets > > that use USB receivers to communicate to the headset itself. > > Would this also include wireless keyboard/mice recievers? This could also be used by certain keyboard or mice receivers, if the keyboard or mouse is kept constantly connected and there's a way to find out whether it's connected or not. > Why is "wireless" somehow a special attribute that userspace needs to > know about? "wireless" isn't the attribute user-space would be interested in, "wireless status" would be. If the headset's wireless status is "disconnected", then the headset is unavailable. Then user-space can route the audio accordingly. > > The USB receivers have multiple interfaces, and independent drivers > > for > > each, as is wont to do for USB devices. There's usually a HID > > interface > > to do the custom stuff (LEDs, battery status, connection status, > > etc.) > > and a standard audio class interface. > > This probably should be an interface attribute (as Alan points out), > as > it's not a device attribute (think about updating the firmware for > one > of these, that's on an interface for the reciever you plugged in, not > on > the other end of the wireless connection...) OK, fair enough. > > Those drivers don't know anything about each other, and getting > > them to > > talk to each other would be rather complicated. Additionally the > > audio > > interface is still somewhat functional when the headset is > > disconnected. > > Those drivers shouldn't know about each other, that's up to userspace > to > group and control if needed.  No kernel interactions should be > needed. > > > In the end, I came up with this new sysfs attribute that would make > > it > > possible for user-space (PulseAudio or Pipewire) to know whether > > the > > receiver is plugged in or not. > > Again, should be an interface attribute, if at all. > > > That allows user-space to not show the battery information for the > > device (rather than 0 percent), not offer the headset as an output, > > and > > potentially automatically switch to it when the headset is powered > > on. > > Same for a keyboard/mouse, right? Yes, although I haven't found devices where this would be useful. I'll reimplement this as an interface attribute. Thanks very much to you and Alan for the quick replies. Cheers