public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usbip: give a more helpful error message if vhdi_hcd isn't loaded
@ 2023-05-08 21:21 Galen Guyer
  2023-05-09  2:17 ` Hongren Zheng
  0 siblings, 1 reply; 4+ messages in thread
From: Galen Guyer @ 2023-05-08 21:21 UTC (permalink / raw)
  To: Valentina Manea, Shuah Khan, Hongren Zheng, linux-usb; +Cc: Galen Guyer

Suggest loading vhdi_hcd if it's not loaded to make error message less opaque

Signed-off-by: Galen Guyer <galen@galenguyer.com>
---
 tools/usb/usbip/src/usbip_attach.c | 2 +-
 tools/usb/usbip/src/usbip_detach.c | 2 +-
 tools/usb/usbip/src/usbip_port.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/usb/usbip/src/usbip_attach.c b/tools/usb/usbip/src/usbip_attach.c
index b4aeb9f1f493..531a415538f9 100644
--- a/tools/usb/usbip/src/usbip_attach.c
+++ b/tools/usb/usbip/src/usbip_attach.c
@@ -86,7 +86,7 @@ static int import_device(int sockfd, struct usbip_usb_device *udev)
 
 	rc = usbip_vhci_driver_open();
 	if (rc < 0) {
-		err("open vhci_driver");
+		err("open vhci_driver (is vhci_hcd loaded?)");
 		goto err_out;
 	}
 
diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
index aec993159036..b29101986b5a 100644
--- a/tools/usb/usbip/src/usbip_detach.c
+++ b/tools/usb/usbip/src/usbip_detach.c
@@ -50,7 +50,7 @@ static int detach_port(char *port)
 
 	ret = usbip_vhci_driver_open();
 	if (ret < 0) {
-		err("open vhci_driver");
+		err("open vhci_driver (is vhci_hcd loaded?)");
 		return -1;
 	}
 
diff --git a/tools/usb/usbip/src/usbip_port.c b/tools/usb/usbip/src/usbip_port.c
index 4d14387df13d..21a20e378419 100644
--- a/tools/usb/usbip/src/usbip_port.c
+++ b/tools/usb/usbip/src/usbip_port.c
@@ -18,7 +18,7 @@ static int list_imported_devices(void)
 
 	ret = usbip_vhci_driver_open();
 	if (ret < 0) {
-		err("open vhci_driver");
+		err("open vhci_driver (is vhci_hcd loaded?)");
 		goto err_names_free;
 	}
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usbip: give a more helpful error message if vhdi_hcd isn't loaded
  2023-05-08 21:21 [PATCH] usbip: give a more helpful error message if vhdi_hcd isn't loaded Galen Guyer
@ 2023-05-09  2:17 ` Hongren Zheng
  2023-05-09  2:28   ` Hongren Zheng
  0 siblings, 1 reply; 4+ messages in thread
From: Hongren Zheng @ 2023-05-09  2:17 UTC (permalink / raw)
  To: Galen Guyer; +Cc: Valentina Manea, Shuah Khan, linux-usb

On Mon, May 08, 2023 at 05:21:20PM -0400, Galen Guyer wrote:
> Suggest loading vhdi_hcd if it's not loaded to make error message less opaque
> 
> Signed-off-by: Galen Guyer <galen@galenguyer.com>

Reviewed-By: Hongren Zheng <i@zenithal.me>

When I was young I usually get confused with this error message.

BTW would you like to make other patches regarding the error generated
when kernel module not loaded? For example, when usbip-host is not
loaded, the error message of usbip bind does not give much help.

$ usbip bind -b 1-6
usbip: error: unable to bind device on 1-6

Another example is that when there is no gadget attached to
the usbip-vudc, the following error messages are not helpful

$ usbipd -e -D
libusbip: error: Cannot read vudc device descr file: No such device

$ usbip list -d
usbip: error: problem getting device attributes: No such device


> ---
>  tools/usb/usbip/src/usbip_attach.c | 2 +-
>  tools/usb/usbip/src/usbip_detach.c | 2 +-
>  tools/usb/usbip/src/usbip_port.c   | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/usb/usbip/src/usbip_attach.c b/tools/usb/usbip/src/usbip_attach.c
> index b4aeb9f1f493..531a415538f9 100644
> --- a/tools/usb/usbip/src/usbip_attach.c
> +++ b/tools/usb/usbip/src/usbip_attach.c
> @@ -86,7 +86,7 @@ static int import_device(int sockfd, struct usbip_usb_device *udev)
>  
>  	rc = usbip_vhci_driver_open();
>  	if (rc < 0) {
> -		err("open vhci_driver");
> +		err("open vhci_driver (is vhci_hcd loaded?)");
>  		goto err_out;
>  	}
>  
> diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
> index aec993159036..b29101986b5a 100644
> --- a/tools/usb/usbip/src/usbip_detach.c
> +++ b/tools/usb/usbip/src/usbip_detach.c
> @@ -50,7 +50,7 @@ static int detach_port(char *port)
>  
>  	ret = usbip_vhci_driver_open();
>  	if (ret < 0) {
> -		err("open vhci_driver");
> +		err("open vhci_driver (is vhci_hcd loaded?)");
>  		return -1;
>  	}
>  
> diff --git a/tools/usb/usbip/src/usbip_port.c b/tools/usb/usbip/src/usbip_port.c
> index 4d14387df13d..21a20e378419 100644
> --- a/tools/usb/usbip/src/usbip_port.c
> +++ b/tools/usb/usbip/src/usbip_port.c
> @@ -18,7 +18,7 @@ static int list_imported_devices(void)
>  
>  	ret = usbip_vhci_driver_open();
>  	if (ret < 0) {
> -		err("open vhci_driver");
> +		err("open vhci_driver (is vhci_hcd loaded?)");
>  		goto err_names_free;
>  	}
>  
> -- 
> 2.40.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usbip: give a more helpful error message if vhdi_hcd isn't loaded
  2023-05-09  2:17 ` Hongren Zheng
