lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251021220935.5njyz5lyiwrsf3rw@synopsys.com>
Date: Tue, 21 Oct 2025 22:09:44 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Pritam Manohar Sutar <pritam.sutar@...sung.com>
CC: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "rosa.pila@...sung.com" <rosa.pila@...sung.com>,
        "dev.tailor@...sung.com" <dev.tailor@...sung.com>,
        "faraz.ata@...sung.com" <faraz.ata@...sung.com>,
        "muhammed.ali@...sung.com" <muhammed.ali@...sung.com>,
        "selvarasu.g@...sung.com" <selvarasu.g@...sung.com>
Subject: Re: [PATCH] usb: dwc3: Allow usb role swich control from userspace

On Mon, Oct 20, 2025, Pritam Manohar Sutar wrote:
> There is a possibility of user needs for USB mode switching on boards
> that lack external hardware support for dynamic host/device role
> detection.

It's fine to enable this. But base on this change log, it sounds like
there's no use case at the moment? If there is one, even if it's only
for debugging purpose, please note it so. I'm hesitant to accept changes
base on use case speculation only.

Thanks,
Thinh

> 
> Add an `allow_userspace_control` flag to handle such cases. When
> enabled, it exposes a sysfs attribute that allows userspace to switch
> the USB role manually between host and device. This provides flexibility
> for platforms that cannot rely on hardware-based mode detection.
> 
> The role switch can be done as below
> echo host > /sys/class/usb_role/<ADDR>.usb-role-switch/role
> echo device > /sys/class/usb_role/<ADDR>.usb-role-switch/role
> 
> Signed-off-by: Pritam Manohar Sutar <pritam.sutar@...sung.com>
> ---
>  drivers/usb/dwc3/drd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
> index 4c91240eb429..589bbeb27454 100644
> --- a/drivers/usb/dwc3/drd.c
> +++ b/drivers/usb/dwc3/drd.c
> @@ -515,6 +515,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
>  	dwc3_role_switch.set = dwc3_usb_role_switch_set;
>  	dwc3_role_switch.get = dwc3_usb_role_switch_get;
>  	dwc3_role_switch.driver_data = dwc;
> +	dwc3_role_switch.allow_userspace_control = true;
>  	dwc->role_sw = usb_role_switch_register(dwc->dev, &dwc3_role_switch);
>  	if (IS_ERR(dwc->role_sw))
>  		return PTR_ERR(dwc->role_sw);
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