Skip to content

Instantly share code, notes, and snippets.

@fcicq
Last active May 29, 2020 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcicq/0eacdf6bfe86c46bde75d03f74b2a6be to your computer and use it in GitHub Desktop.
Save fcicq/0eacdf6bfe86c46bde75d03f74b2a6be to your computer and use it in GitHub Desktop.
--- a/hw/usb/dev-network.c 2020-05-28 00:00:00.000000000 +0800
+++ b/hw/usb/dev-network.c 2020-05-28 00:00:00.000000000 +0000
@@ -47,8 +47,8 @@
/* For hardware that can talk RNDIS and either of the above protocols,
* use this ID ... the windows INF files will know it.
*/
-#define RNDIS_VENDOR_NUM 0x0525 /* NetChip */
-#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */
+#define RNDIS_VENDOR_NUM 0x04b3 /* IBM */
+#define RNDIS_PRODUCT_NUM 0x4010 /* Ethernet/RNDIS Gadget */
enum usbstring_idx {
STRING_MANUFACTURER = 1,
@@ -66,6 +66,10 @@
#define DEV_CONFIG_VALUE 1 /* CDC or a subset */
#define DEV_RNDIS_CONFIG_VALUE 2 /* RNDIS; optional */
+#define USB_CLASS_MISC 0xef /* For rndiscmp.inf compatibility */
+#define USB_MISC_SUBCLASS_RNDIS 0x04
+#define USB_MISC_RNDIS_PROTO_ENET 0x01
+
#define USB_CDC_SUBCLASS_ACM 0x02
#define USB_CDC_SUBCLASS_ETHERNET 0x06
@@ -188,9 +192,9 @@
/* CDC Control Interface */
.bInterfaceNumber = 0,
.bNumEndpoints = 1,
- .bInterfaceClass = USB_CLASS_COMM,
- .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
- .bInterfaceProtocol = USB_CDC_PROTO_NONE,
+ .bInterfaceClass = USB_CLASS_MISC,
+ .bInterfaceSubClass = USB_MISC_SUBCLASS_RNDIS,
+ .bInterfaceProtocol = USB_MISC_RNDIS_PROTO_ENET,
.iInterface = STRING_CONTROL,
.ndesc = 3,
.descs = (USBDescOther[]) {
@fcicq
Copy link
Author

fcicq commented May 28, 2020

note change bMaxBurst?

@fcicq
Copy link
Author

fcicq commented May 29, 2020

USB\MS_COMP_RNDIS&MS_SUBCOMP_5162001

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/mb-interface-model-supplement

GET_DESCRIPTOR
String Descriptor Structure
0x12 0x03 4D00530046005400310030003000 0xcd 0x00

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