All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode
@ 2021-03-23 12:55 Hongren Zheng (Zenithal)
  2021-03-23 13:01 ` [PATCH v4 2/2] usbip: tools: add usage of device mode in usbip_list.c Hongren Zheng (Zenithal)
  2021-03-23 23:12 ` [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode Shuah Khan
  0 siblings, 2 replies; 10+ messages in thread
From: Hongren Zheng (Zenithal) @ 2021-03-23 12:55 UTC (permalink / raw)
  To: Valentina Manea, Shuah Khan, Antonio Borneo, Greg Kroah-Hartman,
	matt mooney, linux-usb
  Cc: linux-kernel

The commit e0546fd8b748 ("usbip: tools: Start using VUDC backend in
usbip tools") implemented device mode for user space tools, however the
corresponding options are not documented in man page.

This commit documents the options and provides examples on device mode.

Signed-off-by: Hongren Zheng <i@zenithal.me>
---
 tools/usb/usbip/doc/usbip.8  | 25 +++++++++++++++++++++++++
 tools/usb/usbip/doc/usbipd.8 | 22 ++++++++++++++++++++++
 2 files changed, 47 insertions(+)

PATCH v2:
    Add signed-off-by line

PATCH v3:
    Move patch changelog after the marker line
    Remove nickname in signed-off-by line

PATCH v4:
    Use commit short hash and message instead of long hash only when
      referring to commit in the kernel

diff --git a/tools/usb/usbip/doc/usbip.8 b/tools/usb/usbip/doc/usbip.8
index a15d20063b98..385b0eda8746 100644
--- a/tools/usb/usbip/doc/usbip.8
+++ b/tools/usb/usbip/doc/usbip.8
@@ -49,6 +49,13 @@ then exit.
 Attach a remote USB device.
 .PP
 
+.HP
+\fBattach\fR \-\-remote=<\fIhost\fR> \-\-device=<\fdev_id\fR>
+.IP
+Attach a remote USB gadget.
+Only used when the remote usbipd is in device mode.
+.PP
+
 .HP
 \fBdetach\fR \-\-port=<\fIport\fR>
 .IP
@@ -73,6 +80,14 @@ Stop exporting a device so it can be used by a local driver.
 List USB devices exported by a remote host.
 .PP
 
+.HP
+\fBlist\fR \-\-device
+.IP
+List USB gadgets of local usbip-vudc.
+Only used when the local usbipd is in device mode.
+This can not list usbip-vudc USB gadgets of the remote device mode usbipd.
+.PP
+
 .HP
 \fBlist\fR \-\-local
 .IP
@@ -93,5 +108,15 @@ List local USB devices.
     client:# usbip detach --port=0
         - Detach the usb device.
 
+The following example shows the use of device mode
+
+    server:# usbip list --device
+        - Note this is the server side
+
+    client:# modprobe vhci-hcd
+
+    client:# usbip attach --remote=server --device=usbip-vudc.0
+        - Connect the remote USB gadget
+
 .SH "SEE ALSO"
 \fBusbipd\fP\fB(8)\fB\fP
diff --git a/tools/usb/usbip/doc/usbipd.8 b/tools/usb/usbip/doc/usbipd.8
index fb62a756893b..53c8d5792de6 100644
--- a/tools/usb/usbip/doc/usbipd.8
+++ b/tools/usb/usbip/doc/usbipd.8
@@ -29,6 +29,12 @@ Bind to IPv4. Default is both.
 Bind to IPv6. Default is both.
 .PP
 
+.HP
+\fB\-e\fR, \fB\-\-device\fR
+.IP
+Run in device mode. Rather than drive an attached device, create a virtual UDC to bind gadgets to.
+.PP
+
 .HP
 \fB\-D\fR, \fB\-\-daemon\fR
 .IP
@@ -86,6 +92,22 @@ USB/IP client can connect and use exported devices.
         - A usb device 1-2 is now exportable to other hosts!
         - Use 'usbip unbind --busid=1-2' when you want to shutdown exporting and use the device locally.
 
+The following example shows the use of device mode
+
+    server:# modprobe usbip-vudc
+        - Use /sys/class/udc/ interface
+        - usbip-host is independent of this module.
+
+    server:# usbipd -e -D
+        - Start usbip daemon in device mode.
+
+    server:# modprobe g_mass_storage file=/tmp/tmp.img
+        - Bind a gadget to usbip-vudc
+        - in this example, a mass storage gadget is bound
+
+    server:# usbip list --device
+        - Note this is the server side
+
 .SH "SEE ALSO"
 \fBusbip\fP\fB(8)\fB\fP
 
-- 
2.30.1


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

* [PATCH v4 2/2] usbip: tools: add usage of device mode in usbip_list.c
  2021-03-23 12:55 [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode Hongren Zheng (Zenithal)
@ 2021-03-23 13:01 ` Hongren Zheng (Zenithal)
  2021-03-23 15:45   ` Shuah Khan
  2021-03-23 23:12 ` [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode Shuah Khan
  1 sibling, 1 reply; 10+ messages in thread
From: Hongren Zheng (Zenithal) @ 2021-03-23 13:01 UTC (permalink / raw)
  To: Valentina Manea, Shuah Khan, Antonio Borneo, Greg Kroah-Hartman,
	matt mooney, linux-usb
  Cc: linux-kernel

The option '-d/--device' was implemented in 'usbip list' but not
shown in usage. Hence this commit adds this option to usage.

Signed-off-by: Hongren Zheng <i@zenithal.me>
---
 tools/usb/usbip/src/usbip_list.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

PATCH v2:
    Add signed-off-by line

PATCH v3:
    Move patch changelog after the marker line
    Remove nickname in signed-off-by line

PATCH v4:
    Use commit short hash and message instead of long hash only when
      referring to commit in the kernel

diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c
index 8625b0f514ee..3d810bcca02f 100644
--- a/tools/usb/usbip/src/usbip_list.c
+++ b/tools/usb/usbip/src/usbip_list.c
@@ -33,7 +33,8 @@ static const char usbip_list_usage_string[] =
 	"usbip list [-p|--parsable] <args>\n"
 	"    -p, --parsable         Parsable list format\n"
 	"    -r, --remote=<host>    List the exportable USB devices on <host>\n"
-	"    -l, --local            List the local USB devices\n";
+	"    -l, --local            List the local USB devices\n"
+	"    -d, --device           List the local USB gadgets bound to usbip-vudc\n";
 
 void usbip_list_usage(void)
 {
-- 
2.30.1


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

* Re: [PATCH v4 2/2] usbip: tools: add usage of device mode in usbip_list.c
  2021-03-23 13:01 ` [PATCH v4 2/2] usbip: tools: add usage of device mode in usbip_list.c Hongren Zheng (Zenithal)
@ 2021-03-23 15:45   ` Shuah Khan
  0 siblings, 0 replies; 10+ messages in thread
From: Shuah Khan @ 2021-03-23 15:45 UTC (permalink / raw)
  To: Hongren Zheng (Zenithal),
	Valentina Manea, Shuah Khan, Antonio Borneo, Greg Kroah-Hartman,
	matt mooney, linux-usb
  Cc: linux-kernel, Shuah Khan

On 3/23/21 7:01 AM, Hongren Zheng (Zenithal) wrote:
> The option '-d/--device' was implemented in 'usbip list' but not
> shown in usage. Hence this commit adds this option to usage.
> 
> Signed-off-by: Hongren Zheng <i@zenithal.me>
> ---
>   tools/usb/usbip/src/usbip_list.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> PATCH v2:
>      Add signed-off-by line
> 
> PATCH v3:
>      Move patch changelog after the marker line
>      Remove nickname in signed-off-by line
> 
> PATCH v4:
>      Use commit short hash and message instead of long hash only when
>        referring to commit in the kernel
> 
> diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c
> index 8625b0f514ee..3d810bcca02f 100644
> --- a/tools/usb/usbip/src/usbip_list.c
> +++ b/tools/usb/usbip/src/usbip_list.c
> @@ -33,7 +33,8 @@ static const char usbip_list_usage_string[] =
>   	"usbip list [-p|--parsable] <args>\n"
>   	"    -p, --parsable         Parsable list format\n"
>   	"    -r, --remote=<host>    List the exportable USB devices on <host>\n"
> -	"    -l, --local            List the local USB devices\n";
> +	"    -l, --local            List the local USB devices\n"
> +	"    -d, --device           List the local USB gadgets bound to usbip-vudc\n";
>   
>   void usbip_list_usage(void)
>   {
> 

Looks good to me. Thanks for adding this.

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

thanks,
-- Shuah

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

* Re: [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode
  2021-03-23 12:55 [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode Hongren Zheng (Zenithal)
  2021-03-23 13:01 ` [PATCH v4 2/2] usbip: tools: add usage of device mode in usbip_list.c Hongren Zheng (Zenithal)
@ 2021-03-23 23:12 ` Shuah Khan
  2021-03-24  4:36   ` Hongren Zheng (Zenithal)
  1 sibling, 1 reply; 10+ messages in thread
From: Shuah Khan @ 2021-03-23 23:12 UTC (permalink / raw)
  To: Hongren Zheng (Zenithal),
	Valentina Manea, Shuah Khan, Antonio Borneo, Greg Kroah-Hartman,
	matt mooney, linux-usb, Shuah Khan
  Cc: linux-kernel

On 3/23/21 6:55 AM, Hongren Zheng (Zenithal) wrote:
> The commit e0546fd8b748 ("usbip: tools: Start using VUDC backend in
> usbip tools") implemented device mode for user space tools, however the
> corresponding options are not documented in man page.
> 
> This commit documents the options and provides examples on device mode.
> 
> Signed-off-by: Hongren Zheng <i@zenithal.me>
> ---
>   tools/usb/usbip/doc/usbip.8  | 25 +++++++++++++++++++++++++
>   tools/usb/usbip/doc/usbipd.8 | 22 ++++++++++++++++++++++
>   2 files changed, 47 insertions(+)
> 
> PATCH v2:
>      Add signed-off-by line
> 
> PATCH v3:
>      Move patch changelog after the marker line
>      Remove nickname in signed-off-by line
> 
> PATCH v4:
>      Use commit short hash and message instead of long hash only when
>        referring to commit in the kernel
> 

Thank you for the patch. Please see comments below:

> diff --git a/tools/usb/usbip/doc/usbip.8 b/tools/usb/usbip/doc/usbip.8
> index a15d20063b98..385b0eda8746 100644
> --- a/tools/usb/usbip/doc/usbip.8
> +++ b/tools/usb/usbip/doc/usbip.8
> @@ -49,6 +49,13 @@ then exit.
>   Attach a remote USB device.
>   .PP
>   
> +.HP
> +\fBattach\fR \-\-remote=<\fIhost\fR> \-\-device=<\fdev_id\fR>
> +.IP
> +Attach a remote USB gadget.
> +Only used when the remote usbipd is in device mode.
> +.PP
> +
>   .HP
>   \fBdetach\fR \-\-port=<\fIport\fR>
>   .IP

This is a bit confusing. Please add a separate section for
Attach a remote USB gadget complete with attach and detach
instructions.

> @@ -73,6 +80,14 @@ Stop exporting a device so it can be used by a local driver.
>   List USB devices exported by a remote host.
>   .PP
>   
> +.HP
> +\fBlist\fR \-\-device
> +.IP
> +List USB gadgets of local usbip-vudc.
> +Only used when the local usbipd is in device mode.
> +This can not list usbip-vudc USB gadgets of the remote device mode usbipd.
> +.PP
> +
>   .HP
>   \fBlist\fR \-\-local
>   .IP
> @@ -93,5 +108,15 @@ List local USB devices.
>       client:# usbip detach --port=0
>           - Detach the usb device.
>   
> +The following example shows the use of device mode
> +
> +    server:# usbip list --device
> +        - Note this is the server side
> +
> +    client:# modprobe vhci-hcd
> +
> +    client:# usbip attach --remote=server --device=usbip-vudc.0
> +        - Connect the remote USB gadget
> +
>   .SH "SEE ALSO"
>   \fBusbipd\fP\fB(8)\fB\fP
> diff --git a/tools/usb/usbip/doc/usbipd.8 b/tools/usb/usbip/doc/usbipd.8
> index fb62a756893b..53c8d5792de6 100644
> --- a/tools/usb/usbip/doc/usbipd.8
> +++ b/tools/usb/usbip/doc/usbipd.8
> @@ -29,6 +29,12 @@ Bind to IPv4. Default is both.
>   Bind to IPv6. Default is both.
>   .PP
>   
> +.HP
> +\fB\-e\fR, \fB\-\-device\fR
> +.IP
> +Run in device mode. Rather than drive an attached device, create a virtual UDC to bind gadgets to.
> +.PP
> +
>   .HP
>   \fB\-D\fR, \fB\-\-daemon\fR
>   .IP
> @@ -86,6 +92,22 @@ USB/IP client can connect and use exported devices.
>           - A usb device 1-2 is now exportable to other hosts!
>           - Use 'usbip unbind --busid=1-2' when you want to shutdown exporting and use the device locally.
>   
> +The following example shows the use of device mode
> +
> +    server:# modprobe usbip-vudc
> +        - Use /sys/class/udc/ interface
> +        - usbip-host is independent of this module.
> +
> +    server:# usbipd -e -D
> +        - Start usbip daemon in device mode.
> +
> +    server:# modprobe g_mass_storage file=/tmp/tmp.img
> +        - Bind a gadget to usbip-vudc
> +        - in this example, a mass storage gadget is bound
> +
> +    server:# usbip list --device
> +        - Note this is the server side
> +
>   .SH "SEE ALSO"
>   \fBusbip\fP\fB(8)\fB\fP
>   
> 

thanks,
-- Shuah


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

* Re: [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode
  2021-03-23 23:12 ` [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode Shuah Khan
@ 2021-03-24  4:36   ` Hongren Zheng (Zenithal)
  2021-03-24  6:35     ` [PATCH v5 " Hongren Zheng (Zenithal)
  0 siblings, 1 reply; 10+ messages in thread
From: Hongren Zheng (Zenithal) @ 2021-03-24  4:36 UTC (permalink / raw)
  To: Valentina Manea, Shuah Khan, Antonio Borneo, Greg Kroah-Hartman,
	matt mooney, linux-usb
  Cc: linux-kernel

On Tue, Mar 23, 2021 at 05:12:00PM -0600, Shuah Khan wrote:
> On 3/23/21 6:55 AM, Hongren Zheng (Zenithal) wrote:
> > The commit e0546fd8b748 ("usbip: tools: Start using VUDC backend in
> > usbip tools") implemented device mode for user space tools, however the
> > corresponding options are not documented in man page.
> > 
> > This commit documents the options and provides examples on device mode.
> > 
> > Signed-off-by: Hongren Zheng <i@zenithal.me>
> > ---
> >   tools/usb/usbip/doc/usbip.8  | 25 +++++++++++++++++++++++++
> >   tools/usb/usbip/doc/usbipd.8 | 22 ++++++++++++++++++++++
> >   2 files changed, 47 insertions(+)
> > 
> > PATCH v2:
> >      Add signed-off-by line
> > 
> > PATCH v3:
> >      Move patch changelog after the marker line
> >      Remove nickname in signed-off-by line
> > 
> > PATCH v4:
> >      Use commit short hash and message instead of long hash only when
> >        referring to commit in the kernel
> > 
> 
> Thank you for the patch. Please see comments below:
> 
> > diff --git a/tools/usb/usbip/doc/usbip.8 b/tools/usb/usbip/doc/usbip.8
> > index a15d20063b98..385b0eda8746 100644
> > --- a/tools/usb/usbip/doc/usbip.8
> > +++ b/tools/usb/usbip/doc/usbip.8
> > @@ -49,6 +49,13 @@ then exit.
> >   Attach a remote USB device.
> >   .PP
> > +.HP
> > +\fBattach\fR \-\-remote=<\fIhost\fR> \-\-device=<\fdev_id\fR>
> > +.IP
> > +Attach a remote USB gadget.
> > +Only used when the remote usbipd is in device mode.
> > +.PP
> > +
> >   .HP
> >   \fBdetach\fR \-\-port=<\fIport\fR>
> >   .IP
> 
> This is a bit confusing. Please add a separate section for
> Attach a remote USB gadget complete with attach and detach
> instructions.

The detaching of a USB device and a USB gadget share the same detach
command. You attach one USB device/gadget use either one of the
above attach commands, and when you need to detach one device/gadget,
you first need `usbip port` to show the port of imported device/gadget,
for example, 

client:# usbip port
Imported USB devices
====================
Port 00: <Port in Use> at High Speed(480Mbps)
       Netchip Technology, Inc. : Pocketbook Pro 903 / Mobius 2 Action Cam / xDuoo X3 / PocketBook Pro 602
       3-1 -> usbip://localhost:3240/usbip-vudc.0
           -> remote bus/dev 000/000


then use `usbip detach --port=0` to detach the device/gadget.
Since they share the same workflow for detaching, a separate section
may not be necessary.

Meanwhile, in the example below a detach command for device mode
can be added. With the example I think the complete flow for device
mode would be made clear enough.

I will send a new version of this patch with this command added in the
example, some description rephrased and typo fixed.

> 
> > @@ -73,6 +80,14 @@ Stop exporting a device so it can be used by a local driver.
> >   List USB devices exported by a remote host.
> >   .PP
> > +.HP
> > +\fBlist\fR \-\-device
> > +.IP
> > +List USB gadgets of local usbip-vudc.
> > +Only used when the local usbipd is in device mode.
> > +This can not list usbip-vudc USB gadgets of the remote device mode usbipd.
> > +.PP
> > +
> >   .HP
> >   \fBlist\fR \-\-local
> >   .IP
> > @@ -93,5 +108,15 @@ List local USB devices.
> >       client:# usbip detach --port=0
> >           - Detach the usb device.
> > +The following example shows the use of device mode
> > +
> > +    server:# usbip list --device
> > +        - Note this is the server side
> > +
> > +    client:# modprobe vhci-hcd
> > +
> > +    client:# usbip attach --remote=server --device=usbip-vudc.0
> > +        - Connect the remote USB gadget
> > +
> >   .SH "SEE ALSO"
> >   \fBusbipd\fP\fB(8)\fB\fP
> > diff --git a/tools/usb/usbip/doc/usbipd.8 b/tools/usb/usbip/doc/usbipd.8
> > index fb62a756893b..53c8d5792de6 100644
> > --- a/tools/usb/usbip/doc/usbipd.8
> > +++ b/tools/usb/usbip/doc/usbipd.8
> > @@ -29,6 +29,12 @@ Bind to IPv4. Default is both.
> >   Bind to IPv6. Default is both.
> >   .PP
> > +.HP
> > +\fB\-e\fR, \fB\-\-device\fR
> > +.IP
> > +Run in device mode. Rather than drive an attached device, create a virtual UDC to bind gadgets to.
> > +.PP
> > +
> >   .HP
> >   \fB\-D\fR, \fB\-\-daemon\fR
> >   .IP
> > @@ -86,6 +92,22 @@ USB/IP client can connect and use exported devices.
> >           - A usb device 1-2 is now exportable to other hosts!
> >           - Use 'usbip unbind --busid=1-2' when you want to shutdown exporting and use the device locally.
> > +The following example shows the use of device mode
> > +
> > +    server:# modprobe usbip-vudc
> > +        - Use /sys/class/udc/ interface
> > +        - usbip-host is independent of this module.
> > +
> > +    server:# usbipd -e -D
> > +        - Start usbip daemon in device mode.
> > +
> > +    server:# modprobe g_mass_storage file=/tmp/tmp.img
> > +        - Bind a gadget to usbip-vudc
> > +        - in this example, a mass storage gadget is bound
> > +
> > +    server:# usbip list --device
> > +        - Note this is the server side
> > +
> >   .SH "SEE ALSO"
> >   \fBusbip\fP\fB(8)\fB\fP
> > 
> 
> thanks,
> -- Shuah
> 


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

* [PATCH v5 1/2] usbip: tools: add options and examples in man page related to device mode
  2021-03-24  4:36   ` Hongren Zheng (Zenithal)
@ 2021-03-24  6:35     ` Hongren Zheng (Zenithal)
  2021-03-24  7:37       ` Greg Kroah-Hartman
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Hongren Zheng (Zenithal) @ 2021-03-24  6:35 UTC (permalink / raw)
  To: Valentina Manea, Shuah Khan, Antonio Borneo, Greg Kroah-Hartman,
	matt mooney, linux-usb
  Cc: linux-kernel

The commit e0546fd8b748 ("usbip: tools: Start using VUDC backend in
usbip tools") implemented device mode for user space tools, however the
corresponding options are not documented in man page.

This commit documents the options and provides examples on device mode.
Also the command `usbip port` is documented.

Signed-off-by: Hongren Zheng <i@zenithal.me>
---
 tools/usb/usbip/doc/usbip.8  | 42 +++++++++++++++++++++++++++++++++++-
 tools/usb/usbip/doc/usbipd.8 | 26 ++++++++++++++++++++++
 2 files changed, 67 insertions(+), 1 deletion(-)

PATCH v2:
     Add signed-off-by line

PATCH v3:
     Move patch changelog after the marker line
     Remove nickname in signed-off-by line

PATCH v4:
     Use commit short hash and message instead of long hash only when
       referring to commit in the kernel

PATCH v5:
    Add documentation of `usbip port` and its usage in examples
    Add flow of detaching in examples
    Rephrase some description and add punctuations
    Fix typo of `usbip attach --ev-id` to `--dev-id`

diff --git a/tools/usb/usbip/doc/usbip.8 b/tools/usb/usbip/doc/usbip.8
index a15d20063b98..1f26e4a00638 100644
--- a/tools/usb/usbip/doc/usbip.8
+++ b/tools/usb/usbip/doc/usbip.8
@@ -49,10 +49,17 @@ then exit.
 Attach a remote USB device.
 .PP
 
+.HP
+\fBattach\fR \-\-remote=<\fIhost\fR> \-\-device=<\fIdev_id\fR>
+.IP
+Attach a remote USB gadget.
+Only used when the remote usbipd is in device mode.
+.PP
+
 .HP
 \fBdetach\fR \-\-port=<\fIport\fR>
 .IP
-Detach an imported USB device.
+Detach an imported USB device/gadget.
 .PP
 
 .HP
@@ -73,12 +80,26 @@ Stop exporting a device so it can be used by a local driver.
 List USB devices exported by a remote host.
 .PP
 
+.HP
+\fBlist\fR \-\-device
+.IP
+List USB gadgets of local usbip-vudc.
+Only used when the local usbipd is in device mode.
+Note that this can not list usbip-vudc USB gadgets of the remote device mode usbipd.
+.PP
+
 .HP
 \fBlist\fR \-\-local
 .IP
 List local USB devices.
 .PP
 
+.HP
+\fBport\fR
+.IP
+List imported devices/gadgets.
+.PP
+
 
 .SH EXAMPLES
 
@@ -90,8 +111,27 @@ List local USB devices.
     client:# usbip attach --remote=server --busid=1-2
         - Connect the remote USB device.
 
+    client:# usbip port
+        - List imported devices/gadgets.
+
     client:# usbip detach --port=0
         - Detach the usb device.
 
+The following example shows the usage of device mode
+
+    server:# usbip list --device
+        - List gadgets exported by local usbipd server.
+
+    client:# modprobe vhci-hcd
+
+    client:# usbip attach --remote=server --device=usbip-vudc.0
+        - Connect the remote USB gadget.
+
+    client:# usbip port
+        - List imported devices/gadgets.
+
+    client:# usbip detach --port=0
+        - Detach the usb gadget.
+
 .SH "SEE ALSO"
 \fBusbipd\fP\fB(8)\fB\fP
diff --git a/tools/usb/usbip/doc/usbipd.8 b/tools/usb/usbip/doc/usbipd.8
index fb62a756893b..d974394f86a1 100644
--- a/tools/usb/usbip/doc/usbipd.8
+++ b/tools/usb/usbip/doc/usbipd.8
@@ -29,6 +29,12 @@ Bind to IPv4. Default is both.
 Bind to IPv6. Default is both.
 .PP
 
+.HP
+\fB\-e\fR, \fB\-\-device\fR
+.IP
+Run in device mode. Rather than drive an attached device, create a virtual UDC to bind gadgets to.
+.PP
+
 .HP
 \fB\-D\fR, \fB\-\-daemon\fR
 .IP
@@ -86,6 +92,26 @@ USB/IP client can connect and use exported devices.
         - A usb device 1-2 is now exportable to other hosts!
         - Use 'usbip unbind --busid=1-2' when you want to shutdown exporting and use the device locally.
 
+The following example shows the usage of device mode
+
+    server:# modprobe usbip-vudc
+        - Use /sys/class/udc/ interface.
+        - usbip-host is independent of this module.
+
+    server:# usbipd -e -D
+        - Start usbip daemon in device mode.
+
+    server:# modprobe g_mass_storage file=/tmp/tmp.img
+        - Bind a gadget to usbip-vudc.
+        - in this example, a mass storage gadget is bound.
+
+    server:# usbip list --device
+        - List gadgets exported by local usbipd server.
+
+    server:# modprobe -r g_mass_storage
+        - Unbind a gadget from usbip-vudc.
+        - in this example, the previous mass storage gadget is unbound.
+
 .SH "SEE ALSO"
 \fBusbip\fP\fB(8)\fB\fP
 
-- 
2.30.1


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

* Re: [PATCH v5 1/2] usbip: tools: add options and examples in man page related to device mode
  2021-03-24  6:35     ` [PATCH v5 " Hongren Zheng (Zenithal)
@ 2021-03-24  7:37       ` Greg Kroah-Hartman
  2021-03-24  7:56       ` [PATCH v5 2/2] usbip: tools: add usage of device mode in usbip_list.c Hongren Zheng (Zenithal)
  2021-03-24 23:50       ` [PATCH v5 1/2] usbip: tools: add options and examples in man page related to device mode Shuah Khan
  2 siblings, 0 replies; 10+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-24  7:37 UTC (permalink / raw)
  To: Hongren Zheng (Zenithal)
  Cc: Valentina Manea, Shuah Khan, Antonio Borneo, matt mooney,
	linux-usb, linux-kernel

On Wed, Mar 24, 2021 at 02:35:52PM +0800, Hongren Zheng (Zenithal) wrote:
> The commit e0546fd8b748 ("usbip: tools: Start using VUDC backend in
> usbip tools") implemented device mode for user space tools, however the
> corresponding options are not documented in man page.
> 
> This commit documents the options and provides examples on device mode.
> Also the command `usbip port` is documented.
> 
> Signed-off-by: Hongren Zheng <i@zenithal.me>
> ---
>  tools/usb/usbip/doc/usbip.8  | 42 +++++++++++++++++++++++++++++++++++-
>  tools/usb/usbip/doc/usbipd.8 | 26 ++++++++++++++++++++++
>  2 files changed, 67 insertions(+), 1 deletion(-)
> 

Always resend the whole series, not just individual patches of the
series.  When you send individual updates, it's almost impossible to
figure out what patch is what to review and apply properly.

There's no "waste" by resending the whole series, it makes it obvious
what is going on and what needs to be reviewed.

thanks,

greg k-h

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

* [PATCH v5 2/2] usbip: tools: add usage of device mode in usbip_list.c
  2021-03-24  6:35     ` [PATCH v5 " Hongren Zheng (Zenithal)
  2021-03-24  7:37       ` Greg Kroah-Hartman
@ 2021-03-24  7:56       ` Hongren Zheng (Zenithal)
  2021-03-24 23:50         ` Shuah Khan
  2021-03-24 23:50       ` [PATCH v5 1/2] usbip: tools: add options and examples in man page related to device mode Shuah Khan
  2 siblings, 1 reply; 10+ messages in thread
From: Hongren Zheng (Zenithal) @ 2021-03-24  7:56 UTC (permalink / raw)
  To: Valentina Manea, Shuah Khan, Antonio Borneo, Greg Kroah-Hartman,
	matt mooney, linux-usb
  Cc: linux-kernel

The option '-d/--device' was implemented in 'usbip list' but not
shown in usage. Hence this commit adds this option to usage.

Signed-off-by: Hongren Zheng <i@zenithal.me>
---
 tools/usb/usbip/src/usbip_list.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

PATCH v2:
     Add signed-off-by line

PATCH v3:
     Move patch changelog after the marker line
     Remove nickname in signed-off-by line

PATCH v4:
     Use commit short hash and message instead of long hash only when
       referring to commit in the kernel

PATCH v5:
    Add documentation of `usbip port` and its usage in examples
    Add flow of detaching in examples
    Rephrase some description and add punctuations
    Fix typo of `usbip attach --ev-id` to `--dev-id`

diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c
index 8625b0f514ee..3d810bcca02f 100644
--- a/tools/usb/usbip/src/usbip_list.c
+++ b/tools/usb/usbip/src/usbip_list.c
@@ -33,7 +33,8 @@ static const char usbip_list_usage_string[] =
 	"usbip list [-p|--parsable] <args>\n"
 	"    -p, --parsable         Parsable list format\n"
 	"    -r, --remote=<host>    List the exportable USB devices on <host>\n"
-	"    -l, --local            List the local USB devices\n";
+	"    -l, --local            List the local USB devices\n"
+	"    -d, --device           List the local USB gadgets bound to usbip-vudc\n";
 
 void usbip_list_usage(void)
 {
-- 
2.30.1


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

* Re: [PATCH v5 1/2] usbip: tools: add options and examples in man page related to device mode
  2021-03-24  6:35     ` [PATCH v5 " Hongren Zheng (Zenithal)
  2021-03-24  7:37       ` Greg Kroah-Hartman
  2021-03-24  7:56       ` [PATCH v5 2/2] usbip: tools: add usage of device mode in usbip_list.c Hongren Zheng (Zenithal)
@ 2021-03-24 23:50       ` Shuah Khan
  2 siblings, 0 replies; 10+ messages in thread
From: Shuah Khan @ 2021-03-24 23:50 UTC (permalink / raw)
  To: Hongren Zheng (Zenithal),
	Valentina Manea, Shuah Khan, Antonio Borneo, Greg Kroah-Hartman,
	matt mooney, linux-usb, Shuah Khan
  Cc: linux-kernel

On 3/24/21 12:35 AM, Hongren Zheng (Zenithal) wrote:
> The commit e0546fd8b748 ("usbip: tools: Start using VUDC backend in
> usbip tools") implemented device mode for user space tools, however the
> corresponding options are not documented in man page.
> 
> This commit documents the options and provides examples on device mode.
> Also the command `usbip port` is documented.
> 
> Signed-off-by: Hongren Zheng <i@zenithal.me>
> ---
>   tools/usb/usbip/doc/usbip.8  | 42 +++++++++++++++++++++++++++++++++++-
>   tools/usb/usbip/doc/usbipd.8 | 26 ++++++++++++++++++++++
>   2 files changed, 67 insertions(+), 1 deletion(-)
> 
> PATCH v2:
>       Add signed-off-by line
> 
> PATCH v3:
>       Move patch changelog after the marker line
>       Remove nickname in signed-off-by line
> 
> PATCH v4:
>       Use commit short hash and message instead of long hash only when
>         referring to commit in the kernel
> 
> PATCH v5:
>      Add documentation of `usbip port` and its usage in examples
>      Add flow of detaching in examples
>      Rephrase some description and add punctuations
>      Fix typo of `usbip attach --ev-id` to `--dev-id`
> 
> diff --git a/tools/usb/usbip/doc/usbip.8 b/tools/usb/usbip/doc/usbip.8
> index a15d20063b98..1f26e4a00638 100644
> --- a/tools/usb/usbip/doc/usbip.8
> +++ b/tools/usb/usbip/doc/usbip.8
> @@ -49,10 +49,17 @@ then exit.
>   Attach a remote USB device.
>   .PP
>   
> +.HP
> +\fBattach\fR \-\-remote=<\fIhost\fR> \-\-device=<\fIdev_id\fR>
> +.IP
> +Attach a remote USB gadget.
> +Only used when the remote usbipd is in device mode.
> +.PP
> +
>   .HP
>   \fBdetach\fR \-\-port=<\fIport\fR>
>   .IP
> -Detach an imported USB device.
> +Detach an imported USB device/gadget.
>   .PP
>   
>   .HP
> @@ -73,12 +80,26 @@ Stop exporting a device so it can be used by a local driver.
>   List USB devices exported by a remote host.
>   .PP
>   
> +.HP
> +\fBlist\fR \-\-device
> +.IP
> +List USB gadgets of local usbip-vudc.
> +Only used when the local usbipd is in device mode.
> +Note that this can not list usbip-vudc USB gadgets of the remote device mode usbipd.
> +.PP
> +
>   .HP
>   \fBlist\fR \-\-local
>   .IP
>   List local USB devices.
>   .PP
>   
> +.HP
> +\fBport\fR
> +.IP
> +List imported devices/gadgets.
> +.PP
> +
>   
>   .SH EXAMPLES
>   
> @@ -90,8 +111,27 @@ List local USB devices.
>       client:# usbip attach --remote=server --busid=1-2
>           - Connect the remote USB device.
>   
> +    client:# usbip port
> +        - List imported devices/gadgets.
> +
>       client:# usbip detach --port=0
>           - Detach the usb device.
>   
> +The following example shows the usage of device mode
> +
> +    server:# usbip list --device
> +        - List gadgets exported by local usbipd server.
> +
> +    client:# modprobe vhci-hcd
> +
> +    client:# usbip attach --remote=server --device=usbip-vudc.0
> +        - Connect the remote USB gadget.
> +
> +    client:# usbip port
> +        - List imported devices/gadgets.
> +
> +    client:# usbip detach --port=0
> +        - Detach the usb gadget.
> +
>   .SH "SEE ALSO"
>   \fBusbipd\fP\fB(8)\fB\fP
> diff --git a/tools/usb/usbip/doc/usbipd.8 b/tools/usb/usbip/doc/usbipd.8
> index fb62a756893b..d974394f86a1 100644
> --- a/tools/usb/usbip/doc/usbipd.8
> +++ b/tools/usb/usbip/doc/usbipd.8
> @@ -29,6 +29,12 @@ Bind to IPv4. Default is both.
>   Bind to IPv6. Default is both.
>   .PP
>   
> +.HP
> +\fB\-e\fR, \fB\-\-device\fR
> +.IP
> +Run in device mode. Rather than drive an attached device, create a virtual UDC to bind gadgets to.
> +.PP
> +
>   .HP
>   \fB\-D\fR, \fB\-\-daemon\fR
>   .IP
> @@ -86,6 +92,26 @@ USB/IP client can connect and use exported devices.
>           - A usb device 1-2 is now exportable to other hosts!
>           - Use 'usbip unbind --busid=1-2' when you want to shutdown exporting and use the device locally.
>   
> +The following example shows the usage of device mode
> +
> +    server:# modprobe usbip-vudc
> +        - Use /sys/class/udc/ interface.
> +        - usbip-host is independent of this module.
> +
> +    server:# usbipd -e -D
> +        - Start usbip daemon in device mode.
> +
> +    server:# modprobe g_mass_storage file=/tmp/tmp.img
> +        - Bind a gadget to usbip-vudc.
> +        - in this example, a mass storage gadget is bound.
> +
> +    server:# usbip list --device
> +        - List gadgets exported by local usbipd server.
> +
> +    server:# modprobe -r g_mass_storage
> +        - Unbind a gadget from usbip-vudc.
> +        - in this example, the previous mass storage gadget is unbound.
> +
>   .SH "SEE ALSO"
>   \fBusbip\fP\fB(8)\fB\fP
>   
> 

Thank you. Looks good.

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

thanks,
-- Shuah

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

* Re: [PATCH v5 2/2] usbip: tools: add usage of device mode in usbip_list.c
  2021-03-24  7:56       ` [PATCH v5 2/2] usbip: tools: add usage of device mode in usbip_list.c Hongren Zheng (Zenithal)
@ 2021-03-24 23:50         ` Shuah Khan
  0 siblings, 0 replies; 10+ messages in thread
From: Shuah Khan @ 2021-03-24 23:50 UTC (permalink / raw)
  To: Hongren Zheng (Zenithal),
	Valentina Manea, Shuah Khan, Antonio Borneo, Greg Kroah-Hartman,
	matt mooney, linux-usb, Shuah Khan
  Cc: linux-kernel

On 3/24/21 1:56 AM, Hongren Zheng (Zenithal) wrote:
> The option '-d/--device' was implemented in 'usbip list' but not
> shown in usage. Hence this commit adds this option to usage.
> 
> Signed-off-by: Hongren Zheng <i@zenithal.me>
> ---
>   tools/usb/usbip/src/usbip_list.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> PATCH v2:
>       Add signed-off-by line
> 
> PATCH v3:
>       Move patch changelog after the marker line
>       Remove nickname in signed-off-by line
> 
> PATCH v4:
>       Use commit short hash and message instead of long hash only when
>         referring to commit in the kernel
> 
> PATCH v5:
>      Add documentation of `usbip port` and its usage in examples
>      Add flow of detaching in examples
>      Rephrase some description and add punctuations
>      Fix typo of `usbip attach --ev-id` to `--dev-id`
> 
> diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c
> index 8625b0f514ee..3d810bcca02f 100644
> --- a/tools/usb/usbip/src/usbip_list.c
> +++ b/tools/usb/usbip/src/usbip_list.c
> @@ -33,7 +33,8 @@ static const char usbip_list_usage_string[] =
>   	"usbip list [-p|--parsable] <args>\n"
>   	"    -p, --parsable         Parsable list format\n"
>   	"    -r, --remote=<host>    List the exportable USB devices on <host>\n"
> -	"    -l, --local            List the local USB devices\n";
> +	"    -l, --local            List the local USB devices\n"
> +	"    -d, --device           List the local USB gadgets bound to usbip-vudc\n";
>   
>   void usbip_list_usage(void)
>   {
> 

Thank you. Looks good.

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

thanks,
-- Shuah

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

end of thread, other threads:[~2021-03-24 23:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 12:55 [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode Hongren Zheng (Zenithal)
2021-03-23 13:01 ` [PATCH v4 2/2] usbip: tools: add usage of device mode in usbip_list.c Hongren Zheng (Zenithal)
2021-03-23 15:45   ` Shuah Khan
2021-03-23 23:12 ` [PATCH v4 1/2] usbip: tools: add options and examples in man page related to device mode Shuah Khan
2021-03-24  4:36   ` Hongren Zheng (Zenithal)
2021-03-24  6:35     ` [PATCH v5 " Hongren Zheng (Zenithal)
2021-03-24  7:37       ` Greg Kroah-Hartman
2021-03-24  7:56       ` [PATCH v5 2/2] usbip: tools: add usage of device mode in usbip_list.c Hongren Zheng (Zenithal)
2021-03-24 23:50         ` Shuah Khan
2021-03-24 23:50       ` [PATCH v5 1/2] usbip: tools: add options and examples in man page related to device mode Shuah Khan

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.