Advertisement
xerpi

PSVita UDCD UVC USB descriptors, lsusb works

Oct 20th, 2017
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 7.49 KB | None | 0 0
  1. static
  2. unsigned char video_control_descriptors[] = {
  3.     /* Interface Association Descriptor */
  4.     0x08,           /* Descriptor Size */
  5.     0x11,           /* Interface Association Descr Type: 11 */
  6.     0x00,           /* I/f number of first VideoControl i/f */
  7.     0x02,           /* Number of Video i/f */
  8.     0x0E,           /* CC_VIDEO : Video i/f class code */
  9.     0x03,           /* SC_VIDEO_INTERFACE_COLLECTION : Subclass code */
  10.     0x00,           /* Protocol : Not used */
  11.     0x02,           /* String desc index for interface */
  12. };
  13.  
  14. static
  15. unsigned char video_streaming_descriptors[] = {
  16.     /* Class-specific Video Streaming Input Header Descriptor */
  17.     0x0E,           /* Descriptor size */
  18.     0x24,           /* Class-specific VS I/f Type */
  19.     0x01,           /* Descriptotor Subtype : Input Header */
  20.     0x00,           /* No format desciptor supported for FS device */
  21.     0x0E, 0x00,     /* Total size of Class specific VS descr */
  22.     0x83,           /* EP address for BULK video data */
  23.     0x00,           /* No dynamic format change supported */
  24.     0x04,           /* Output terminal ID : 4 */
  25.     0x01,           /* Still image capture method 1 supported */
  26.     0x00,           /* Hardware trigger NOT supported */
  27.     0x00,           /* Hardware to initiate still image capture NOT supported */
  28.     0x01,           /* Size of controls field : 1 byte */
  29.     0x00,           /* D2 : Compression quality supported */
  30. };
  31.  
  32. /* Endpoint blocks */
  33. static
  34. struct SceUdcdEndpoint endpoints[4] = {
  35.     {0x00, 0, 0, 0},
  36.     {0x00, 1, 0, 0},
  37.     {0x80, 2, 0, 0},
  38.     {0x80, 3, 0, 0}
  39. };
  40.  
  41. /* Interfaces */
  42. static
  43. struct SceUdcdInterface interfaces[1] = {
  44.     {-1, 0, 1}
  45. };
  46.  
  47. /* String descriptor */
  48. static
  49. struct SceUdcdStringDescriptor string_descriptors[2] = {
  50.     {
  51.         18,
  52.         USB_DT_STRING,
  53.         {'V', 'i', 't', 'a', ' ', 'U', 'V', 'C'}
  54.     },
  55.     {
  56.         0,
  57.         USB_DT_STRING
  58.     }
  59. };
  60.  
  61. /* HI-Speed device descriptor */
  62. static
  63. struct SceUdcdDeviceDescriptor devdesc_hi = {
  64.     USB_DT_DEVICE_SIZE,
  65.     USB_DT_DEVICE,
  66.     0x200,          /* bcdUSB */
  67.     0xEF,           /* bDeviceClass */
  68.     0x02,           /* bDeviceSubClass */
  69.     0x01,           /* bDeviceProtocol */
  70.     64,         /* bMaxPacketSize0 */
  71.     0,          /* idProduct */
  72.     0,          /* idVendor */
  73.     0x100,          /* bcdDevice */
  74.     0,          /* iManufacturer */
  75.     0,          /* iProduct */
  76.     0,          /* iSerialNumber */
  77.     1           /* bNumConfigurations */
  78. };
  79.  
  80. /* Hi-Speed endpoint descriptors */
  81. static
  82. struct SceUdcdEndpointDescriptor endpdesc_hi[4] = {
  83.     /* Video Control endpoints */
  84.     {
  85.         USB_DT_ENDPOINT_SIZE,
  86.         USB_DT_ENDPOINT,
  87.         0x01,           /* bEndpointAddress */
  88.         0x02,           /* bmAttributes */
  89.         0x200,          /* wMaxPacketSize */
  90.         0x00            /* bInterval */
  91.     },
  92.     {
  93.         USB_DT_ENDPOINT_SIZE,
  94.         USB_DT_ENDPOINT,
  95.         0x82,           /* bEndpointAddress */
  96.         0x03,           /* bmAttributes */
  97.         0x40,           /* wMaxPacketSize */
  98.         0x01            /* bInterval */
  99.     },
  100.     /* Video Streaming endpoints */
  101.     {
  102.         USB_DT_ENDPOINT_SIZE,
  103.         USB_DT_ENDPOINT,
  104.         0x83,           /* bEndpointAddress */
  105.         0x02,           /* bmAttributes */
  106.         0x200,          /* wMaxPacketSize */
  107.         0x00            /* bInterval */
  108.     },
  109.     {
  110.         0,
  111.     }
  112. };
  113.  
  114. /* Hi-Speed interface descriptor */
  115. static
  116. struct SceUdcdInterfaceDescriptor interdesc_hi[3] = {
  117.     {   /* Standard Video Control Interface Descriptor */
  118.         USB_DT_INTERFACE_SIZE,
  119.         USB_DT_INTERFACE,
  120.         0,              /* bInterfaceNumber */
  121.         0,              /* bAlternateSetting */
  122.         2,              /* bNumEndpoints */
  123.         14,             /* bInterfaceClass */
  124.         0x01,               /* bInterfaceSubClass */
  125.         0x00,               /* bInterfaceProtocol */
  126.         0,              /* iInterface */
  127.         &endpdesc_hi[0],        /* endpoints */
  128.         video_control_descriptors,
  129.         sizeof(video_control_descriptors)
  130.     },
  131.     {   /* Standard Video Streaming Interface Descriptor */
  132.         USB_DT_INTERFACE_SIZE,
  133.         USB_DT_INTERFACE,
  134.         1,              /* bInterfaceNumber */
  135.         0,              /* bAlternateSetting */
  136.         1,              /* bNumEndpoints */
  137.         14,             /* bInterfaceClass */
  138.         0x02,               /* bInterfaceSubClass */
  139.         0x00,               /* bInterfaceProtocol */
  140.         0,              /* iInterface */
  141.         &endpdesc_hi[2],        /* endpoints */
  142.         video_streaming_descriptors,
  143.         sizeof(video_streaming_descriptors)
  144.     },
  145.     {
  146.         0
  147.     }
  148. };
  149.  
  150. /* Hi-Speed settings */
  151. static
  152. struct SceUdcdInterfaceSettings settings_hi[1] = {
  153.     {
  154.         interdesc_hi,
  155.         0,
  156.         2
  157.     }
  158. };
  159.  
  160. /* Hi-Speed configuration descriptor */
  161. static
  162. struct SceUdcdConfigDescriptor confdesc_hi = {
  163.     USB_DT_CONFIG_SIZE,
  164.     USB_DT_CONFIG,
  165.     (USB_DT_CONFIG_SIZE + 2 * USB_DT_INTERFACE_SIZE + 3 * USB_DT_ENDPOINT_SIZE +
  166.         sizeof(video_control_descriptors) +
  167.         sizeof(video_streaming_descriptors)),   /* wTotalLength */
  168.     2,          /* bNumInterfaces */
  169.     1,          /* bConfigurationValue */
  170.     0,          /* iConfiguration */
  171.     0xC0,           /* bmAttributes */
  172.     0,          /* bMaxPower */
  173.     &settings_hi[0]
  174. };
  175.  
  176. /* Hi-Speed configuration */
  177. static
  178. struct SceUdcdConfiguration config_hi = {
  179.     &confdesc_hi,
  180.     &settings_hi[0],
  181.     &interdesc_hi[0],
  182.     &endpdesc_hi[0]
  183. };
  184.  
  185. /* Full-Speed device descriptor */
  186. static
  187. struct SceUdcdDeviceDescriptor devdesc_full = {
  188.     USB_DT_DEVICE_SIZE,
  189.     USB_DT_DEVICE,
  190.     0x200,          /* bcdUSB (should be 0x110 but the PSVita freezes otherwise) */
  191.     0xEF,           /* bDeviceClass */
  192.     0x02,           /* bDeviceSubClass */
  193.     0x01,           /* bDeviceProtocol */
  194.     0x40,           /* bMaxPacketSize0 */
  195.     0,          /* idProduct */
  196.     0,          /* idVendor */
  197.     0x200,          /* bcdDevice */
  198.     0,          /* iManufacturer */
  199.     0,          /* iProduct */
  200.     0,          /* iSerialNumber */
  201.     1           /* bNumConfigurations */
  202. };
  203.  
  204. /* Full-Speed endpoint descriptors */
  205. static
  206. struct SceUdcdEndpointDescriptor endpdesc_full[4] = {
  207.     /* Video Control endpoints */
  208.     {
  209.         USB_DT_ENDPOINT_SIZE,
  210.         USB_DT_ENDPOINT,
  211.         0x01,           /* bEndpointAddress */
  212.         0x02,           /* bmAttributes */
  213.         0x40,           /* wMaxPacketSize */
  214.         0x00            /* bInterval */
  215.     },
  216.     {
  217.         USB_DT_ENDPOINT_SIZE,
  218.         USB_DT_ENDPOINT,
  219.         0x82,           /* bEndpointAddress */
  220.         0x03,           /* bmAttributes */
  221.         0x40,           /* wMaxPacketSize */
  222.         0x01            /* bInterval */
  223.     },
  224.     /* Video Streaming endpoints */
  225.     {
  226.         USB_DT_ENDPOINT_SIZE,
  227.         USB_DT_ENDPOINT,
  228.         0x83,           /* bEndpointAddress */
  229.         0x02,           /* bmAttributes */
  230.         0x40,           /* wMaxPacketSize */
  231.         0x00            /* bInterval */
  232.     },
  233.     {
  234.         0,
  235.     }
  236. };
  237.  
  238. /* Full-Speed interface descriptor */
  239. static
  240. struct SceUdcdInterfaceDescriptor interdesc_full[3] = {
  241.     {   /* Standard Video Control Interface Descriptor */
  242.         USB_DT_INTERFACE_SIZE,
  243.         USB_DT_INTERFACE,
  244.         0,              /* bInterfaceNumber */
  245.         0,              /* bAlternateSetting */
  246.         2,              /* bNumEndpoints */
  247.         14,             /* bInterfaceClass */
  248.         0x01,               /* bInterfaceSubClass */
  249.         0x00,               /* bInterfaceProtocol */
  250.         1,              /* iInterface */
  251.         &endpdesc_full[0],      /* endpoints */
  252.         video_control_descriptors,
  253.         sizeof(video_control_descriptors)
  254.     },
  255.     {   /* Standard Video Streaming Interface Descriptor */
  256.         USB_DT_INTERFACE_SIZE,
  257.         USB_DT_INTERFACE,
  258.         1,              /* bInterfaceNumber */
  259.         0,              /* bAlternateSetting */
  260.         1,              /* bNumEndpoints */
  261.         14,             /* bInterfaceClass */
  262.         0x02,               /* bInterfaceSubClass */
  263.         0x00,               /* bInterfaceProtocol */
  264.         1,              /* iInterface */
  265.         &endpdesc_full[2],      /* endpoints */
  266.         video_streaming_descriptors,
  267.         sizeof(video_streaming_descriptors)
  268.     },
  269.     {
  270.         0
  271.     }
  272. };
  273.  
  274. /* Full-Speed settings */
  275. static
  276. struct SceUdcdInterfaceSettings settings_full[1] = {
  277.     {
  278.         &interdesc_full[0],
  279.         0,
  280.         2
  281.     }
  282. };
  283.  
  284. /* Full-Speed configuration descriptor */
  285. static
  286. struct SceUdcdConfigDescriptor confdesc_full = {
  287.     USB_DT_CONFIG_SIZE,
  288.     USB_DT_CONFIG,
  289.     (USB_DT_CONFIG_SIZE + 2 * USB_DT_INTERFACE_SIZE + 3 * USB_DT_ENDPOINT_SIZE +
  290.         sizeof(video_control_descriptors) +
  291.         sizeof(video_streaming_descriptors)),   /* wTotalLength */
  292.     2,          /* bNumInterfaces */
  293.     1,          /* bConfigurationValue */
  294.     0,          /* iConfiguration */
  295.     0xC0,           /* bmAttributes */
  296.     0,          /* bMaxPower */
  297.     &settings_full[0]
  298. };
  299.  
  300. /* Full-Speed configuration */
  301. static
  302. struct SceUdcdConfiguration config_full = {
  303.     &confdesc_full,
  304.     &settings_full[0],
  305.     &interdesc_full[0],
  306.     &endpdesc_full[0]
  307. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement