Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usbip win does not attach to devices listed #79

Closed
mspieth opened this issue Nov 9, 2021 · 9 comments · Fixed by #88
Closed

usbip win does not attach to devices listed #79

mspieth opened this issue Nov 9, 2021 · 9 comments · Fixed by #88
Labels
USBIP Protocol incompatibility with other software

Comments

@mspieth
Copy link

mspieth commented Nov 9, 2021

usbip win from cezanne 0.3.5 (latest) does not attach to a shared device.

This is due to the buffer not being padded with 0.
The solution is to find the first 0 and get the substring to that point.

git diff of my solution follows

diff --git a/UsbIpServer/ConnectedClient.cs b/UsbIpServer/ConnectedClient.cs
index 6a9fbd4..0878ed5 100644
--- a/UsbIpServer/ConnectedClient.cs
+++ b/UsbIpServer/ConnectedClient.cs
@@ -102,7 +102,13 @@ namespace UsbIpServer
             {
                 var buf = new byte[SYSFS_BUS_ID_SIZE];
                 await Stream.ReadExactlyAsync(buf, cancellationToken);
-                if (!BusId.TryParse(Encoding.UTF8.GetString(buf).TrimEnd('\0'), out busId))
+                var s = Encoding.UTF8.GetString(buf);
+                var end = s.IndexOf("\0");
+                if (end >= 0)
+                {
+                    s = s.Substring(0, end);
+                }
+                if (!BusId.TryParse(s, out busId))
                 {
                     await SendOpCodeAsync(OpCode.OP_REP_IMPORT, Status.ST_NODEV);
                     return;

Tested working.

@dorssel dorssel added the WSL Applies to WSL only label Nov 9, 2021
@benmcmorran
Copy link
Collaborator

@dorssel If I understand this issue correctly, it's not WSL related. It's saying that connecting this usbipd-win server to the usbip-win client from cezanne does not work correctly, which would be a purely Windows to Windows scenario. @mspieth Is that correct?

@dorssel
Copy link
Owner

dorssel commented Nov 9, 2021

Yep, I misplaced the label.

@dorssel dorssel removed the WSL Applies to WSL only label Nov 9, 2021
@mspieth
Copy link
Author

mspieth commented Nov 9, 2021

@dorssel If I understand this issue correctly, it's not WSL related. It's saying that connecting this usbipd-win server to the usbip-win client from cezanne does not work correctly, which would be a purely Windows to Windows scenario. @mspieth Is that correct?

correct. windows to windows. Tested inside a VirtualBox to Host and to another windows machine.

@dorssel dorssel added the USBIP Protocol incompatibility with other software label Nov 13, 2021
dorssel added a commit that referenced this issue Nov 13, 2021
- do not assume NUL padding

Fixes #79
@dorssel
Copy link
Owner

dorssel commented Nov 13, 2021

@mspieth
I've just created PR #88. Could you please verify that this fixes the problem?
MSI is at build artifact: https://github.com/dorssel/usbipd-win/actions/runs/1455571106
Please note that the MSI is not signed, but the drivers are.

@mspieth
Copy link
Author

mspieth commented Nov 13, 2021

I have tested the installer and it appears to work. much more elegant solution.
Had to uninstall the previous install (mine) first though. I did not have to reboot so the drivers must have carried over.
The installer did not install the firewall rule though. this may be expected. I had the same issue with my msi installer.

@dorssel
Copy link
Owner

dorssel commented Nov 13, 2021

Thx for testing. I'll merge the change.

About the firewall rule: did the released version 1.1.1 install the rule correctly? If you fully uninstall (verifying that everything is really gone, maybe even reboot for good measure) and then install the build artifact, the rule is not installed? That would be a regression bug... If that is the case, could you please file a new issue, since merging the change will close this issue, and it seems to be unrelated anyway.

@mspieth
Copy link
Author

mspieth commented Nov 13, 2021

I didn't check for removal of the rule when the program was uninstalled. I had to add one manually and that fixed it.
I will double check this probably on monday AU time.
It would be nice if it could do an update install but this may be an issue due to not being signed the same way (my dev build vs yours vs release).
yes, release 1.1.1 installed the rule correctly.

@e-t-l
Copy link

e-t-l commented Mar 4, 2022

@mspieth Just to clarify, did a PR get merged with this USBIPD-win project so that it now can successfully connect to cezanne's Windows client? I'm trying to do the same thing

@mspieth
Copy link
Author

mspieth commented Mar 4, 2022

  1. Yes it did get merged.
  2. Yes. this is what I do. Good for remote jtag debugging. Good for virtualbox where the USB device doesnt work properly without extensions but you don't want to use extensions due to oracle cost issues.
  3. This is not a client. Only a server. You can use any other client AFAIK barring bugs :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
USBIP Protocol incompatibility with other software
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants