On 3/18/19 9:37 AM, VizXu wrote: > Signed-off-by: VizXu <xujiweigo@xxxxxxx> > --- > drivers/usb/usbip/stub_dev.c | 4 ++++ > drivers/usb/usbip/stub_rx.c | 37 +++++++++++++++++++++++++++++++++++++ > drivers/usb/usbip/usbip_common.h | 16 ++++++++++++++++ > 3 files changed, 57 insertions(+) > > diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h > index bf8afe9..b5189e6 100644 > --- a/drivers/usb/usbip/usbip_common.h > +++ b/drivers/usb/usbip/usbip_common.h > @@ -122,6 +122,17 @@ extern struct device_attribute dev_attr_usbip_debug; > #define USBIP_DIR_IN 0x01 > > /** This comment block is not kernel-doc notation so it should not begin with /**. > +* Support USBIP project for Windows: http://usbip.sourceforge.net/ > +* The configuration is not initialized after an USB device bound in Linux > +* and that would make Linux kernel crash if usbip.exe attach it. > +* I've analysized this process with wireshark and found that usbip.exe analyzed > +* would not "SET CONFIGURATION Request". I suppose the process of loading > +* a USB device is different between Linux and Windows. > +* Make a usb_set_configuration at the first time would fix this issue. > +*/ > +#define SUPPORT_WIN > + > +/** > * struct usbip_header_basic - data pertinent to every request > * @command: the usbip request type > * @seqnum: sequential number that identifies requests; incremented per > @@ -257,6 +268,11 @@ struct usbip_device { > spinlock_t lock; > > int sockfd; > + > +#ifdef SUPPORT_WIN > + bool is_configured; > +#endif > + > struct socket *tcp_socket; > > struct task_struct *tcp_rx; > -- ~Randy