@ 2023-05-09  2:28   ` Hongren Zheng
  2023-05-24 19:23     ` Shuah Khan
  0 siblings, 1 reply; 4+ messages in thread
From: Hongren Zheng @ 2023-05-09  2:28 UTC (permalink / raw)
  To: Galen Guyer; +Cc: Valentina Manea, Shuah Khan, linux-usb

On Tue, May 09, 2023 at 10:17:31AM +0800, Hongren Zheng wrote:
> On Mon, May 08, 2023 at 05:21:20PM -0400, Galen Guyer wrote:
> > Suggest loading vhdi_hcd if it's not loaded to make error message less opaque
> > 
> > Signed-off-by: Galen Guyer <galen@galenguyer.com>
> 
> Reviewed-By: Hongren Zheng <i@zenithal.me>
> 
> When I was young I usually get confused with this error message.
> 
> BTW would you like to make other patches regarding the error generated
> when kernel module not loaded? For example, when usbip-host is not
> loaded, the error message of usbip bind does not give much help.
> 
> $ usbip bind -b 1-6
> usbip: error: unable to bind device on 1-6
> 
> Another example is that when there is no gadget attached to
> the usbip-vudc, the following error messages are not helpful
> 
> $ usbipd -e -D
> libusbip: error: Cannot read vudc device descr file: No such device
> 
> $ usbip list -d
> usbip: error: problem getting device attributes: No such device
> 
> 
> > ---
> >  tools/usb/usbip/src/usbip_attach.c | 2 +-
> >  tools/usb/usbip/src/usbip_detach.c | 2 +-
> >  tools/usb/usbip/src/usbip_port.c   | 2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/usb/usbip/src/usbip_attach.c b/tools/usb/usbip/src/usbip_attach.c
> > index b4aeb9f1f493..531a415538f9 100644
> > --- a/tools/usb/usbip/src/usbip_attach.c
> > +++ b/tools/usb/usbip/src/usbip_attach.c
> > @@ -86,7 +86,7 @@ static int import_device(int sockfd, struct usbip_usb_device *udev)
> >  
> >  	rc = usbip_vhci_driver_open();
> >  	if (rc < 0) {
> > -		err("open vhci_driver");
> > +		err("open vhci_driver (is vhci_hcd loaded?)");

One more thing: the kernel module is called vhci-hcd.ko instead of
vhci_hcd. Though dmesg often shows vhci_hcd and this name is used
in the code.

> >  		goto err_out;
> >  	}
> >  
> > diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
> > index aec993159036..b29101986b5a 100644
> > --- a/tools/usb/usbip/src/usbip_detach.c
> > +++ b/tools/usb/usbip/src/usbip_detach.c
> > @@ -50,7 +50,7 @@ static int detach_port(char *port)
> >  
> >  	ret = usbip_vhci_driver_open();
> >  	if (ret < 0) {
> > -		err("open vhci_driver");
> > +		err("open vhci_driver (is vhci_hcd loaded?)");
> >  		return -1;
> >  	}
> >  
> > diff --git a/tools/usb/usbip/src/usbip_port.c b/tools/usb/usbip/src/usbip_port.c
> > index 4d14387df13d..21a20e378419 100644
> > --- a/tools/usb/usbip/src/usbip_port.c
> > +++ b/tools/usb/usbip/src/usbip_port.c
> > @@ -18,7 +18,7 @@ static int list_imported_devices(void)
> >  
> >  	ret = usbip_vhci_driver_open();
> >  	if (ret < 0) {
> > -		err("open vhci_driver");
> > +		err("open vhci_driver (is vhci_hcd loaded?)");
> >  		goto err_names_free;
> >  	}
> >  
> > -- 
> > 2.40.1
> > 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usbip: give a more helpful error message if vhdi_hcd isn't loaded
  2023-05-09  2:28   ` Hongren Zheng
@ 2023-05-24 19:23     ` Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2023-05-24 19:23 UTC (permalink / raw)
  To: Hongren Zheng, Galen Guyer
  Cc: Valentina Manea, Shuah Khan, linux-usb, Shuah Khan

On 5/8/23 20:28, Hongren Zheng wrote:
> On Tue, May 09, 2023 at 10:17:31AM +0800, Hongren Zheng wrote:
>> On Mon, May 08, 2023 at 05:21:20PM -0400, Galen Guyer wrote:
>>> Suggest loading vhdi_hcd if it's not loaded to make error message less opaque
>>>
>>> Signed-off-by: Galen Guyer <galen@galenguyer.com>
>>
>> Reviewed-By: Hongren Zheng <i@zenithal.me>
>>

Looks good to me.

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-24 19:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-08 21:21 [PATCH] usbip: give a more helpful error message if vhdi_hcd isn't loaded Galen Guyer
2023-05-09  2:17 ` Hongren Zheng
2023-05-09  2:28   ` Hongren Zheng
2023-05-24 19:23     ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox