Skip to contentSkip to conversation

usb: gadget: add RNDIS configfs option for Windows rndiscmp.inf compatibility

PATCH In review David Lechner 2 participants 2 messages Feb 28, 2017 – Mar 1, 2017 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: add RNDIS configfs option for Windows rndiscmp.inf compatibility

This adds a new configfs attribute named use_ms_rndiscmp. It is a boolean value that is used to select the class/subclass/protocol used by the RNDIS function interface association descriptor. By default, this is 0x02 (Comm), 0x06 (Ethernet), 0xff (None). When the use_ms_rndiscmp attribute is set to true, the values 0xef (Misc), 0x04 (RNDIS), 0x01 (Ethernet) will be used instead. This class/subclass/ protocol combination is recognized by the rndiscmp.inf file in Windows Vista and newer and will cause Windows to load the correct RNDIS driver without the need for a custom (signed) .inf file.

---
 .../ABI/testing/configfs-usb-gadget-rndis          |  3 ++
 drivers/usb/gadget/function/f_rndis.c              | 48 ++++++++++++++++++++++
 drivers/usb/gadget/function/u_rndis.h              |  1 +
 include/uapi/linux/usb/misc.h                      | 14 +++++++
 4 files changed, 66 insertions(+)
 create mode 100644 include/uapi/linux/usb/misc.h
Documentation/ABI/testing/configfs-usb-gadget-rndis +3 -0
index e32879b..bb4b5a85 100644
@@ -12,3 +12,6 @@ Description:
 				Ethernet over USB link
 		dev_addr	- MAC address of device's end of this
 				Ethernet over USB link
+		use_ms_rndiscmp	- Use the MS Windows rndiscmp.inf compatible
+				class 0xEF, subclass 0x04, protocol 0x01
+				instead of the default 0x02/0x06/0x00.
drivers/usb/gadget/function/f_rndis.c +48 -0

71 lines not on this page · raw message

drivers/usb/gadget/function/u_rndis.h +1 -0
index 4eafd50..03f241f 100644
@@ -25,6 +25,7 @@ struct f_rndis_opts {
 	struct net_device		*net;
 	bool				bound;
 	bool				borrowed_net;
+	bool				use_ms_rndiscmp;
 
 	struct usb_os_desc		rndis_os_desc;
 	char				rndis_ext_compat_id[16];
include/uapi/linux/usb/misc.h new file +14 -0
new file mode 100644
index 0000000..a6661f6
@@ -0,0 +1,14 @@
+/*
+ * USB Miscellaneous Device Class definitions
+ *
+ * Ref: http://www.usb.org/developers/defined_class/#BaseClassEFh
+ */
+
+#ifndef __UAPI_LINUX_USB_MISC_H
+#define __UAPI_LINUX_USB_MISC_H
+
+#define USB_MISC_SUBCLASS_RNDIS			0x04
+
+#define USB_MISC_RNDIS_PROTO_ENET		0x01
+
+#endif /* __UAPI_LINUX_USB_MISC_H */
Signature · 1 line
2.7.4
#1 lore raw
Quoted 10 lines · David Lechner

This adds a new configfs attribute named use_ms_rndiscmp. It is a boolean value that is used to select the class/subclass/protocol used by the RNDIS function interface association descriptor. By default, this is 0x02 (Comm), 0x06 (Ethernet), 0xff (None). When the use_ms_rndiscmp attribute is set to true, the values 0xef (Misc), 0x04 (RNDIS), 0x01 (Ethernet) will be used instead. This class/subclass/ protocol combination is recognized by the rndiscmp.inf file in Windows Vista and newer and will cause Windows to load the correct RNDIS driver without the need for a custom (signed) .inf file.

To be honest, I'm not very happy with this patch because it makes our ConfigFS interface inflexible.

Let's assume that any other combination of this attributes will be needed in a future and then what we are going to do with use_ms_rndiscmp attribute?

So instead of having single attribute which sets the whole triple of values to some hardcoded ones I would prefer to have one attribute per each of this values and allow user to set them to his own values from userspace.

Best regards,

Signature · 3 lines
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics