PS4cam-USB

From PS4 Developer wiki
Jump to: navigation, search

USB[edit]

Device Descriptor[edit]

Device Descriptor
Offset Field Size Value Description
0 bLength 1 0x12 Size of this descriptor in bytes (18)
1 bDescriptorType 1 0x01 DEVICE descriptor type (Constant = 1)
2 bcdUSB 2 0x0300 USB Spec release number (3.00):

with which the device and is descriptors are compliant (e.g.: 0x0200 (USB2.0), 0x0300, (USB3.0))

4 bDeviceClass 1 0x00 Class code assigned by USB-IF

(used by the operating system to find a class driver for your device)

  • 00h means each interface defines its own class (identify itself at the interface level: bInterfaceClass )
  • FFh means vendor-defined class
  • Any other value must be a class code

5 bDeviceSubClass 1 0x00 SubClass Code assigned by USB-IF

(used by the operating system to find a class driver for your device)

6 bDeviceProtocol 1 0x00 Protocol Code assigned by USB-IF

(used by the operating system to find a class driver for your device)

7 bMaxPacketSize0 1 0x09 Max packet size for endpoint 0.

8 idVendor 2 0x05a9 Vendor ID (VID) (OmniVision Technologies, Inc.) - must be obtained from USB-IF

(used by the operating system to find a driver for your device)

10 idProduct 2 0x0580 Product ID (PID) - assigned by the manufacturer

(used by the operating system to find a driver for your device)

12 bcdDevice 2 0x0100 Device release number (Version: 1.00)

in binary coded decimal

14 iManufacturer 1 0x01 Index of string descriptor describing manufacturer

set to 0 if no string

15 iProduct 1 0x02 Index of string descriptor describing product

set to 0 if no string

16 iSerialNumber 1 0x00 Index of string descriptor describing device serial number
set to 0 if no string
17 bNumConfigurations 1 0x01 Number of possible configurations

Configuration Descriptor[edit]

Configuration Descriptor
Offset Field Size Value Description
0 bLength 1 0x09 Size
1 bDescriptorType 1 0x02 (= 2)
2 wTotalLength 2 0x002C Total number of bytes (44) in this descriptor and all the following descriptors (9+9+ + +)
4 bNumInterfaces 1 0x01 Number of interfaces supported by this configuration
5 bConfigurationValue 1 0x01 Value used by Set Configuration to select this configuration
6 iConfiguration 1 0x00 Index of string descriptor describing configuration - set to 0 if no string
7 bmAttributes 1 0x80 Powered by the bus (10000000)

specify power parameters for the configuration :

8-digit bit binary
7|6|5|4|3|2|1|0

  • D0 - D4: Reserved.
  • D5: The configuration supports remote wakeup.
  • D6: The configuration is self-powered and does not use power from the bus.
  • D7: The configuration is powered by the bus.

8 bMaxPower 1 0x32 Maximum current: 100mA drawn by device in this configuration.
In units of 2mA. So 0x32 (50) means 100 mA
Interface Descriptor
0 bLength 1 0x09 Size
1 bDescriptorType 1 0x04 (= 4)
2 bInterfaceNumber 1 0x00 Number identifying this interface.

Zero-based value

3 bAlternateSetting 1 0x00 The first (and default) value used to select alternative setting is always 0

(An interface can have more than one variant, and these variants can be switched between, while other interfaces are still in operation)

4 bNumEndpoints 1 0x02 Number of Endpoints used for this interface
5 bInterfaceClass 1 0xFF Class code assigned by USB-IF

  • 00h is a reserved value
  • FFh means vendor-defined class
  • Any other value must be a class code

6 bInterfaceSubClass 1 0x00 SubClass Code assigned by USB-IF
7 bInterfaceProtocol 1 0x00 Protocol Code assigned by USB-IF
8 iInterface 1 0x00 Index of string descriptor describing interface - set to 0 if no string
Endpoint (OUT) Descriptor
0 bLength 1 0x0- Size
1 bDescriptorType 1 0x05 (= 5)
2 bEndpointAddress 1 0x01 OUT<--(0 000 0001)-->1

The address of this endpoint within the device:

  • D3-D0: Endpoint number
  • D6-D4: Reserved. set to Zero
  • D7: Direction: 0 = OUT, 1 = IN (Ignored for Control Endpoints)

3 bmAttributes 1 0x02 Bulk (00000010)

(D1:0) Transfer Type:

  • 00 = Control
  • 01 = Isochronous
  • 10 = Bulk
  • 11 = Interrupt

The following only apply to isochronous endpoints. Else set to 0.

(D3:2) Synchronisation Type (ISO mode):

  • 00 = No Synchronisation
  • 01 = Asynchronous
  • 10 = Adaptive
  • 11 = Synchronous

(D5:4) Usage Type (ISO mode):

  • 00 = Data endpoint
  • 01 = Feedback endpoint
  • 10 = Implicit feedback Data endpoint
  • 11 = Reserved

(D7:6) Reserved Set to 0

4 wMaxPacketSize 2 0x0400 (1024)
6 bInterval 1 0x00 - (unit depends on device speed)

Interval for polling endpoint for data transfers. Expressed in frames (ms) for low/full speed or microframes (125µs) for high speed
(ignored for Bulk & Control Endpoints. Isochronous must equal 1 and field may range from 1 to 255 for interrupt endpoints)

- bMaxBurst 1 0x0F MaxBurst (15)

The number of packets the endpoint can send or receive as part of a burst (range 1 - 16). See transfer Type.

Endpoint (IN) Descriptor
0 bLength 1 0x0- Size
1 bDescriptorType 1 0x05 ( =5)
2 bEndpointAddress 1 0x82 IN<--(1 000 0010)-->2
3 bmAttributes 1 0x02 Bulk
4 wMaxPacketSize 2 0x0400 (1024)
6 bInterval 1 0x00 0
- bMaxBurst 1 0x0F MaxBurst (15)
Binary Object Store Descriptor
0 bLength 1 0x05 Size (05)
1 bDescriptorType 1 0x0F (= 15)
2 wTotalLength 1 0x16 (22) (5+7+10)
3 bNumDeviceCaps 1 0x02 (2)

must be at least 2 for SuperSpeed devices and equal to 3 for USB 3.0 hubs.

- USB 2.0 Extension Device Capability:
bLength 1 0x07 (7) Size
bDescriptorType 1 0x10 ( =16)
bDevCapabilityType 1 0x02 (2)

  • 02 (USB 2.0 EXTENSION) or 03 (SUPERSPEED_USB) or 04 (CONTAINER_ID)

bmAttributes 4 0x00000002 (00000000 00000000 00000000 00000010) Link Power Management supported

See USB2-LPM-Errata-final.pdf p3

  • D0 Reserved. Must be set to zero
  • D1 A value of one in this bit location indicates that this device supports the Link Power Management (LPM) protocol
  • D2 BESL & Alternate HIRD definitions supported. The LPM bit must be set to a one when this bit is a one
  • D3 Recommended Baseline BESL valid
  • D4 Recommended Deep BESL valid
  • D11:8 Recommended Baseline BESL value. Field shall be ignored by system software if bit [3] is a zero.
  • D15:12 Recommended Deep BESL value. Field shall be ignored by system software if bit is a zero.
  • D31:16 Reserved. Must be set to zero.

- SuperSpeed USB Device Capability:
bLength 1 0x0A (10) Size
bDescriptorType 1 0x10 (= 16)
bDevCapabilityType 1 0x03 (3)
bmAttributes 1 0x00 (00000000)

  • D1 is 1 if it is a LTM capable device

wSpeedsSupported 0x000e

  • Device can operate at Full Speed (12Mbps)
  • Device can operate at High Speed (480Mbps)
  • Device can operate at SuperSpeed (5Gbps)

bFunctionalitySupport

Lowest fully-functional device speed is Full Speed 12Mbps)

bU1DevExitLat 10µ
bU2DevExitLat 32µs
Device Status 0x0000