Skip to contentSkip to conversation

usb: uapi: add usb 3.0 authentication declarations

PATCH Superseded Oliver Neukum 2 participants 6 messages Mar 17 – Mar 19 USB

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 usb: uapi: add usb 3.0 authentication declarations

This adds the USB authentication extensions to the uapi chapter 9 declarations, so that user space tools correctly operate on the descriptor and commands. This is necessary for sniffing and debugging in gadget mode to correctly work, even though the kernel does not use these requests in host mode.

---
 include/uapi/linux/usb/ch9.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
include/uapi/linux/usb/ch9.h +13 -0
index 8003243a4937..6f02dc39430a 100644
@@ -102,6 +102,8 @@
 #define USB_REQ_LOOPBACK_DATA_WRITE	0x15
 #define USB_REQ_LOOPBACK_DATA_READ	0x16
 #define USB_REQ_SET_INTERFACE_DS	0x17
+#define USB_REQ_AUTH_IN			0x18
+#define REQ_REQ_AUTH_OUT		0x19
 
 /* specific requests for USB Power Delivery */
 #define USB_REQ_GET_PARTNER_PDO		20
@@ -1147,6 +1149,17 @@ struct usb_ptm_cap_descriptor {
 
 /*-------------------------------------------------------------------------*/
 
+struct usb_authentication_capability_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType; /* set to USB_DT_DEVICE_CAPABILITY */
+	__u8  bmAttributes;
+
+	__u8  bcdProtocolVersion;
+	__u8  bcdCapability;
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
 /* USB_DT_WIRELESS_ENDPOINT_COMP:  companion descriptor associated with
  * each endpoint descriptor for a wireless device
  */
Signature · 1 line
2.53.0
#1 lore raw

PATCH 2/2 USB: uapi: add BULK_MAX_PACKET_UPDATE

The spec for Embedded USB2 Version 2.0 adds a new feature request. This needs to be added to uapi for monitoring.

---
 include/uapi/linux/usb/ch9.h | 2 ++
 1 file changed, 2 insertions(+)
include/uapi/linux/usb/ch9.h +2 -0
index 6f02dc39430a..bf1bae138844 100644
@@ -133,6 +133,8 @@
 #define USB_DEVICE_A_ALT_HNP_SUPPORT	5	/* (otg) other RH port does */
 #define USB_DEVICE_DEBUG_MODE		6	/* (special devices only) */
 
+#define BULK_MAX_PACKET_UPDATE		8	/* (eUSB2v2) bump maxpacket to 1024 */
+
 /*
  * Test Mode Selectors
  * See USB 2.0 spec Table 9-7
Signature · 1 line
2.53.0
maintainer
#5 lore raw
In reply to Oliver Neukum
Quoted 17 lines · Oliver Neukum

This adds the USB authentication extensions to the uapi chapter 9 declarations, so that user space tools correctly operate on the descriptor and commands. This is necessary for sniffing and debugging in gadget mode to correctly work, even though the kernel does not use these requests in host mode.

---
 include/uapi/linux/usb/ch9.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
include/uapi/linux/usb/ch9.h +0 -0
index 8003243a4937..6f02dc39430a 100644

include/uapi/linux/usb/ch9.h line 106

Quoted 5 lines
include/uapi/linux/usb/ch9.h +2 -0
@@ -102,6 +102,8 @@
 #define USB_REQ_LOOPBACK_DATA_WRITE	0x15
 #define USB_REQ_LOOPBACK_DATA_READ	0x16
 #define USB_REQ_SET_INTERFACE_DS	0x17
+#define USB_REQ_AUTH_IN			0x18
+#define REQ_REQ_AUTH_OUT		0x19

This should be USB_REQ_AUTH_OUT, right?

thanks,

greg k-h

maintainer
#2 lore raw

Re: [PATCH 2/2] USB: uapi: add BULK_MAX_PACKET_UPDATE

In reply to Oliver Neukum
Quoted 13 lines · Oliver Neukum

The spec for Embedded USB2 Version 2.0 adds a new feature request. This needs to be added to uapi for monitoring.

---
 include/uapi/linux/usb/ch9.h | 2 ++
 1 file changed, 2 insertions(+)
include/uapi/linux/usb/ch9.h +0 -0
index 6f02dc39430a..bf1bae138844 100644

include/uapi/linux/usb/ch9.h line 136

Quoted 4 lines
include/uapi/linux/usb/ch9.h +1 -0
@@ -133,6 +133,8 @@
 #define USB_DEVICE_A_ALT_HNP_SUPPORT	5	/* (otg) other RH port does */
 #define USB_DEVICE_DEBUG_MODE		6	/* (special devices only) */
 
+#define BULK_MAX_PACKET_UPDATE		8	/* (eUSB2v2) bump maxpacket to 1024 */

Should have USB_ as a prefix.

And what is 7?

thanks,

greg k-h

#3 lore raw

Re: [PATCH 2/2] USB: uapi: add BULK_MAX_PACKET_UPDATE

Quoted 1 line · Greg KH

Should have USB_ as a prefix.

Roger

Quoted 1 line

And what is 7?

I have no idea. These things have becomes messy. As you can see some values have been used twice and sometimes we use USB_DEVICE as a prefix and sometimes USB_DEV although both are for devices.

I can try a full cleanup, if you prefer that.

Regards
Oliver

maintainer
#4 lore raw

Re: [PATCH 2/2] USB: uapi: add BULK_MAX_PACKET_UPDATE

Quoted 5 lines · Oliver Neukum
Quoted 1 line · Greg KH

Should have USB_ as a prefix.

Roger

Quoted 8 lines
Quoted 1 line

And what is 7?

I have no idea. These things have becomes messy. As you can see some values have been used twice and sometimes we use USB_DEVICE as a prefix and sometimes USB_DEV although both are for devices.

I can try a full cleanup, if you prefer that.

We really can not change things we have exported to userspace here, so we have to live with what we have, sorry.

thanks,

greg k-h