Re: [PATCH v1] usb: handle warm-reset port requests on hub_init

From: yangyinglu
Date: Wed Feb 01 2023 - 04:25:06 EST


Hi Kai-Heng,

I'm sorry that it took so long to reply. I found other ways to fix this problem. I don't need to fix this code. Thank you.


在 2023/1/11 下午3:04, Kai-Heng Feng 写道:
Hi yangyinglu,

On Wed, Jan 11, 2023 at 11:32 AM yangyinglu <yangyinglu@xxxxxxxxxxx> wrote:



在 2023/1/11 上午10:33, Kai-Heng Feng 写道:
Hi yangyinglu,

On Tue, Jan 10, 2023 at 4:20 PM yangyinglu <yangyinglu@xxxxxxxxxxx> wrote:

USB-C storage device not detected on USB 3.0 host when
plugged in after boot, so need to warm-reset port

Is it possible to enable USB dyndbg, plug a USB 3.0 device, then paste
the relevant dmesg here? Thanks!

Kai-Heng

hi,
After entering the system, directly plug and unplug the USB flash
disk. usb control is etron Technology Inc.The log is as follows:
[ 10.354484] radeon 0000:04:00.0: vgaarb: changed VGA decodes:
olddecodes=io+mem,decodes=none:owns=none
[ 10.484794] bridge: filtering via arp/ip/ip6tables is no longer
available by default. Update your scripts to load br_netfilter if you
need this.
[ 10.506968] tun: Universal TUN/TAP device driver, 1.6
[ 10.514128] virbr0: port 1(virbr0-nic) entered blocking state
[ 10.519858] virbr0: port 1(virbr0-nic) entered disabled state
[ 10.525646] device virbr0-nic entered promiscuous mode
[ 10.666536] virbr0: port 1(virbr0-nic) entered blocking state
[ 10.672268] virbr0: port 1(virbr0-nic) entered listening state
[ 10.748564] virbr0: port 1(virbr0-nic) entered disabled state

Loongnix GNU/Linux 20 Release 3 loongson-pc ttyS0


loongson-pc login: [ 147.701011] usb usb4-port1: Cannot enable. Maybe
the USB cable is bad?
[ 151.793206] usb usb4-port1: Cannot enable. Maybe the USB cable is bad?
[ 151.799726] usb usb4-port1: attempt power cycle
[ 157.465465] usb usb4-port1: Cannot enable. Maybe the USB cable is bad?
[ 161.557649] usb usb4-port1: Cannot enable. Maybe the USB cable is bad?
[ 161.564167] usb usb4-port1: unable to enumerate USB device
[ 165.641834] usb usb4-port1: Cannot enable. Maybe the USB cable is bad?

Is it possible to enable USB dyndbg by adding kernel parameter
"usbcore.dyndbg" so we can see the portsc?

Kai-Heng




Signed-off-by: yangyinglu <yangyinglu@xxxxxxxxxxx>
---
drivers/usb/core/hub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 77e73fc8d673..bd4496b80c2d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1159,7 +1159,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
}

/* Make sure a warm-reset request is handled by port_event */
- if (type == HUB_RESUME &&
+ if ((type == HUB_RESUME || type == HUB_INIT2) &&
hub_port_warm_reset_required(hub, port1, portstatus))
set_bit(port1, hub->event_bits);

--
2.20.1