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

Fix build issues for VStudio 2019 CE and installation failure of the wdm driver #251

Closed
wants to merge 11 commits into from

Conversation

vadimgrn
Copy link

  1. Fix: there are build errors if use the latest Visual Studio 2019 Community Edition
  2. Improvement: more precise error mapping for urb status between Linux - Windows
  3. Fix: vhci wdm driver can't be used after installation (status is not OK in the Device Manager)

cezanne and others added 9 commits March 17, 2021 18:13
Old plugout was prone to incur BSOD when a very busy device is detached.
Fiio device suffers from such the problem(see comment in cezanne#222). Indeed,
there was no locking between vusb I/O and plugout.
To resolve this issue, get/put for vusb has been introduced with a
reference count.
Now, a port number is determined by vhci driver. Prior usbip.exe
handovered a free port number chosen from port status array which
were acquired from a vhci driver.
This improvement is inteneded to support more complex port
assignment rule such as usb 3.0 port assignment scheme of UDE.
cezanne added a commit that referenced this pull request Jul 15, 2021
PR(#251) reported that build error occurs with VS2019 CE 16.10.3.
This issue seems to be related to VS2019 which changed stdio fuctions
to inline. It's not clear why older versions don't have that problem.
cezanne pushed a commit that referenced this pull request Jul 15, 2021
This commit is from PR(#251). Slightly modified by cezanne.
cezanne added a commit that referenced this pull request Jul 15, 2021
cezanne added a commit that referenced this pull request Jul 15, 2021
Change vhub hw id to VID_1209&PID_8250 form as pointed out in #251.
cezanne added a commit that referenced this pull request Jul 15, 2021
pnp_query_id() in vhci has been improved refering #251.
BusQueryDeviceSerialNumber is newly added.
cezanne added a commit that referenced this pull request Jul 15, 2021
Composite device identification is more clarified from #251.
MSDN says the conditions of a composite. (See the below link)

https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/enumeration-of-the-composite-parent-device
@cezanne
Copy link
Owner

cezanne commented Jul 15, 2021

@vadimgrn : Thanks for your PR. I have uploaded several commits on dev_temp branch. They are built from your ab77ab2..723f9d5. e4a8f34 will be done later.

cezanne added a commit that referenced this pull request Jul 16, 2021
usbd flag translation for URB_SHORT_NOT_OK has been fixed as suggested
in #251.
cezanne added a commit that referenced this pull request Jul 16, 2021
@cezanne
Copy link
Owner

cezanne commented Jul 16, 2021

@vadimgrn : I've done to apply your PR into dev_temp branch. Please understand for selective pull from your commits.
Your work is very helpful.

@vadimgrn
Copy link
Author

You've added at least one bug and removed most of my changes without explanation. But it is your repository and your rules.

@cezanne
Copy link
Owner

cezanne commented Jul 16, 2021

@vadimgrn :

You've added at least one bug removed most of my changes without explanation.

I'm sorry for that. For my late explanation for removal or modifications of your commits,

  • There were unwanted codes to accept your commit as it is.
  • I had tried to accept all your codes without beautifying codes, which did not comply with usbip-win coding style.

I believe to merge most of your great works, but please let me know about removed codes and the bug.

@vadimgrn
Copy link
Author

vadimgrn commented Jul 16, 2021

driver/vhci/vhci_plugin.c

else {
		vpdo->num_configurations = dsc_dev->bNumConfigurations;
	} else {
		/* TODO: can happen? */
		vpdo->vendor = 0;
		vpdo->product = 0;
		vpdo->revision = 0;
		vpdo->usbclass = 0;
		vpdo->subclass = 0;
		vpdo->protocol = 0;
		vpdo->speed = USB_SPEED_LOW; // must be USB_SPEED_UNKNOWN
		vpdo->num_configurations = 1; // MUST BE ZERO, number of configurations is not known
	}

@cezanne
Copy link
Owner

cezanne commented Jul 16, 2021

@vadimgrn :
Your comment is definitely correct.

But my intention is that the current implementation changes codes less and is consistent with composite detection logic. Currently, there's no mechanism to update 0 num_configurations. I think that the current code would be fine because the else part is never called. usbpi.exe does not proceed to attach if it fails to get the descriptor.

@vadimgrn
Copy link
Author

In such case the else section should be removed. If I were you, I would replace all lines in else section with NT_ASSERT(!"message" ).

@cezanne
Copy link
Owner

cezanne commented Jul 16, 2021

@vadimgrn : I agree. I'll do it later.

cezanne added a commit that referenced this pull request Jul 19, 2021
PR(#251) reported that build error occurs with VS2019 CE 16.10.3.
This issue seems to be related to VS2019 which changed stdio fuctions
to inline. It's not clear why older versions don't have that problem.
cezanne pushed a commit that referenced this pull request Jul 19, 2021
This commit is from PR(#251). Slightly modified by cezanne.
cezanne added a commit that referenced this pull request Jul 19, 2021
cezanne added a commit that referenced this pull request Jul 19, 2021
Change vhub hw id to VID_1209&PID_8250 form as pointed out in #251.
cezanne added a commit that referenced this pull request Jul 19, 2021
pnp_query_id() in vhci has been improved refering #251.
BusQueryDeviceSerialNumber is newly added.
cezanne added a commit that referenced this pull request Jul 19, 2021
Composite device identification is more clarified from #251.
MSDN says the conditions of a composite. (See the below link)

https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/enumeration-of-the-composite-parent-device
cezanne added a commit that referenced this pull request Jul 19, 2021
usbd flag translation for URB_SHORT_NOT_OK has been fixed as suggested
in #251.
cezanne added a commit that referenced this pull request Jul 19, 2021
cezanne added a commit that referenced this pull request Jul 19, 2021
Old vhci gave unnecessary null check for descriptors in pluginfo which
are statically allocated. Those unreachable codes are removed.

See #251 (comment)
@cezanne
Copy link
Owner

cezanne commented Jul 19, 2021

@vadimgrn : I agree. I'll do it later.

Those codes are removed without leaving assert at 62de496. They are unreachable codes and confusing.

@vadimgrn vadimgrn closed this Jul 22, 2021
@vadimgrn vadimgrn deleted the branch cezanne:dev July 22, 2021 08:59
@vadimgrn vadimgrn deleted the dev branch July 22, 2021 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants