Alex4386 1 год назад
Родитель
Сommit
429190f1bc
3 измененных файлов с 13 добавлено и 5 удалено
  1. 2 0
      src/scenes/mtp/usb.h
  2. 5 5
      src/scenes/mtp/usb_desc.c
  3. 6 0
      src/scenes/mtp/usb_desc.h

+ 2 - 0
src/scenes/mtp/usb.h

@@ -12,6 +12,8 @@ enum UsbDevDescStr {
     UsbDevManuf = 1,
     UsbDevManuf = 1,
     UsbDevProduct = 2,
     UsbDevProduct = 2,
     UsbDevSerial = 3,
     UsbDevSerial = 3,
+    UsbDevHighSpeed = 4,
+    UsbDevLowSpeed = 5,
 };
 };
 /* ===   END furi_hal_usb_i.h === */
 /* ===   END furi_hal_usb_i.h === */
 
 

+ 5 - 5
src/scenes/mtp/usb_desc.c

@@ -12,9 +12,9 @@ const struct usb_device_descriptor usb_mtp_dev_descr = {
     .bDescriptorType = USB_DTYPE_DEVICE,
     .bDescriptorType = USB_DTYPE_DEVICE,
     .bcdUSB = VERSION_BCD(2, 0, 0),
     .bcdUSB = VERSION_BCD(2, 0, 0),
     .bDeviceClass = USB_CLASS_STILL_IMAGE, // MTP falls under Still Image class
     .bDeviceClass = USB_CLASS_STILL_IMAGE, // MTP falls under Still Image class
-    .bDeviceSubClass = 1, // Subclass for MTP
-    .bDeviceProtocol = 1, // Protocol for MTP
-    .bMaxPacketSize0 = USB_EP0_SIZE,
+    .bDeviceSubClass = USB_SUBCLASS_MTP, // Subclass for MTP
+    .bDeviceProtocol = USB_PROTO_MTP, // Protocol for MTP
+    .bMaxPacketSize0 = MTP_MAX_PACKET_SIZE,
     .idVendor = 0x0483, // STMicroelectronics
     .idVendor = 0x0483, // STMicroelectronics
     .idProduct = 0x5741, // Custom Product ID
     .idProduct = 0x5741, // Custom Product ID
     .bcdDevice = VERSION_BCD(1, 0, 0),
     .bcdDevice = VERSION_BCD(1, 0, 0),
@@ -31,8 +31,8 @@ const struct MtpDescriptor usb_mtp_cfg_descr = {
             .bDescriptorType = USB_DTYPE_CONFIGURATION,
             .bDescriptorType = USB_DTYPE_CONFIGURATION,
             .wTotalLength = sizeof(struct MtpDescriptor),
             .wTotalLength = sizeof(struct MtpDescriptor),
             .bNumInterfaces = 1,
             .bNumInterfaces = 1,
-            .bConfigurationValue = 1,
-            .iConfiguration = NO_DESCRIPTOR,
+            .bConfigurationValue = USB_CONF_VAL_MTP,
+            .iConfiguration = UsbDevHighSpeed,
             .bmAttributes = USB_CFG_ATTR_RESERVED | USB_CFG_ATTR_SELFPOWERED,
             .bmAttributes = USB_CFG_ATTR_RESERVED | USB_CFG_ATTR_SELFPOWERED,
             .bMaxPower = USB_CFG_POWER_MA(100),
             .bMaxPower = USB_CFG_POWER_MA(100),
         },
         },

+ 6 - 0
src/scenes/mtp/usb_desc.h

@@ -3,6 +3,12 @@
 #include <furi_hal.h>
 #include <furi_hal.h>
 #include <furi_hal_usb.h>
 #include <furi_hal_usb.h>
 
 
+#define USB_SUBCLASS_MTP 0x01
+#define USB_PROTO_MTP 0x01
+#define USB_CONF_VAL_MTP 1
+
+#define MTP_MAX_PACKET_SIZE 512
+
 struct MtpDescriptor {
 struct MtpDescriptor {
     struct usb_config_descriptor config;
     struct usb_config_descriptor config;
     struct usb_interface_descriptor intf;
     struct usb_interface_descriptor intf;