[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e63bd494-69f4-4c89-b761-93fd1dd420d8@rowland.harvard.edu>
Date: Wed, 31 May 2023 13:10:15 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Roy Luo <royluo@...gle.com>
Cc: raychi@...gle.com, badhri@...gle.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Michael Grzeschik <m.grzeschik@...gutronix.de>,
Bastien Nocera <hadess@...ess.net>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Matthias Kaehlcke <mka@...omium.org>,
Flavio Suligoi <f.suligoi@...m.it>,
Douglas Anderson <dianders@...omium.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [RFC PATCH v2] usb: core: add sysfs entry for usb device state
On Wed, May 31, 2023 at 01:01:34AM +0000, Roy Luo wrote:
> Expose usb device state to userland as the information is useful in
> detecting non-compliant setups and diagnosing enumeration failures.
> For example:
> - End-to-end signal integrity issues: the device would fail port reset
> repeatedly and thus be stuck in POWERED state.
> - Charge-only cables (missing D+/D- lines): the device would never enter
> POWERED state as the HC would not see any pullup.
>
> What's the status quo?
> We do have error logs such as "Cannot enable. Maybe the USB cable is bad?"
> to flag potential setup issues, but there's no good way to expose them to
> userspace.
>
> Why add a sysfs entry in struct usb_port instead of struct usb_device?
> The struct usb_device is not device_add() to the system until it's in
> ADDRESS state hence we would miss the first two states. The struct
> usb_port is a better place to keep the information because its life
> cycle is longer than the struct usb_device that is attached to the port.
>
> Signed-off-by: Roy Luo <royluo@...gle.com>
> ---
> Changes since v1:
> * Address Greg Kroah-Hartman's comment: replace sysfs_notify with
> sysfs_notify_dirent and remove the workqueue.
> * Address Alan Stern's comment: replicate port_dev->child->state
> in port_dev->state instead of using a pointer to link them.
> ---
Reviewed-by: Alan Stern <stern@...land.harvard.edu>
Powered by blists - more mailing lists