Difference between revisions of "Capmtp services"

From Nintendo Switch Brew
Jump to navigation Jump to search
 
Line 6: Line 6:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name || Notes
+
! Cmd || Name
|-
 
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]
 
 
|-
 
|-
 +
| 0 || [[#CreateInterface]]
 
|}
 
|}
 +
 +
== CreateInterface ==
 +
No input. Returns an [[#ICapmtpInterface]].
  
 
== ICapmtpInterface ==
 
== ICapmtpInterface ==
Line 17: Line 19:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name || Notes
+
! Cmd || Name
 
|-
 
|-
| 0 || || Takes a u32 max folder count, a u32 max image count, a u32 max video count, a transfer memory handle + u32 size and a type-0x5 buffer translated "Other" utf-16 string.
+
| 0 || [[#Initialize]]
 
|-
 
|-
| 1 || || No input or output. Unmaps transfer memory from Cmd0, stops "nn.capmtp.CapmtpCommandLoop".
+
| 1 || [[#Finalize]]
 
|-
 
|-
| 2 || || No input or output. Starts MTP command handler thread "nn.capmtp.CapmtpCommandLoop".
+
| 2 || [[#Enable]]
 
|-
 
|-
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".
+
| 3 || [[#Disable]]
 
|-
 
|-
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.
+
| 4 || [[#GetConnectionStateChangeEvent]]
 
|-
 
|-
| 5 || || No input. Returns readable event handle. Signaled when the USB connection status changes.
+
| 5 || [[#IsEnabled]]
 
|-
 
|-
| 6 || || No input. Returns true if a USB connection is established.
+
| 6 || [[#IsConnected]]
 
|-
 
|-
| 7 || || No input. Returns readable event handle. Signaled when an error occurred during album scan.
+
| 7 || [[#GetUpdatedErrorEvent]]
|-
 
| 8 || || No input or output. Returns the album scan Result.
 
 
|-
 
|-
 +
| 8 || [[#GetLastError]]
 
|}
 
|}
  
== Notes ==
+
=== Initialize ===
 +
Takes a u32 max folder count, a u32 max image count, a u32 max video count, a transfer memory handle + u32 size and a type-0x5 buffer translated "Other" utf-16 string.
 +
 
 +
=== Finalize ===
 +
No input/output.
 +
 
 +
Unmaps transfer memory from [[#Initialize]], stops "nn.capmtp.CapmtpCommandLoop".
 +
 
 +
=== Enable ===
 +
No input/output.
 +
 
 +
Starts MTP command handler thread "nn.capmtp.CapmtpCommandLoop".
 +
 
 +
=== Disable ===
 +
No input/output.
 +
 
 +
Stops "nn.capmtp.CapmtpCommandLoop".
 +
 
 +
=== GetConnectionStateChangeEvent ===
 +
No input. Returns readable event handle.
 +
 
 +
Signaled when the USB connection status changes.
 +
 
 +
=== IsEnabled ===
 +
No input. Returns an output bool.
 +
 
 +
Returns true if "nn.capmtp.CapmtpCommandLoop" is running.
 +
 
 +
=== IsConnected ===
 +
No input. Returns an output bool.
 +
 
 +
Returns true if a USB connection is established.
 +
 
 +
=== GetUpdatedErrorEvent ===
 +
No input. Returns readable event handle.
 +
 
 +
Signaled when an error occurred during album scan.
 +
 
 +
=== GetLastError ===
 +
No input/output.
 +
 
 +
Returns the album scan Result.
 +
 
 +
= Notes =
 
Only PTP operations 0x1001-0x100A are available.
 
Only PTP operations 0x1001-0x100A are available.
  
Line 48: Line 92:
 
Images and Videos are loaded with [[Capture_services#caps:a|caps:a]].
 
Images and Videos are loaded with [[Capture_services#caps:a|caps:a]].
  
Program names are loaded with [[NS_Services|ns]] using the transfer memory from Cmd0.
+
Program names are loaded with [[NS_Services|ns]] using the transfer memory from [[#Initialize]].

Latest revision as of 20:43, 20 November 2024

This implements the MTP PTP protocol. This was added with 11.0.0.

capmtp

This is "nn::capmtp::ICapmtpRootSession".

Cmd Name
0 #CreateInterface

CreateInterface

No input. Returns an #ICapmtpInterface.

ICapmtpInterface

This is "nn::capmtp::ICapmtpInterface".

Cmd Name
0 #Initialize
1 #Finalize
2 #Enable
3 #Disable
4 #GetConnectionStateChangeEvent
5 #IsEnabled
6 #IsConnected
7 #GetUpdatedErrorEvent
8 #GetLastError

Initialize

Takes a u32 max folder count, a u32 max image count, a u32 max video count, a transfer memory handle + u32 size and a type-0x5 buffer translated "Other" utf-16 string.

Finalize

No input/output.

Unmaps transfer memory from #Initialize, stops "nn.capmtp.CapmtpCommandLoop".

Enable

No input/output.

Starts MTP command handler thread "nn.capmtp.CapmtpCommandLoop".

Disable

No input/output.

Stops "nn.capmtp.CapmtpCommandLoop".

GetConnectionStateChangeEvent

No input. Returns readable event handle.

Signaled when the USB connection status changes.

IsEnabled

No input. Returns an output bool.

Returns true if "nn.capmtp.CapmtpCommandLoop" is running.

IsConnected

No input. Returns an output bool.

Returns true if a USB connection is established.

GetUpdatedErrorEvent

No input. Returns readable event handle.

Signaled when an error occurred during album scan.

GetLastError

No input/output.

Returns the album scan Result.

Notes

Only PTP operations 0x1001-0x100A are available.

  • OpenSession/CloseSession only allow a maximum of 1 session to be opened.
  • DeviceInfo: Serial Number is set to the output from GetSerialNumber. Device Version is set to the SystemVersion DisplayVersion.

While this has access to fsp-srv it remains unused. Images and Videos are loaded with caps:a.

Program names are loaded with ns using the transfer memory from #Initialize.