RE: [PATCH v7 1/3] usbip: exporting devices

2016-02-15 Thread fx IWATA NOBUO
> Why isn't this in the changelog itself?  But more importantly, I don't see
> how this patch makes your "goal" implemented...

Sorry.
I think almost same thing is in cover letter but version info is getting long.
Anyway I will improve the log.

> Anyway, please break this all up into smaller, logical, easier to review,
> patches and we can take it from there.

OK.

Thank you,

n.iwata
//
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 1/3] usbip: exporting devices

2016-02-15 Thread Greg KH
On Mon, Feb 15, 2016 at 04:21:59AM +, fx IWATA NOBUO wrote:
> > I don't see any benifit here at all, please explain it better.
> > You are saying what your patch does, but not why we would want it.
> 
> It may not be better than cover letter but I try.
> 
> My use case is 
> a) a service in internet with VHCI
> b) distributed small Linux nodes with STUB and IoT devices.
> 
> IoT device may be inside firewall.
> To pass firewall, usually WebSocket is used.
> It can be added tunneling daemon in both side.
> Connection must be initiated from device side.
> This is the most important for my use case.
> 
> In the use case, there may be no operator checking device.
> Device may be plug-and-played.
> 
> For security consideration, client verification be the tunneling
> daemon.

Why isn't this in the changelog itself?  But more importantly, I don't
see how this patch makes your "goal" implemented...

Anyway, please break this all up into smaller, logical, easier to
review, patches and we can take it from there.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v7 1/3] usbip: exporting devices

2016-02-14 Thread fx IWATA NOBUO
> I don't see any benifit here at all, please explain it better.
> You are saying what your patch does, but not why we would want it.

It may not be better than cover letter but I try.

My use case is 
a) a service in internet with VHCI
b) distributed small Linux nodes with STUB and IoT devices.

IoT device may be inside firewall.
To pass firewall, usually WebSocket is used.
It can be added tunneling daemon in both side.
Connection must be initiated from device side.
This is the most important for my use case.

In the use case, there may be no operator checking device.
Device may be plug-and-played.

For security consideration, client verification be the tunneling
daemon.

n.iwata
//
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v7 1/3] usbip: exporting devices

2016-02-14 Thread fx IWATA NOBUO
> That's too much code to review, especially for something that I have no
> idea what it is, or why it is needed at all.
> 
> Please be more descriptive here, and hopefully, break this patch down into
> smaller steps.

OK. I will divide.

Best Regards,

n.iwata
//
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 1/3] usbip: exporting devices

2016-02-14 Thread Greg KH
On Wed, Feb 10, 2016 at 10:45:01AM +0900, Nobuo Iwata wrote:
> USB/IP supports a function to import USB devices from application-side 
> machine by attach command.
> The usage is as following.
> dev:# (Physically attach your USB device.)
> dev:# insmod usbip-core.ko and usbip-host.ko
> dev:# usbipd -D
> // Start usbip daemon.
> dev:# usbip list -l
> // List local USB devices and their busid.
> dev:# usbip bind --busid 
> // Make a device exportable to other hosts.
> 
> app:# insmod usbip-core.ko and vhci-hcd.ko
> app:# usbip list --remote 
> // List importable USB devices from the .
> app:# usbip attach --remote  --busid 
> // Import a device
> 
> By attach command, connection will be established from application-side 
> to device-side.
> 
> This patch introduces a function to export devices form device-side 
> machine to application-side machine.
> The usage is as following.
> app:# insmod usbip-core.ko and vhci-hcd.ko
> app:# usbipa -D
> // Start usbip daemon.
> 
> dev:# (Physically attach your USB device.)
> dev:# insmod usbip-core.ko and usbip-host.ko
> dev:# usbip list -l
> // List local USB devices and their busid.
> dev:# usbip connect --remote  --busid 
> // Export a device to .
> 
> For this, export function, connection is established from device-side 
> machine to application-side machine.
> 

I don't see any benifit here at all, please explain it better.

You are saying what your patch does, but not why we would want it.

and it is huge:

> Following use cases are supposed for the export function.
> 1) Server application or cloud service serves distributed ubiquitous 
> devices.
> 2) Dedicate devices to server application or cloud service.
> 
> To connect to cloud service, it needs to connect from inside of 
> firewall.
> 
> Probably, the export function was planned because the packets were 
> originally defined in header file usbip_network.h but they were not 
> used yet.
> This patch fixes the defined packet structures (ie. int in reply to 
> uinit32_t) and use them.
> Also, vendor/product name converion is added to port commnad as same as 
> list command.
> 
> Signed-off-by: Nobuo Iwata 
> ---
>  tools/usb/usbip/libsrc/names.c |   2 +
>  tools/usb/usbip/libsrc/usbip_host_driver.c |  15 ++
>  tools/usb/usbip/libsrc/usbip_host_driver.h |   1 +
>  tools/usb/usbip/libsrc/vhci_driver.c   | 127 +--
>  tools/usb/usbip/libsrc/vhci_driver.h   |   8 +-
>  tools/usb/usbip/src/Makefile.am|   9 +-
>  tools/usb/usbip/src/usbip.c|  17 +-
>  tools/usb/usbip/src/usbip.h|  11 +-
>  tools/usb/usbip/src/usbip_attach.c |  49 +---
>  tools/usb/usbip/src/usbip_bind.c   |   7 +-
>  tools/usb/usbip/src/usbip_connect.c| 214 ++
>  tools/usb/usbip/src/usbip_detach.c |  13 +-
>  tools/usb/usbip/src/usbip_disconnect.c | 202 +
>  tools/usb/usbip/src/usbip_list.c   |  22 +-
>  tools/usb/usbip/src/usbip_network.h|   5 +-
>  tools/usb/usbip/src/usbip_port.c   |  21 +-
>  tools/usb/usbip/src/usbip_unbind.c |   7 +-
>  tools/usb/usbip/src/usbipd.c   | 227 ++-
>  tools/usb/usbip/src/usbipd.h   |  36 +++
>  tools/usb/usbip/src/usbipd_app.c   | 239 
>  tools/usb/usbip/src/usbipd_dev.c   | 247 +
>  21 files changed, 1176 insertions(+), 303 deletions(-)


That's too much code to review, especially for something that I have no
idea what it is, or why it is needed at all.

Please be more descriptive here, and hopefully, break this patch down
into smaller steps.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 1/3] usbip: exporting devices

2016-02-09 Thread Nobuo Iwata
USB/IP supports a function to import USB devices from application-side 
machine by attach command.
The usage is as following.
dev:# (Physically attach your USB device.)
dev:# insmod usbip-core.ko and usbip-host.ko
dev:# usbipd -D
// Start usbip daemon.
dev:# usbip list -l
// List local USB devices and their busid.
dev:# usbip bind --busid 
// Make a device exportable to other hosts.

app:# insmod usbip-core.ko and vhci-hcd.ko
app:# usbip list --remote 
// List importable USB devices from the .
app:# usbip attach --remote  --busid 
// Import a device

By attach command, connection will be established from application-side 
to device-side.

This patch introduces a function to export devices form device-side 
machine to application-side machine.
The usage is as following.
app:# insmod usbip-core.ko and vhci-hcd.ko
app:# usbipa -D
// Start usbip daemon.

dev:# (Physically attach your USB device.)
dev:# insmod usbip-core.ko and usbip-host.ko
dev:# usbip list -l
// List local USB devices and their busid.
dev:# usbip connect --remote  --busid 
// Export a device to .

For this, export function, connection is established from device-side 
machine to application-side machine.

Following use cases are supposed for the export function.
1) Server application or cloud service serves distributed ubiquitous 
devices.
2) Dedicate devices to server application or cloud service.

To connect to cloud service, it needs to connect from inside of 
firewall.

