USB services: Difference between revisions

Behemoth (talk | contribs)
add usb states enum
No edit summary
Line 661: Line 661:


This uses the same func internally as [[#PostBufferAsync_2|#PostBufferAsync]] except multiple urbs are specified by the user: the input buffer contains an array of u32s for the size of each urb, where '''urbCount''' is the total number of entries in this array. With [[#PostBufferAsync_2|#PostBufferAsync]] the last 2 params passed to the internal func are hard-coded to 0, while with this command it's '''unk1''' and '''unk2'''.
This uses the same func internally as [[#PostBufferAsync_2|#PostBufferAsync]] except multiple urbs are specified by the user: the input buffer contains an array of u32s for the size of each urb, where '''urbCount''' is the total number of entries in this array. With [[#PostBufferAsync_2|#PostBufferAsync]] the last 2 params passed to the internal func are hard-coded to 0, while with this command it's '''unk1''' and '''unk2'''.
= usb:pd =
This is "nn::usb::pd::detail::IPdManager".
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || [[#OpenSession]]
|}
Only system-titles with access to this are [[PTM_services|ptm]] and [[AM_services|am]].
== OpenSession ==
No input. Returns an [[#IPdSession]].
== IPdSession ==
This is "nn::usb::pd::detail::IPdSession".
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || BindNoticeEvent
|-
| 1 || UnbindNoticeEvent
|-
| 2 || GetStatus
|-
| 3 || GetNotice
|-
| 4 || EnablePowerRequestNotice
|-
| 5 || DisablePowerRequestNotice
|-
| 6 || ReplyPowerRequest
|}
= usb:pd:c =
This is "nn::usb::pd::detail::IPdCradleManager".
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || [[#OpenCradleSession]]
|}
USB-sysmodule symbols for this refer to "Cradle", which is the [[Dock]].
== OpenCradleSession ==
No input. Returns an [[#IPdCradleSession]].
== IPdCradleSession ==
This is "nn::usb::pd::detail::IPdCradleSession".
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || [[#AccessCradleVdoWithWriteRequest]]
|-
| 1 || [[#AccessCradleVdoWithReadRequest]]
|-
| 2 || Vdm20Init || No input/output.
If Cradle or RelayBox is connected, caches result of VDM 0x20.
|-
| 3 || [2.0.0+] GetFwType
|-
| 4 || [2.0.0+] GetFwRevision
|-
| 5 || [2.0.0+] GetManufacturerId
|-
| 6 || [2.0.0+] GetDeviceId
|-
| 7 || [3.0.0+]
|-
| 8 || [3.0.0+]
|}
=== AccessCradleVdoWithWriteRequest ===
Takes two input u32s '''Value''' and '''UserId'''. No output.
'''UserId''' is translated to the actual [[#VdmCommand]] to send.
=== AccessCradleVdoWithReadRequest ===
Takes an input u32 '''UserId'''. Returns an u32 '''Value'''.
'''UserId''' is translated to the actual [[#VdmCommand]] to send.
=== GetFwType ===
No input. Returns an output u16.
=== GetFwRevision ===
No input. Returns an output u16.
=== GetManufacturerId ===
No input. Returns an output u16.
=== GetDeviceId ===
No input. Returns an output u16.
= usb:pd:m =
This is "nn::usb::pd::detail::IPdManufactureManager".
[2.0.0+] This service was merged into [[#usb:pd:c|usb:pd:c]].
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || [[#OpenManufactureSession]]
|}
== OpenManufactureSession ==
No input. Returns an [[#IPdManufactureSession]].
== IPdManufactureSession ==
This is "nn::usb::pd::detail::IPdManufactureSession".
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || GetFwType
|-
| 1 || GetFwRevision
|-
| 2 || GetManufacturerId
|-
| 3 || GetDeviceId
|}
= usb:pm =
This is "nn::usb::pm::IPmService".
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 ||
|-
| 1 ||
|-
| 2 ||
|-
| 3 ||
|-
| 4 ||
|-
| 5 ||
|}
USB Port Manager, only system-title using this is [[PTM_services|ptm]].
= usb:qdb =
Added with [[7.0.0]].
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 ||
|-
| 1 ||
|}
== Cmd0 ==
No input/output, takes a type-0x5 input buffer.
This loads data for [[#HidGamepad]] with the input .json.
== Cmd1 ==
Takes 6-bytes of input (u16s '''vid''', '''pid''', '''bcdDevice''') and a type-0x5 input buffer, returns an output u8 bool indicating success.
Locates an entry in the [[#HidGamepad]] state with the input u16s, and checks for a '''quirks''' array entry where '''name''' matches the input buffer string. Returns 1 when found, 0 otherwise.
= usb:obsv =
Added with [8.0.0+].
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 ||
|-
| 1 ||
|}


= UsbHsInterface =
= UsbHsInterface =
Line 780: Line 968:
Official sw only uses the Result/size fields.
Official sw only uses the Result/size fields.


= usb:pd =
= VdmCommand =
This is "nn::usb::pd::detail::IPdManager".
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
! Value || UserId || Name
|-
|-
| 0 || GetPdSession
| 0 || - || None
|}
 
Only system-titles with access to this are [[PTM_services|ptm]] and [[AM_services|am]].
 
== IPdSession ==
This is "nn::usb::pd::detail::IPdSession".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || BindNoticeEvent
|-
| 1 || UnbindNoticeEvent
|-
| 2 || GetStatus
|-
| 3 || GetNotice
|-
|-
| 4 || EnablePowerRequestNotice
| 1 || 0 || LedControlRequest
|-
| 5 || DisablePowerRequestNotice
|-
| 6 || ReplyPowerRequest
|}
 
= usb:pd:c =
This is "nn::usb::pd::detail::IPdCradleManager".
 
{| class="wikitable" border="1"
|-
! Cmd || Name || Notes
|-
| 0 || GetPdCradleSession || Returns a session handle for the below.
|}
 
USB-sysmodule symbols for this refer to "Cradle", which is the [[Dock]].
 
== IPdCradleSession ==
This is "nn::usb::pd::detail::IPdCradleSession".
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
| 2 || - || SleepButtonNotice
|-
|-
| 0 || VdmUserWrite || Input { u32 value; u32 VdmUserId; }. Output {}.
| 3 || 10 || DeviceTypeRequest
If Cradle or RelayBox is connected, issues given VDM with value.
|-
|-
| 1 || VdmUserRead || Input { u32 VdmUserId; }. Output { u32 value; }.
| 4 || - || DeviceTypeReply
If Cradle or RelayBox is connected, returns u32 response from issuing given VDM.
|-
|-
| 2 || Vdm20Init || No input/output.
| 5 || - || UsbPowerErrorNotice
If Cradle or RelayBox is connected, caches result of VDM 0x20.
|-
|-
| 3 || [2.0.0+] GetFwType || No input. Returns an output u16.
| 6 || 1 || Dp2HdmiFwVerRequest
|-
|-
| 4 || [2.0.0+] GetFwRevision || No input. Returns an output u16.
| 7 || - || Dp2HdmiFwVerReply
|-
|-
| 5 || [2.0.0+] GetManufacturerId || No input. Returns an output u16.
| 8 || - || Dp2HdmiFwUpdateRequest
|-
|-
| 6 || [2.0.0+] GetDeviceId || No input. Returns an output u16.
| 9 || - || Dp2HdmiFwUpdateReply
|-
|-
| 7 || [3.0.0+] ||
| 10 || - || Dp2HdmiFwUpdateNotice
|-
|-
| 8 || [3.0.0+] ||
| 11 || 2 || PdcHFwVerRequest
|}
 
Note: The VdmUserId given to VdmUserRead/VdmUserWrite is translated from the given (enum) value to the actual cmd to send.
 
= usb:pd:m =
This is "nn::usb::pd::detail::IPdManufactureManager". This is only available on 1.0.0.
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
| 12 || - || PdcHFwVerReply
|-
|-
| 0 || || No input, returns an [[#IPdManufactureSession]].
| 13 || - || PdcHFwUpdateRequest
|}
 
== IPdManufactureSession ==
This is "nn::usb::pd::detail::IPdManufactureSession".
 
These commands just load the u16 from global state.
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
| 14 || - || PdcHFwUpdateReply
|-
|-
| 0 || || No input, returns an output u16.
| 15 || - || PdcHFwUpdateNotice
|-
|-
| 1 || || No input, returns an output u16.
| 16 || 3 || PdcAFwVerRequest
|-
|-
| 2 || || No input, returns an output u16.
| 17 || - || PdcAFwVerReply
|-
|-
| 3 || || No input, returns an output u16.
| 18 || - || PdcAFwUpdateRequest
|-
|-
|}
| 19 || - || PdcAFwUpdateReply
 
= usb:pm =
This is "nn::usb::pm::IPmService".
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 20 || - || PdcAFwUpdateNotice
|-
|-
| 0 ||
| 21 || - || DeviceErrorNotice
|-
|-
| 1 ||
| 22 || 4 || DeviceStateRequest
|-
|-
| 2 ||
| 23 || || DeviceStateReply
|-
|-
| 3 ||
| 24 || 5 || McuFwVerRequest
|-
|-
| 4 ||
| 25 || || McuFwVerReply
|-
|-
| 5 ||
| 26 || 6 || McuFwUpdateRequest
|}
 
USB Port Manager, only system-title using this is [[PTM_services|ptm]].
 
= usb:qdb =
Added with [[7.0.0]].
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 27 || || McuFwUpdateReply
|-
|-
| 0 ||  
| 28 || 7 || McuFwUpdateNotice
|-
|-
| 1 ||  
| 29 || - ||  
|}
 
== Cmd0 ==
No input/output, takes a type-0x5 input buffer.
 
This loads data for [[#HidGamepad]] with the input .json.
 
== Cmd1 ==
Takes 6-bytes of input (u16s '''vid''', '''pid''', '''bcdDevice''') and a type-0x5 input buffer, returns an output u8 bool indicating success.
 
Locates an entry in the [[#HidGamepad]] state with the input u16s, and checks for a '''quirks''' array entry where '''name''' matches the input buffer string. Returns 1 when found, 0 otherwise.
 
= usb:obsv =
Added with [8.0.0+].
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 30 || 8 ||  
|-
|-
| 0 ||  
| 31 || - ||  
|-
|-
| 1 ||  
| 32 || 9 ||  
|}
|}