Difference between revisions of "USB services"

From Nintendo Switch Brew
Jump to navigation Jump to search
(Official symbols)
Line 1: Line 1:
 
One symbol in USB-sysmodule is: "vtable for nn::usb::detail::UsbComplexTegra21x".
 
One symbol in USB-sysmodule is: "vtable for nn::usb::detail::UsbComplexTegra21x".
  
=usb:ds=
+
= usb:ds =
 
Used for Switch<>PC USB comms, aka Switch-as-device.
 
Used for Switch<>PC USB comms, aka Switch-as-device.
 
This service is used during [[Factory Setup|factory setup]] by [[Manu Services|manu]].
 
This service is used during [[Factory Setup|factory setup]] by [[Manu Services|manu]].
Line 9: Line 9:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || BindComplex
+
| 0 || [[#BindComplex]]
 
|-
 
|-
| 1 || BindClientProcess
+
| 1 || [[#BindClientProcess]]
 
|-
 
|-
| 2 || GetDsInterface
+
| 2 || [[#GetDsInterface]]
 
|-
 
|-
| 3 || GetStateChangeEvent
+
| 3 || [[#GetStateChangeEvent]]
 
|-
 
|-
 
| 4 ||  
 
| 4 ||  
 
|-
 
|-
| 5 || SetVidPidBcd
+
| 5 || [[#SetVidPidBcd]]
 
|}
 
|}
 +
 +
== BindComplex ==
 +
Takes an u32 ('''complexId'''). [[Manu_Services|Manu]] sends 0x02.
 +
 +
== BindClientProcess ==
 +
Takes 1 copy-handle for the current process (0xFFFF8001).
 +
 +
== GetDsInterface ==
 +
Takes 2 type-5 buffers and returns an [[#IDsInterface]]. [[Manu_Services|Manu]] sends a 0x09-byte command (e.g.: 0x09, 0x04, 0x04, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00) in the first buffer and a string ("usb") in the second buffer.
 +
 +
== GetStateChangeEvent ==
 +
Returns an event handle for state changes.
 +
 +
== SetVidPidBcd ==
 +
Takes a type-5 buffer with 0x66 bytes of USB descriptor data (see [[Manu_Services#manu|manu]]).
  
 
== IDsInterface ==
 
== IDsInterface ==
Line 27: Line 42:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || GetDsEndpoint
+
| 0 || [[#GetDsEndpoint]]
 
|-
 
|-
| 1 || GetSetupEvent
+
| 1 || [[#GetSetupEvent]]
 
|-
 
|-
 
| 2 ||  
 
| 2 ||  
 
|-
 
|-
| 3 || EnableInterface
+
| 3 || [[#EnableInterface]]
 
|-
 
|-
| 4 || DisableInterface
+
| 4 || [[#DisableInterface]]
 
|-
 
|-
 
| 5 ||  
 
| 5 ||  
Line 41: Line 56:
 
| 6 ||  
 
| 6 ||  
 
|-
 
|-
| 7 || GetCtrlInCompletionEvent
+
| 7 || [[#GetCtrlInCompletionEvent]]
 
|-
 
|-
 
| 8 ||  
 
| 8 ||  
 
|-
 
|-
| 9 || GetCtrlOutCompletionEvent
+
| 9 || [[#GetCtrlOutCompletionEvent]]
 
|-
 
|-
 
| 10 ||  
 
| 10 ||  
Line 51: Line 66:
 
| 11 ||  
 
| 11 ||  
 
|}
 
|}
 +
 +
=== GetDsEndpoint ===
 +
Takes a type-5 buffer and returns an [[#IDsEndpoint]]. [[Manu_Services|Manu]] sends a 0x07-byte command (e.g.: 0x07, 0x05, 0x80, 0x02, 0x00, 0x02, 0x00) in the first buffer.
 +
 +
=== GetSetupEvent ===
 +
Returns an event handle for interface setup changes.
 +
 +
=== EnableInterface ===
 +
Takes no arguments. Enables the current interface.
 +
 +
=== DisableInterface ===
 +
Takes no arguments. Disables the current interface.
 +
 +
=== GetCtrlInCompletionEvent ===
 +
Returns an event handle for polling the completion of input control commands.
 +
 +
=== GetCtrlOutCompletionEvent ===
 +
Returns an event handle for polling the completion of output control commands.
  
 
=== IDsEndpoint ===
 
=== IDsEndpoint ===
Line 57: Line 90:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || PostBufferAsync
+
| 0 || [[#PostBufferAsync]]
 
|-
 
|-
 
| 1 ||  
 
| 1 ||  
Line 63: Line 96:
 
| 2 ||  
 
| 2 ||  
 
|-
 
|-
| 3 || GetReportData
+
| 3 || [[#GetReportData]]
 
|-
 
|-
 
| 4 ||  
 
| 4 ||  
Line 70: Line 103:
 
|}
 
|}
  
=usb:hs=
+
==== PostBufferAsync ====
 +
Takes an u32 ('''size''') and an u64 ('''buffer''').
 +
 
 +
==== GetReportData ====
 +
Returns 0x84 bytes of report data from the endpoint.
 +
 
 +
= usb:hs =
 
General USB devices usage, used by hid-sysmodule and bsdsockets-sysmodule.
 
General USB devices usage, used by hid-sysmodule and bsdsockets-sysmodule.
  
=usb:pd=
+
= usb:pd =
 
Only system-titles with access to this are [[PTM_services|PTM]] and [[AM_services|AM]].
 
Only system-titles with access to this are [[PTM_services|PTM]] and [[AM_services|AM]].
  
=usb:pd:c=
+
= usb:pd:c =
 
USB-sysmodule symbols for this refer to "Cradle", which is the [[Dock]].
 
USB-sysmodule symbols for this refer to "Cradle", which is the [[Dock]].
  
=usb:pm=
+
= usb:pm =
 
Presumably Power Management, only system-title using this is [[PTM_services|PTM]].
 
Presumably Power Management, only system-title using this is [[PTM_services|PTM]].

Revision as of 18:10, 29 September 2017

One symbol in USB-sysmodule is: "vtable for nn::usb::detail::UsbComplexTegra21x".

usb:ds

Used for Switch<>PC USB comms, aka Switch-as-device. This service is used during factory setup by manu.

Cmd Name
0 #BindComplex
1 #BindClientProcess
2 #GetDsInterface
3 #GetStateChangeEvent
4
5 #SetVidPidBcd

BindComplex

Takes an u32 (complexId). Manu sends 0x02.

BindClientProcess

Takes 1 copy-handle for the current process (0xFFFF8001).

GetDsInterface

Takes 2 type-5 buffers and returns an #IDsInterface. Manu sends a 0x09-byte command (e.g.: 0x09, 0x04, 0x04, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00) in the first buffer and a string ("usb") in the second buffer.

GetStateChangeEvent

Returns an event handle for state changes.

SetVidPidBcd

Takes a type-5 buffer with 0x66 bytes of USB descriptor data (see manu).

IDsInterface

Cmd Name
0 #GetDsEndpoint
1 #GetSetupEvent
2
3 #EnableInterface
4 #DisableInterface
5
6
7 #GetCtrlInCompletionEvent
8
9 #GetCtrlOutCompletionEvent
10
11

GetDsEndpoint

Takes a type-5 buffer and returns an #IDsEndpoint. Manu sends a 0x07-byte command (e.g.: 0x07, 0x05, 0x80, 0x02, 0x00, 0x02, 0x00) in the first buffer.

GetSetupEvent

Returns an event handle for interface setup changes.

EnableInterface

Takes no arguments. Enables the current interface.

DisableInterface

Takes no arguments. Disables the current interface.

GetCtrlInCompletionEvent

Returns an event handle for polling the completion of input control commands.

GetCtrlOutCompletionEvent

Returns an event handle for polling the completion of output control commands.

IDsEndpoint

Cmd Name
0 #PostBufferAsync
1
2
3 #GetReportData
4
5

PostBufferAsync

Takes an u32 (size) and an u64 (buffer).

GetReportData

Returns 0x84 bytes of report data from the endpoint.

usb:hs

General USB devices usage, used by hid-sysmodule and bsdsockets-sysmodule.

usb:pd

Only system-titles with access to this are PTM and AM.

usb:pd:c

USB-sysmodule symbols for this refer to "Cradle", which is the Dock.

usb:pm

Presumably Power Management, only system-title using this is PTM.