Skip to content

Instantly share code, notes, and snippets.

@mentha
Created March 18, 2018 14:55
Show Gist options
  • Save mentha/2c65e69bd8895f0bda264139c6272a5a to your computer and use it in GitHub Desktop.
Save mentha/2c65e69bd8895f0bda264139c6272a5a to your computer and use it in GitHub Desktop.
Linux usbip patch
diff -udr a/libsrc/vhci_driver.c b/libsrc/vhci_driver.c
--- a/libsrc/vhci_driver.c 2018-03-18 22:07:40.126034770 +0800
+++ b/libsrc/vhci_driver.c 2018-03-18 22:10:22.405106067 +0800
@@ -150,7 +150,12 @@
static int vhci_hcd_filter(const struct dirent *dirent)
{
- return strcmp(dirent->d_name, "vhci_hcd") >= 0;
+ size_t l = strlen(dirent->d_name);
+ if (l < 8)
+ return 0;
+ if (memcmp(dirent->d_name, "vhci_hcd", 8))
+ return 0;
+ return 1;
}
static int get_ncontrollers(void)
@mentha
Copy link
Author

mentha commented Mar 18, 2018

On my system the original filter matches wdt and thus usbip always fails finding the nonexist second controller. I changed it to match names beginning with vhci_hcd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment