Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5079377rwb; Tue, 17 Jan 2023 08:58:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXukQkGxCcUiL+ns73aM5d/rcVMMJUcbU6Gi9dQp37OJ206YwATpnu8/ovD2qDz9usQxL+nw X-Received: by 2002:a17:906:a393:b0:7c1:1fcf:266c with SMTP id k19-20020a170906a39300b007c11fcf266cmr3698865ejz.14.1673974711998; Tue, 17 Jan 2023 08:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673974711; cv=none; d=google.com; s=arc-20160816; b=WeaH3SaiB+bw6iWU1y5cqEitb6UVgKj8eljn1bWsrvt18PwtopUXgZh7MZtMj7Gtca A9ANzQjaD1kfpv4TIDHjwEmbLGvfWB1/mkmFcXDVHmAnASVjIaLbO6VYcSyLlD1K0Spy MqsIhp2PjOFCsU/yiBN0e/QSyzgYSj2KD91RzPjUcXR6YcaaxYqKDO4J8YYizR/facip XldxC/FXtxnQNhqp6JlxNFLQBhNYC3n/e67hlahuIEdn/HlpPwAdSVso1Pd8Jb6jjwTK l/vNPX97Eeulu6r21QOjybeYakam701Se48laCOHs2ZmEyKQW3awqUJHFB0JaGKzAOYA Axaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=gRi71tUq+W/dAV+KRs4wWA8OD5Oh1P1Iw5eGU1Q7HXk=; b=rJO1YiuHPEb1nI5LfaAGJyy480CmofVZKiyPnVqPAJyQh2mppoKWxN01FuS9kBjND4 WkkVgYVR5TUtXklOFUJS0w/14t31/qiSX85iYy4zPsy1SGqO3hmbd8k/7g625w+gaYIk ANE2+XWwPXPGZQtUO+kXfhjiO02fCtnod8yt2KYZ3Kd3HZVi6GV4RNEFlW4w99srCzZx YelbXJoVZo+7AGjfB3RoGAFaBetDbugLqZDNdSpD++KYA054ZlBkYzgTv49jYjS2SGJY Akj7pTKbkb+L9pxjxwcQ6ModExud6tKnOGYR8PFHRgtE1n26zTkaTvxh1Sh3W9WyNofz QItw== 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 o15-20020a170906974f00b00865245884dbsi18377757ejy.884.2023.01.17.08.58.20; Tue, 17 Jan 2023 08:58:31 -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 S229513AbjAQQBu (ORCPT + 48 others); Tue, 17 Jan 2023 11:01:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjAQQBq (ORCPT ); Tue, 17 Jan 2023 11:01:46 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id BC76430B16 for ; Tue, 17 Jan 2023 08:01:43 -0800 (PST) Received: (qmail 170339 invoked by uid 1000); 17 Jan 2023 11:01:42 -0500 Date: Tue, 17 Jan 2023 11:01:42 -0500 From: Alan Stern To: Bastien Nocera Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Benjamin Tissoires , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [RFC] USB: core: Add wireless_status sysfs attribute Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS autolearn=no 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, 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. > > 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. > > 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. > > 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. > > 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. > > The question is whether this should be a USB sysfs attribute, or one at > the base driver level. Example implementation of the USB sysfs > attribute itself below. Do you know of any non-USB devices using the receiver/emitter approach? > I have a patch for a USB API as well, but I'm having some problems > creating deferred work on a soft irq. > > Cheers > > ---- > Add a wireless_status sysfs attribute to USB devices to keep track of > whether a USB device that uses a receiver/emitter combo has its > emitter connected or disconnected. > > By default, the USB device will declare not to use a receiver/emitter. How do you plan to tell which devices do use a receiver/emitter? Is this something the drivers already knowo about? Is it conceivable that a single device might have more than one receiver? If so, should the attribute belong to an interface rather than to the USB device? Alan Stern