Probably, the export function was planned because the packets were 
originally defined in header file usbip_network.h but they were not 
used yet.
This patch fixes the defined packet structures (ie. int in reply to 
uinit32_t) and use them.
Also, vendor/product name converion is added to port commnad as same as 
list command.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/libsrc/names.c |   2 +
 tools/usb/usbip/libsrc/usbip_host_driver.c |  15 ++
 tools/usb/usbip/libsrc/usbip_host_driver.h |   1 +
 tools/usb/usbip/libsrc/vhci_driver.c   | 127 +--
 tools/usb/usbip/libsrc/vhci_driver.h   |   8 +-
 tools/usb/usbip/src/Makefile.am|   9 +-
 tools/usb/usbip/src/usbip.c|  17 +-
 tools/usb/usbip/src/usbip.h|  11 +-
 tools/usb/usbip/src/usbip_attach.c |  49 +---
 tools/usb/usbip/src/usbip_bind.c   |   7 +-
 tools/usb/usbip/src/usbip_connect.c| 214 ++
 tools/usb/usbip/src/usbip_detach.c |  13 +-
 tools/usb/usbip/src/usbip_disconnect.c | 202 +
 tools/usb/usbip/src/usbip_list.c   |  22 +-
 tools/usb/usbip/src/usbip_network.h|   5 +-
 tools/usb/usbip/src/usbip_port.c   |  21 +-
 tools/usb/usbip/src/usbip_unbind.c |   7 +-
 tools/usb/usbip/src/usbipd.c   | 227 ++-
 tools/usb/usbip/src/usbipd.h   |  36 +++
 tools/usb/usbip/src/usbipd_app.c   | 239 
 tools/usb/usbip/src/usbipd_dev.c   | 247 +
 21 files changed, 1176 insertions(+), 303 deletions(-)

diff --git a/tools/usb/usbip/libsrc/names.c b/tools/usb/usbip/libsrc/names.c
index 81ff852..559f797 100644
--- a/tools/usb/usbip/libsrc/names.c
+++ b/tools/usb/usbip/libsrc/names.c
@@ -201,6 +201,8 @@ void names_free(void)
pool = pool->next;
free(tmp);
}
+
+   pool_head = NULL;
 }
 
 static int new_vendor(const char *name, u_int16_t vendorid)
diff --git a/tools/usb/usbip/libsrc/usbip_host_driver.c 
b/tools/usb/usbip/libsrc/usbip_host_driver.c
index bef08d5..b987520 100644
--- a/tools/usb/usbip/libsrc/usbip_host_driver.c
+++ b/tools/usb/usbip/libsrc/usbip_host_driver.c
@@ -278,3 +278,18 @@ struct usbip_exported_device *usbip_host_get_device(int 
num)
 
return NULL;
 }
+
+struct usbip_exported_device *usbip_host_find_device(char *busid)
+{
+   struct list_head *i;
+   struct usbip_exported_device *edev;
+
+   list_for_each(i, _driver->edev_list) {
+   edev = list_entry(i, struct usbip_exported_device, node);
+   if (!strncmp(busid, edev->udev.busid, SYSFS_BUS_ID_SIZE))
+   return edev;
+   }
+
+   return NULL;
+}
+
diff --git a/tools/usb/usbip/libsrc/usbip_host_driver.h 
b/tools/usb/usbip/libsrc/usbip_host_driver.h
index 2a31f85..69c65a6 100644
--- a/tools/usb/usbip/libsrc/usbip_host_driver.h
+++ b/tools/usb/usbip/libsrc/usbip_host_driver.h
@@ -45,5 +45,6 @@ void usbip_host_driver_close(void);
 int usbip_host_refresh_device_list(void);
 int usbip_host_export_device(struct usbip_exported_device *edev, int sockfd);
 struct usbip_exported_device *usbip_host_get_device(int num);
+struct usbip_exported_device *usbip_host_find_device(char *busid);
 
 #endif /* __USBIP_HOST_DRIVER_H */
diff --git a/tools/usb/usbip/libsrc/vhci_driver.c 
b/tools/usb/usbip/libsrc/vhci_driver.c
index ad92047..501a61d 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c