Coder Social home page Coder Social logo

cezanne / usbip-win Goto Github PK

View Code? Open in Web Editor NEW

This project forked from george-hopkins/usbip-windows

1.9K 89.0 341.0 1.58 MB

USB/IP for Windows

License: GNU General Public License v3.0

C 99.30% Roff 0.60% Batchfile 0.10%
usbip usbip-win usb-over-ip windows-driver vhci usb-server usb-client

usbip-win's Introduction

USB/IP for Windows

  • This project aims to support both a USB/IP server and a client on Windows platform.

Build

Notes

  • Build is tested on Windows 10 x64 and the projects are configured for this target by default.
  • x86/x64 platforms should be supported. However, we don't have an x86 setup for testing at the moment.
  • For Windows 7 users, change usbip_stub and usbip_vhci projects' Target OS version to Windows 7.
    • Right-click on the Project > Properties > Driver Settings > Target OS version > Windows 7
    • The recent tag version which supports is v0.1.0. All versions after v0.1.0 do not support Windows 7 or 8 because usbip-win started to use kernel libraries of Windows 10.

Build Tools

  • Visual Studio 2019 Community (v142)
    • Build with VS 2017 (v141) is also possible if Platform Toolset in Setting is configured to v141.
  • Windows SDK 10.0.18362.0 (recommended)
    • VS 2019 (v142): requires >= 10.0.18xxx
    • VS 2017 (v141): requires >= 10.0.17xxx
  • Windows Driver Kit Windows 10, version 1903 (10.0.18362)
    • WDK 10.0.17134 (1803), 10.0.17763 (1809) and 10.0.18346 are also tested.

Build Process

  • Open usbip_win.sln
  • If VS 2017 is used, SDK version for userspace projects (usbip, usbip_common, usbipd, stubctl) should be adjusted.
  • Set certificate driver signing for usbip_stub and usbip_vhci projects
    • Right-click on the Project > Properties > Driver Signing > Test Certificate
    • Browse to driver/usbip_test.pfx (password: usbip)
  • Build solution or desired project
  • All output files are created under {Debug,Release}/{x64,x86} folder.

Install

Windows USB/IP server

  • Prepare a Linux machine as a USB/IP client or Windows usbip-win VHCI client (tested on Ubuntu 16.04 with kernel 4.15.0-29 - USB/IP kernel module crash was observed on some other versions)
    • # modprobe vhci-hcd
  • Install USB/IP test certificate
    • Install driver/usbip_test.pfx (password: usbip)
    • Certificate should be installed into
      1. "Trusted Root Certification Authority" in "Local Computer" (not current user) and
      2. "Trusted Publishers" in "Local Computer" (not current user)
  • Enable test signing
    • > bcdedit.exe /set TESTSIGNING ON
    • reboot the system to apply
  • Copy usbip.exe, usbipd.exe, usb.ids, usbip_stub.sys, usbip_stub.inx into a folder in target machine
    • You can find usbip.exe, usbipd.exe, usbip_stub.sys in the output folder after build or on release page.
    • userspace/usb.ids
    • driver/stub/usbip_stub.inx
  • Find USB Device ID
    • You can get id from usbip listing
      • > usbip.exe list -l
    • Bus id is always 1. So output from usbip.exe listing is shown as:
usbip.exe list -l
 - busid 1-59 (045e:00cb)
   Microsoft Corp. : Basic Optical Mouse v2.0 (045e:00cb)
 - busid 1-30 (80ee:0021)
   VirtualBox : USB Tablet (80ee:0021)
  • Bind USB device to usbip stub
    • The next command replaces the existing function driver with usbip stub driver
      • This should be executed using administrator privilege
      • usbip_stub.inx and usbip_stub.sys files should be in the same folder as usbip.exe
    • > usbip.exe bind -b 1-59
  • Run usbipd.exe
    • > usbipd.exe -d -4
    • TCP port 3240 should be allowed by firewall
  • Attach USB/IP device on Linux machine
    • # usbip attach -r <usbip server ip> -b 1-59

