]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Add BOS USB descriptor. This allows non-root access on Android devices
authorProxcloud <help@proxcloud.eu>
Tue, 6 Feb 2018 17:07:48 +0000 (01:07 +0800)
committerProxcloud <help@proxcloud.eu>
Tue, 6 Feb 2018 17:07:48 +0000 (01:07 +0800)
common/usb_cdc.c

index 348b97e924145278b2af9a1fc33211dd05497778..36df2a860910d830820de12a3c59aae105dad2e3 100644 (file)
@@ -156,6 +156,28 @@ static const char cfgDescriptor[] = {
        0x00,\r
        0x00    // bInterval\r
 };\r
+const char BOSDescriptor[] = {\r
+       // BOS descriptor header\r
+       0x05, 0x0F, 0x39, 0x00, 0x02,\r
+\r
+       // Microsoft OS 2.0 Platform Capability Descriptor\r
+       0x1C,  // Descriptor size (28 bytes)\r
+       0x10,  // Descriptor type (Device Capability)\r
+       0x05,  // Capability type (Platform)\r
+       0x00,  // Reserved\r
+\r
+       // MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F)\r
+       0xDF, 0x60, 0xDD, 0xD8,\r
+       0x89, 0x45,\r
+       0xC7, 0x4C,\r
+       0x9C, 0xD2,\r
+       0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,\r
+\r
+       0x00, 0x00, 0x03, 0x06,    // Windows version (8.1) (0x06030000)\r
+       0x1e, 0x00,\r
+       252,    // Vendor-assigned bMS_VendorCode\r
+       0x00    // Doesn’t support alternate enumeration\r
+};\r
 \r
 static const char StrDescLanguageCodes[] = {\r
   4,                   // Length\r
@@ -550,6 +572,10 @@ void AT91F_CDC_Enumerate() {
                        AT91F_USB_SendData(pUdp, devDescriptor, MIN(sizeof(devDescriptor), wLength));\r
                else if (wValue == 0x200)  // Return Configuration Descriptor\r
                        AT91F_USB_SendData(pUdp, cfgDescriptor, MIN(sizeof(cfgDescriptor), wLength));\r
+               else if ((wValue & 0xF00) == 0xF00)  // Return BOS Descriptor\r
+                       AT91F_USB_SendData(pUdp, BOSDescriptor, MIN(sizeof(BOSDescriptor), wLength));\r
+               else if ((wValue & 0x300) == 0x300)  // Return Manufacturer Descriptor - this is needed by Android\r
+                       AT91F_USB_SendData(pUdp, StrDescManufacturer, MIN(sizeof(StrDescManufacturer), wLength));\r
                else if ((wValue & 0xF00) == 0x300) { // Return String Descriptor\r
                        const char *strDescriptor = getStringDescriptor(wValue & 0xff);\r
                        if (strDescriptor != NULL) {\r
Impressum, Datenschutz