All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@nxp.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: port power is on again after turning off by user space
Date: Tue, 15 Dec 2020 03:31:04 +0000	[thread overview]
Message-ID: <DBBPR04MB79793525394F70DE397E24038BC60@DBBPR04MB7979.eurprd04.prod.outlook.com> (raw)

Hi Alan,

I use one HUB power control application (https://github.com/mvp/uhubctl) to investigate power switchable HUB, and
find the kernel turns port power on again at drivers/usb/core/hub.c, after port power is turned off by user space.

5122                 if (hub_is_port_power_switchable(hub)
5123                                 && !port_is_power_on(hub, portstatus)
5124                                 && !port_dev->port_owner)
5125                         set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);

The main sequence for testing turn port power off like below:

- uhubctl sends command to turn specifc port (eg, 2-1.4) power off.
- devio at kernel gets that command, and send to hub.
- port power is off, the hub_event is triggered due to port status is changed.
- usb_disconnect is called, but port power is on again by kernel at function hub_port_connect.

I can't find the code history why the port power needs to turn on after device is disconnected, do you know why?
Any sugguestions to fix it? Thanks.

Best regards,
Peter Chen
 


             reply	other threads:[~2020-12-15  3:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15  3:31 Peter Chen [this message]
2020-12-15  5:02 ` port power is on again after turning off by user space Jun Li
2020-12-15  5:14   ` Peter Chen
2020-12-15  9:57     ` Peter Chen
2020-12-15 15:55       ` Alan Stern
2020-12-16  2:56         ` Peter Chen
2020-12-16 15:51           ` Alan Stern
2020-12-21  5:37             ` Peter Chen
2020-12-21 16:25               ` Alan Stern
2020-12-22  2:02                 ` Peter Chen
2020-12-22  2:35                   ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DBBPR04MB79793525394F70DE397E24038BC60@DBBPR04MB7979.eurprd04.prod.outlook.com \
    --to=peter.chen@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.