Windows USB/IP client

  • Currently, there are 2 versions for a VHCI driver with different installation procedures:
    • vhci(wdm): original version, implemented via WDM (Windows Driver Model);
    • vhci(ude): newly developed version to fully support USB applications and implemented via UDE (USB Device Emulation) which is MS provided USB virtualization framework over KMDF (Kernel-Model Driver Framework).
  • Prepare a Linux machine as a USB/IP server or Windows usbip-win stub server - (tested on Ubuntu 16.04 (kernel 4.15.0-29), 18.04, 20.04)
    • # modprobe usbip-host
    • You can use virtual usbip-vstub as a stub server
  • Run usbipd on a USB/IP server (Linux)
    • # usbipd -4 -d
  • Install USB/IP test certificate
    • Install driver/usbip_test.pfx (password: usbip)
    • Certificate should be installed into
      1. "Trusted Root Certification Authority" in "Local Computer" (not current user) and
      2. "Trusted Publishers" in "Local Computer" (not current user)
  • Enable test signing
    • > bcdedit.exe /set TESTSIGNING ON
    • reboot the system to apply
  • Copy VHCI driver files into a folder in target machine
    • If you're testing vhci(ude), copy usbip.exe, usbip_vhci_ude.sys, usbip_vhci_ude.inf, usbip_vhci_ude.cat into a folder in target machine;
    • If you're testing vhci(wdm), copy usbip.exe, usbip_vhci.sys, usbip_vhci.inf, usbip_root.inf, usbip_vhci.cat into a folder in target machine;
    • You can find all files in output folder after build or on release page.
  • Install USB/IP VHCI driver
    • You can install using usbip.exe or manually
    • Using usbip.exe install command
      • Run PowerShell or CMD as an Administrator
      • PS> usbip.exe install
      • The previous command will install a UDE driver or a WDM driver depending on the available files
        • (UDE version first)
      • PS> usbip.exe install -u if UDE driver only
      • PS> usbip.exe install -w if WDM driver only
    • Manual Installation for vhci(ude)
      • Run PowerShell or CMD as an Administrator
      • PS> pnputil /add-driver usbip_vhci_ude.inf
      • Start Device manager
      • Choose "Add Legacy Hardware" from the "Action" menu.
      • Select "Install the hardware that I manually select from the list".
      • Click "Next".
      • Click "Have Disk", click "Browse", choose the copied folder, and click "OK".
      • Click on the "usbip-win VHCI(ude)", and then click "Next".
      • Click Finish at "Completing the Add/Remove Hardware Wizard".
    • Manual Installation for vhci(wdm)
      • Run PowerShell or CMD as an Administrator
      • PS> pnputil /add-driver usbip_vhci.inf
      • Start Device manager
      • Choose "Add Legacy Hardware" from the "Action" menu.
      • Select "Install the hardware that I manually select from the list".
      • Click "Next".
      • Click "Have Disk", click "Browse", choose the copied folder, and click "OK".
      • Click on the "USB/IP VHCI Root", and then click "Next".
      • Click Finish at "Completing the Add/Remove Hardware Wizard".
  • Attach a remote USB device
    • PS> usbip.exe attach -r <usbip server ip> -b 2-2
  • Uninstall driver
    • PS> usbip.exe uninstall
  • Disable test signing
    • > bcdedit.exe /set TESTSIGNING OFF
    • reboot the system to apply

Reporting Bugs

  • usbip-win is not yet ready for production use. We could find the problems with detailed logs.

How to get Windows kernel log for vhci(wdm)

  • Set registry key to enable a debug filter
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter]
"IHVDRIVER"=dword:ffffffff
  • Run a debugging log viewer program before you test.
  • If your testing machine suffer from BSOD (Blue Screen of Death), you should get it via remote debugging.
    • WinDbg on virtual machines would be good to get logs.

How to get Windows kernel log for vhci(ude)

  • A new vhci(ude) implementation uses WPP SW tracing instead of DbgPrintEx.
    • DebugView.exe cannot catch a VHCI debug message
      • TraceView.exe is a good utility for a new approach, which is included in WDK.
  • usbip_vhci_ude.pdb file is required to add a trace provider easily.
  • Create a new session log in TraceView.exe
    • Choose PDB file radio button in "Provider Control GUID Setup" popup dialog
    • Specify usbip_vhci_ude.pdb as a PDB file
  • You can send real-time trace messages to WinDbg by modifying in "Advanced Log Session Options".
  • If your testing machine suffer from BSOD (Blue Screen of Death), you should get it via remote debugging.
    • WinDbg on virtual machines would be good to get logs

How to get usbip forwarder log

  • usbip-win transmits usbip packets via a userland forwarder.
    • forwarder log is the best to look into usbip packet internals.
  • edit usbip_forward.c to define DEBUG_PDU at the head of the file
  • compile usbip.exe or usbipd.exe
  • debug_pdu.log is created at the path where an executable runs.

How to get linux kernel log

  • Sometimes Linux kernel log is required
# dmesg --follow | tee kernel_log.txt

This project was supported by Basic Science Research Program through the National Research Foundation of Korea(NRF) funded by the Ministry of Education(2020R1I1A1A01066121).

usbip-win's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

usbip-win's Issues

Virtual Com port fail. This device cannot start. (Code 10)

Hi Guys. I am trying to emulate the STMicroelectronics Virtual Com Port via the usbip vhci.
As result I have net issue:
image

The USBIP/VHCI driver was installed properly:
image

Here is a log from the usbip.exe:

D:\Projects\USBIP\usbip-win\Debug\output_copy3>usbip.exe --debug attach -r localhost -b 1-1
usbip: debug: d:\projects\usbip\usbip-win\userspace\src\usbip\usbip.c:133:[run_command] running command: `attach'

usbip: debug: d:\projects\usbip\usbip-win\userspace\src\usbip\usbip_vhci.c:58:[usbip_vhci_driver_open] device path: \\?\root#unknown#0000#{d35f7840-6a0c-11d2-b841-00c04fad5171}
usbip: debug: d:\projects\usbip\usbip-win\userspace\src\usbip\usbip_attach.c:57:[import_device] got free port 1

As a device that emulate device I use project https://github.com/lcgamboa/USBIP-Virtual-USB-Device. I run cdc-acm and get this:

cdc started....
Connection address:127.0.0.1
Header Packet
command: 0x8003
attach device
------------------------------------------------
handles requests
usbip cmd 1
usbip seqnum 2147483647
usbip devid 65538
usbip direction 1
usbip ep 0
usbip flags 0
usbip number of packets 0
usbip interval 0
usbip setup 9225060895304978944
usbip buffer lenght  18
#control requests
8006000200001200
  UC Request Type 128
  UC Request 6
  UC Value  2[0]
  UCIndex  0-0
  UC Length 18
handle_get_descriptor 2 [0]
Configuration
------------------------------------------------
handles requests
usbip cmd 1
usbip seqnum 1
usbip devid 65538
usbip direction 1
usbip ep 0
usbip flags 0
usbip number of packets 0
usbip interval 0
usbip setup 9225060891010011648
usbip buffer lenght  18
#control requests
8006000100001200
  UC Request Type 128
  UC Request 6
  UC Value  1[0]
  UCIndex  0-0
  UC Length 18
handle_get_descriptor 1 [0]
Device
------------------------------------------------
handles requests
usbip cmd 1
usbip seqnum 2
usbip devid 65538
usbip direction 1
usbip ep 0
usbip flags 0
usbip number of packets 0
usbip interval 0
usbip setup 9225060895304976640
usbip buffer lenght  9
#control requests
8006000200000900
  UC Request Type 128
  UC Request 6
  UC Value  2[0]
  UCIndex  0-0
  UC Length 9
handle_get_descriptor 2 [0]
Configuration
------------------------------------------------
handles requests
usbip cmd 1
usbip seqnum 3
usbip devid 65538
usbip direction 1
usbip ep 0
usbip flags 0
usbip number of packets 0
usbip interval 0
usbip setup 9225060895304991488
usbip buffer lenght  67
#control requests
8006000200004300
  UC Request Type 128
  UC Request 6
  UC Value  2[0]
  UCIndex  0-0
  UC Length 67
handle_get_descriptor 2 [0]
Configuration
------------------------------------------------
handles requests
usbip cmd 1
usbip seqnum 4
usbip devid 65538
usbip direction 1
usbip ep 0
usbip flags 0
usbip number of packets 0
usbip interval 0
usbip setup 9225060895304976641
usbip buffer lenght  265
#control requests
8006000200000901
  UC Request Type 128
  UC Request 6
  UC Value  2[0]
  UCIndex  0-0
  UC Length 265
handle_get_descriptor 2 [0]
Configuration
------------------------------------------------
handles requests
usbip cmd 1
usbip seqnum 5
usbip devid 65538
usbip direction 0
usbip ep 0
usbip flags 1
usbip number of packets 0
usbip interval 0
usbip setup 2534374302023680
usbip buffer lenght  0
#control requests
0009010000000000
  UC Request Type 0
  UC Request 9
  UC Value  0[1]
  UCIndex  0-0
  UC Length 0
handle_set_configuration 0[1]
------------------------------------------------
handles requests
usbip cmd 1
usbip seqnum 6
usbip devid 65538
usbip direction 0
usbip ep 0
usbip flags 1
usbip number of packets 0
usbip interval 0
usbip setup 75153818798522368
usbip buffer lenght  0
#control requests
010B000001000000
  UC Request Type 1
  UC Request 11
  UC Value  0[0]
  UCIndex  0-1
  UC Length 0
SET_INTERFACE
------------------------------------------------
handles requests

Please help.

Devices with multiple configurations can't be configured correctly

Hello!
I'm working on a device which has multiple configurations. I've noticed that when attaching the device in Linux I see:

[   78.134224] usb 1-1: new high-speed USB device number 2 using vhci_hcd
[   78.284314] usb 1-1: SetAddress Request (2) to port 0
[   78.321383] usb 1-1: can't set config #1, error -1

Looking in the Windows kernel logs I see:
usbip_stub:(EE) select_usb_conf: non-existent configuration descriptor: index: 1

When running uspipd --debug in Windows I see:

usbip: info: exportable devices: 1
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:90:[dump_usb_device] path                 = \\?\usb#vid_f17b&pid_1111#ed648296380e#{fb265267-c609-41e6-8eca-a20d92a833e6}
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:91:[dump_usb_device] busid                = 1-12
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:97:[dump_usb_device] Device(C/SC/P)       = (Defined at Interface level) (00/00/00)
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:99:[dump_usb_device] bcdDevice            = 0
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:104:[dump_usb_device] Vendor/Product       = unknown vendor : unknown product (f17b:1111)
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:106:[dump_usb_device] bNumConfigurations   = 0
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:107:[dump_usb_device] bNumInterfaces       = 0
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:109:[dump_usb_device] speed                = High Speed(480Mbps)
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:111:[dump_usb_device] busnum               = 1
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:112:[dump_usb_device] devnum               = c
usbip: info: request 0x8005: complete
usbip: info: connection from 172.17.221.248:59058
usbip: info: received request: 0x8003
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\src\usbipd\usbipd_import.c:18:[forwarder_stub] stub forwarding started
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\src\usbipd\usbipd_import.c:108:[recv_request_import] import request busid 1-12: complete

The error seems to make sense considering what is reported in uspipd. It seems that one of the descriptors is not being read properly or the data from the descriptors isn't being propagated correctly. Do you have any hints on why bNumConfigurations and bNumInterfaces appear as 0?

Thanks,
Richard

Build with Release configuration

Hello all,

I use USBIP client on windows. It works quite fine (except some errors with queue overflow etc.).

I Try to compile USBIP by Release configuration. It fails. Mainly because mishmash between debug and release header/libraries.

My question is - is this behaviour intentionall ot it's a bug. If it's a Bug, may I create PR with repairs? Or it's the subject of further/actual development.

@cezuni In case of PR - from which branch I can create a PR?

mass storage device is not working

USB mouse and keyboard are working well,
but it seems not working with my kingston USB Flash
the error code is 10

"This device cannot start. Try upgrading the device drivers for this device. (Code 10)"

Driver Signing on Windows 10

In the case of device drivers, signing is even required by certain versions of Windows in certain situations. Currently, the USBIP requires windows 10 to run in test mode to be able to install the driver. Does anyone from here know how this driver can be signed/approved by Microsoft? Does Microsoft provide an open source license?

From my understanding, Microsoft announced on 2015-04-01 that all new Windows 10 kernel mode drivers must be submitted to and digitally signed by the Windows Hardware Developer Center Dashboard portal, which is a web service provided by Microsoft. According to the link under there should be two different routes for getting the driver signed "Hardware compatibility" and "Attestation".

The Hardware Compatibility route is the old route where your driver is subjected to a series of tests designed by Microsoft to ensure its quality. Then Microsoft will supposedly sign your driver properly for all the versions of Windows you are interested in, and you can have a single driver that works on all those versions.

The attestation route is the new route where your driver does not have to pass any tests, but the resulting driver only works on Windows 10.

The portal will only accept driver submissions from you if you sign them with an Extended Validation (EV) certificate, which is typically more expensive than a normal certificate.

https://www.osr.com/blog/2015/07/24/questions-answers-windows-10-driver-signing/
@cezuni this more a case of thinking about the future and getting some inputs from people.

Xbox one controller (wired or wireless) doesn't work

I've been able to successfully get other devices like webcams and flash drives happening over usbip, but can't manage to get an Xbox One controller working at all.

I'm using an Orange Pi Zero with Armbian as my host, and it can successfully bind either the controller, or the USB wireless adapter.

Then the problems start with the Windows 10 side of things. With the wireless adapter I will either get a blue screen with kernel security check failure, or I will get an error of "failed to read: err:6". I think one time it didn't give me either of those, but nothing showed up in device manager, so I don't think it actually worked.

With the controller connected via a usb cable to the host, it seems to bind and attach fine, but then device manager gives me this:
image

Are there any known issues with trying to get Xbox One controllers happening? Anything else I can try to get it working?

usbip: error: calc_hash: path not found

Hi.
I've compiled usbip-win on Windows 10 version 18.09, but when I try to bind a device I get the following error:

usbip: error: calc_hash: path not found C:\Users\CHIFIL~1\AppData\Local\Temp\stu7A36.tmp\usbip_stub.inf
usbip: error: failed to update driver: 2
usbip: error: failed to bind device

Reviving usbip-win stub (usbip server)

Currently, stub driver does not work as @koudis pointed out. This is due to that stub driver depends on obsolete usbip forwarding style, which assumes sufficiently large read/write buffer. Of course, vhci handles well. Maybe stub driver has not been used by community.

windows 10 as USBIP client

I am configuring my windows 10 as client using this repository. And Raspberry Pi 3 ( Linux raspberrypi 4.4.50-v7+ ) as server using steps given in link.
USBIP version of server is 2.0
I am able to list the usb drive shared by server on windows. But unable to connect to it.
In device manager it is showing an unknown device named 'USB Device over IP'.
image2018-12-18 11 25 36

Is this ab bug of this repository as you mentioned in last line of README that it did not work?

cannot buil usbip dev

I enclosed screen shot.

I got an error when binded usb id 196
usbip: error: build_udev: invalid devno: 196
usbip: error: walker_edev: cannot build usbip dev

Can you help me please?

1
2
3

usbip_vhci not loading on Windows 7

I installed the usbip-win 0.0.4 pre-release on Windows 7 (7601), and even after manually generating a signed cat file, windows refuses to load the driver with Code 39.

Event viewer says

Application popup:  : \SystemRoot\system32\DRIVERS\usbip_vhci.sys cannot find ntoskrnl.exe KeInitializeSpinLock

which looks like Win7 compatibility was broken.

I tried compiling the driver with the old build system and the Win7 DDK but there were quite a few issues and I could not get it to compile successfully.

I do not have access to a proper Windows 10 dev installation at the moment to have a look, so it would be appreciated if this could be fixed.

Windows 10 Xbox 360 (Wired) controller not working

I'm trying to get the client working for this server for Android to share game controllers through it:
https://play.google.com/store/apps/details?id=org.cgutman.usbipserverforandroid&hl=en_US

I have attempted both v0.0.1 and v0.0.4 drivers from this repository and I am getting the below message in both versions in Device Manager:

Capture2

This device cannot start. (Code 10)
Insufficient system resources exist to complete the API.

Capture3

I tried googling that error and I found this possible solution here: https://superuser.com/questions/1316839/usb-driver-this-device-cannot-start-code-10-insufficient-system-resources

Deleting LowerFilter and UpperFilter values of that USB classes in the registry. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class***********

You can find the class guid from device manager, USB controller properties -> Details -> Class GUID.

I have not tried the other versions posted but I did have it working once by using the usbip_windows_v0.2.0.0_signed.zip file from https://sourceforge.net/projects/usbip/files/usbip_windows/ after which Windows helpfully downloaded an update and broke it after that. I'm on 10.0.17134 (v1803) as I type this. Looking at my Windows Update history (guessing here) according to those dates KB4023057 was the one that may have broke it since I'm 99.9% sure it was working before that.

Ubuntu Server and Windows Client

Hi @cezuni,

I am looking for a working usb-ip solution.
I need Linux to be server (Kernel V 4.1x) and windows 10 as client.

Is your project suitable for that config?
Did you test any config like that?
Thanks
Best regards

USBIP: Implement "port" command

On Ubuntu 18.04:

$ usbip help
usage: usbip [--debug] [--log] [--tcp-port PORT] [version]
             [help] <command> <args>

  attach     Attach a remote USB device
  detach     Detach a remote USB device
  list       List exportable or local USB devices
  bind       Bind device to usbip-host.ko
  unbind     Unbind device from usbip-host.ko
  port       Show imported USB devices

$ sudo usbip port
Imported USB devices
====================
Port 00: <Port in Use> at Low Speed(1.5Mbps)
       Dell Computer Corp. : Mouse (413c:3200)
       3-1 -> usbip://192.168.1.1:3240/1-1.2
           -> remote bus/dev 001/004

Is there a similar command like port?

usbip_vhci driver install failed unusually on windows7

hello,cezuni
There is report an error after i download the source codes and compiled usbip-win, installed the USBIP test certificate and USBIP vhci driver subsequently. but the USB/IP VHCI display a abnormity icon at the device manager. i used the the windows OS version is win7,is it results in this issue of USBIP vhci driver?
Looking forward to your reply,thanks!

My Build Tools is as below:
Visual Studio 2017 Community
Windows SDK 10.0.17134
Windows Driver Kit 10.0.17134
Build is tested on Win7

1
2
3

CMake Configuration for USBIP-Win

As discussed in #23 It can be helpfull to move/add usbip-win to CMake.

I opened this Issue to gather more opinions and for discussion.

CMake dvantages for me

  • much more use-case possibilities than Solution
  • more stable --> 10 years old CMake files work without problem
  • More readable (many tutorials, simple documentation, ...)

Problems
CMake works fine for standard user-space applications.
Driver development is quite complicated. There are several quite good CMake modules for Windows kernel drivers but It's not widely tested.

usbip server on Win

Your readme explains installation of server on linux, but I thought, that your port is for windows.
Can I use usbip server on windows?

Error Installing Driver usbip_vhci.inf

Hi friends,

I am trying to install the drivers and the device manager return the error:

Untitled

The OS is Windows 10 Pro x64.

What can I do to resolv this?

I thank you very much.

Libusb Compatibility (Windows 7)

I have a USB Composite Device connected on a Linux box and using USBIP to connect it to a Win7 machine. Everything seems to working as intended, except the libusb's libusb_get_device_list() is unable to detect the presence of the USB device.

The research that I've done suggests that might be because the VHCI driver doesn't register a USB Root Hub, and libusb doesn't know to look for usb devices that aren't connected to a root hub.

Is it possible to make a change to the VHCI driver such that it creates a USB Root Hub and attaches the remote devices to that created hub?

error attaching on win10 client

Hi,

I trying to share a usb device from Ubuntu 16.04 (usbip server) to a windows 10 (1809 17763.678) (usbip client).

Build OK.
Bind on Ubuntu 16.04 server side OK
Certificate installed OK
test signing enabled OK
All files copied OK
VHCI driver install OK
USB/IP VHCI driver visible into device manager and OK
usbip list OK (found wished usb device)

but :
usbip attach -r 192.168.1.2 -b 4.12
usbip: error: recv op_common
usbip: error: read_devbuf: failed to read: err: 0x6

Is this a known issue ?
Have I missed something ?

USBIP Windows - install VHCI driver programatically

I want to install VHCI driver programatically. I try many ways but none works.

One usable:
https://stackoverflow.com/questions/11659223/install-the-libusb-driver-using-the-inf-file-with-c-sharp

I recognized that the problem is not with driver but with "How to install devices programatically". I can install driver itself but can not install usbip device.

How can I install USBIP VHCI driver programatically on windows machine? Is there any clean way?

Thanks a lot for any advise.

UsbIp.exe 0.0.6 (client side) not working on windows 2012 r2 ?

hi,
i just try to use usb-ip (0.0.6) for windows (server and client) it's working great with win 2019 (server side) and win 10 (1903)

(usbip: info: received request: 0x8003
usbip: debug: C:\work\usbip-win\userspace\src\usbipd\usbipd_import.c:18:[forwarder_stub] stub forwarding started
usbip: debug: C:\work\usbip-win\userspace\src\usbipd\usbipd_import.c:108:[recv_request_import] import request busid 1-140: complete
usbip: info: request 0x8003: complete)

but i f i make the same configuration for the client on a windows 2012r2 it's not working ...
the drivers are not correctly installed
(device status : Windows cannot initialize the device driver for this hardware. (Code 37)
{Wrong Type}
There is a mismatch between the type of object required by the requested operation and the type of object that is specified in the request.)
then of course the usbip command does not working....

i see this post drivers (version 0.0.3) => usbip_vhci not loading on Windows 7 #12 it's solve my drivers problem but i don't have the lastest drivers...

composite devices

I am using the version from the repository https://github.com/cezuni/usbip-win
The server part is deployed on Debian Stretch using usbip from the distribution.
The client part is deployed on the VmWare virtual machine in the Windows 10 Pro (x64) operating environment, in which debug mode is enabled.
The virtual machine is deployed on a host with a Windows 10 Pro (x64) operating environment;
After building the client part, the usbip module and the driver were copied to the guest station.
Further, all actions were carried out according to the Readme.

As a result of buid and testing the assembly, it turned out the following:
Next usb devices was tested to Linux station (Debian stretch) , where the server part was deployed
1.Webcam Logitech c170
2.Microskope Digital.B006
3. Epson L132 Printer
4.USB scanner Epson V19
5.Flash drives

When connecting devices from the list above
when run in command line
usbip attach -r 192.168.xxx.xxx -b 1-5
in the device manager, these devices were displayed without errors.
but cameras connected to the server did not play in the client.
To play the video on the client side, the WindowsCamera.exe module was used.
The WindowsCamera.exe module threw out the error that there are no connected cameras and the device manager remov the cameras from the list of installed devices.
The same thing happen , when trying to print on a printer.
At the same time, the scanner and flash drives worked without errors.
Please tell me what can fix the driver.
P.S
Cameras and printer were not registered in the usb.ids file. I registered them.

log file (log with DebugView) Bind and play webcam C170 Logitech(composite device)
https://drive.google.com/open?id=1noCk8eQZED0q84y7WvWoIsihO5dpWF3D
if necessary, I can submit the log obtained by the UsbLyzer utility

Disconnecting USBIP

You stop the Linux USBIP host should it stop the windows client? By using the wire shark I noticed that in fact a Finish flag is been sent from the host to the windows client. The client does not do anything with flag. should it disconnect as well in windows?
Did anyone look at this ?

Let Windows_client_ip be xxx.xxx.xxx.xxx
USBIP_Linux$ sudo tcpdump -i wlo1 host xxx.xxx.xxx.xxx
//Sending data from Linux host to windows client Flags[P.] P. stands for Push
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlo1, link-type EN10MB (Ethernet), capture size 262144 bytes
15:04:08.797585 IP ZBook-15.3240 > xxx.xxx.xxx.xxx.50285: Flags [P.], seq 3259045765:3259045820, ack 2855156516, win 229, length 55
15:04:08.803557 IP xxx.xxx.xxx.xxx.50285 > ZBook-15.3240: Flags [P.], seq 1:49, ack 55, win 252, length 48
15:04:08.805504 IP ZBook-15.3240 > xxx.xxx.xxx.xxx.50285: Flags [P.], seq 55:110, ack 49, win 229, length 55
15:04:08.810277 IP xxx.xxx.xxx.xxx.50285 > ZBook-15.3240: Flags [P.], seq 49:97, ack 110, win 252, length 48
15:04:08.853446 IP ZBook-15.3240 > xxx.xxx.xxx.xxx.50285: Flags [.], ack 97, win 229, length 0

//Here a finish flag is been sent to windows client and the windows client answer with an acknowledgement
15:04:24.699197 IP ZBook-15.3240 > xxx.xxx.xxx.xxx.50285: Flags [F.], seq 110, ack 97, win 229, length 0
15:04:24.705279 IP xxx.xxx.xxx.xxx.50285 > ZBook-15.3240: Flags [.], ack 111, win 252, length 0

Hang on attach

Hi. First, thank you for this great work. I've been working on this all weekend and today to get this working; really appreciate you help.

Running the 2.0 USBIP tools from Debian 9 (not the buggy version). All works great re the setup on the Debian host and I can share the devices.

From Windows I can see the devices with the correct USB.IDS. Looks fine.

Latest 0.4 version and have installed the driver correctly after cert install and dropping the Windows 10 x64 host into 'Test' Mode. Driver installs with no errors.

On attach I get pop-ups saying that USBIP is being setup and then it mentions that it's all ready. I don't get a command prompt back and I have no messages relating the setup of the actual device nor any new device appearing in the Device Manager.

Checking on the USBIP on the Debian host, I see working responses from the server with 'received request' 0x8005 (5) on the listing remotely and the connection request which responds with a 0x8003(5) complete.

Any ideas? I'm going mad! ;-)

I do now see to get the 'USB Device Over IP' 'device' in the correct category of Device Manager for the device I am attempting to connect, but I get a 'This device cannot start (Code 10).

Mo

interface claim failed: LIBUSB_ERROR_NOT_FOUND

Hi, I'm testing a fingerprint reader (U.are.U® 4500 Fingerprint Reader). I have as client a linux machine with kernel 4.15, but when I try to open the device I get:

journal: interface claim failed: LIBUSB_ERROR_NOT_FOUND

Am I forgetting some configuration?

Bluescreen when sending a constant stream of URBs

I have an application that sends a lot of URB Interrupts in a very short period of time, and after a while, usbip starts unlinking them.

With the new unlinking code introduced by 10d26c6 in vhci, a bugcheck is triggered after a few URBs get unlinked.

WinDbg shows that the issue occurs here https://github.com/cezuni/usbip-win/blob/94b35a0916962874f062076176ec597a612aaa77/driver/vhci/usbreq.c#L114-L115

The following patch prevents the crash, however I haven't made a PR because I am not sure if it is the right approach to follow.
Additionally, while the patch solves the bluescreen, the usbip client then throws a few failed to record. out queue full errors, and the connection seems to freeze. I can still detach and reattach the device though.

diff --git a/driver/vhci/usbreq.c b/driver/vhci/usbreq.c
index db5bb0c..261ee39 100644
--- a/driver/vhci/usbreq.c
+++ b/driver/vhci/usbreq.c
@@ -111,8 +111,10 @@ remove_cancelled_urbr(pusbip_vpdo_dev_t vpdo, PIRP irp)
 
 	urbr = find_urbr_with_irp(vpdo, irp);
 	if (urbr != NULL) {
-		RemoveEntryList(&urbr->list_state);
-		RemoveEntryList(&urbr->list_all);
+		if ((&urbr->list_state)->Blink != NULL && (&urbr->list_state)->Flink != NULL)
+			RemoveEntryList(&urbr->list_state);
+		if((&urbr->list_all)->Blink != NULL && (&urbr->list_all)->Flink != NULL)
+			RemoveEntryList(&urbr->list_all);
 		if (vpdo->urbr_sent_partial == urbr) {
 			vpdo->urbr_sent_partial = NULL;
 			vpdo->len_sent_partial = 0;

I am not sure how to further debug this issue. Any help would be appreciated. If the patch above is acceptable, then I can open a PR to get it merged.

FTDI USB compatibility

Hello!
I've been trying to get an FTDI FT4232H (which is a 4 port version of the very common FT232) working with WSL 2 with windows being the server of the FT4232H and Ubuntu 18.04 LTS (kernel 4.19.43-microsoft-standard) as the client (although I don't think that WSL 2 is a source of this bug at this point (I'll elaborate on this a bit more further down)).

A little backstory: WSL 2 does not have USB support so I've been trying to add it back in. Adding in USB support in WSL 2 would solve probably the most major issue with WSL 2. The usbip-win project has the ability to solve this. I've been successful at compiling the usbip kernel modules in 4.19.43-microsoft-standard and modprobing them all in. I've been successful using this repo to host a CDC-ACM device on Windows and was able to use the compiled kernel modules to allow this CDC-ACM device to exist on Linux and I'm able to communicate with the CDC-ACM device with no issues.

When attempting to host the FT4232H in Windows and trying to attach to the device in Linux I get these messages in dmesg:

[  544.218303] usb 1-1: new high-speed USB device number 2 using vhci_hcd
[  544.368397] usb 1-1: SetAddress Request (2) to port 0
[  544.410263] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
[  544.410294] usb 1-1: Detected FT4232H
[  549.488900] vhci_hcd: unlink->seqnum 11
[  549.488902] vhci_hcd: urb->status -1
[  549.488983] ftdi_sio ttyUSB0: Unable to read latency timer: -110

I get this message repeated 4 times, 1 for each FTDI port. I'm unable to interact with any of these devices. All interactions time out and no data is sent to the FTDI device. I suspect although I have no proof that no data is being sent or received on endpoint 0.

When starting usbip --debug in Windows this is displayed:

usbip: info: exportable devices: 1
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:90:[dump_usb_device] path                 = \\?\usb#vid_0403&pid_6011#7&98cdda5&0&3#{fb265267-c609-41e6-8eca-a20d92a833e6}
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:91:[dump_usb_device] busid                = 1-176
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:97:[dump_usb_device] Device(C/SC/P)       = (Defined at Interface level) (00/00/00)
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:99:[dump_usb_device] bcdDevice            = 0
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:104:[dump_usb_device] Vendor/Product       = unknown vendor : unknown product (0403:6011)
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:106:[dump_usb_device] bNumConfigurations   = 0
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:107:[dump_usb_device] bNumInterfaces       = 0
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:109:[dump_usb_device] speed                = High Speed(480Mbps)
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:111:[dump_usb_device] busnum               = 1
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\lib\usbip_common.c:112:[dump_usb_device] devnum               = b0
usbip: info: request 0x8005: complete
usbip: info: connection from 172.18.186.174:42598
usbip: info: received request: 0x8003
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\src\usbipd\usbipd_import.c:18:[forwarder_stub] stub forwarding started
usbip: debug: C:\Users\rpasek\Documents\usbip-win\userspace\src\usbipd\usbipd_import.c:108:[recv_request_import] import request busid 1-176: complete
usbip: info: request 0x8003: complete

I find it a little concerning that no interfaces or configurations are found. Maybe this could be related? Update: I found this is true for other devices that function fine, so probably unrelated.

To prove that this issue is most certainly with the Windows instance of USBIP driver and not with WSL 2, I hosted the same FTDI device with usbip on native Linux machine and I'm able to connect to the FTDI device with no issues in the hosted WSL 2 Ubuntu environment.

More on WSL 2: (https://devblogs.microsoft.com/commandline/wsl-2-is-now-available-in-windows-insiders/)

Please let me know if this is something you'd have interest in fixing or if you'd like to have help fixing!

Update: I attempted to us a FT232 (the single port FTDI device) and I seem to have the same results.

Thanks,
Richard

run project windows Error

I run this project:
server: Windows7
usbip.exe bind -b 1-136 //success
usbipd.exe -b -4 //success

client: Windows10
usbip.exe attach -r 192.168.14.129 -b 1-136 //success
image

But the USB device I saw in the human interface device was abnormal.
image

What's the problem?

usbipd project build failed

I used VS2017 to compile USBip-win.sln, but the usbipd project failed to compile:

usbip_common.lib(usbip_common.obj) : error LNK2001: Unparsable external symbols __acrt_iob_func
1>usbip_common.lib(usbip_setupdi.obj) : error LNK2001: Unparsable external symbols _acrt_iob_func
1>usbip_common.lib(usbip_forward.obj) : error LNK2001: Unparsable external symbols __acrt_iob_func
1>usbip_common.lib(names.obj) : error LNK2001: Unparsable external symbols __acrt_iob_func
1>usbipd_sock.obj : error LNK2001: Unparsable external symbols __acrt_iob_func
1>usbipd_stub.obj : error LNK2001: Unparsable external symbols __acrt_iob_func
1>usbip_common.lib(usbip_network.obj) : error LNK2001: Unparsable external symbols __acrt_iob_func
1>usbip_common.lib(usbip_windows.obj) : error LNK2001: Unparsable external symbols __acrt_iob_func

usbipd_sock.obj : error LNK2001: Unparsable external symbols __stdio_common_vfprintf
1>usbipd_stub.obj : error LNK2001: Unparsable external symbols __stdio_common_vfprintf
1>usbip_common.lib(usbip_network.obj) : error LNK2001: Unparsable external symbols __stdio_common_vfprintf
1>usbip_common.lib(usbip_windows.obj) : error LNK2001: Unparsable external symbols __stdio_common_vfprintf

TCP/IP keepAlive time and interval

From the USBIP application, I see that keep alive is implemented. When testing with wireshark I found out that KeepAlive packets send after 2 hours than an interval of 1 second. From my understanding, this is a default configuration in windows 10. One can modify the keepAlive default values by modifying/adding two new parameters to Tcpip.

Open "Registry editor" navigate to the following directory
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Add DWORD(32bits) value with name KeepAliveInterval set desired in value data (milliseconds)
Add DWORD(32bits) value with name KeepAliveTime set desired in value data (milliseconds)

My question is it possible to set keepalive time and interval from the application ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.