SceUsbstorVStorDriver: Difference between revisions

From Vita Development Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 185: Line 185:
</source>
</source>


 
[[Category:ARM]]
[[Category:Kernel]]
[[Category:Modules]]
[[Category:Modules]]
[[Category:Kernel]]
[[Category:Library]]

Latest revision as of 21:39, 1 May 2023

Module

Version World Privilege
1.69-3.60 Non-secure Kernel

Libraries

Known NIDs

Version Name World Visibility NID
1.69 SceUsbstorVStorForDriver Non-secure Kernel 0xFD5BA349
3.60 SceUsbstorVStorForDriver Non-secure Kernel not present
1.69-3.60 SceUsbstorVStor Non-secure User 0x17F294B9

Types

#define USBSTOR_DEVICE_TYPE_DIRECT_ACCESS_BLOCK_DEVICE 0 // used for sceUsbstorVStorStart

SceUsbstorVStorForDriver

sceUsbstorVStorSetDeviceInfoForDriver

Version NID
1.69 0x3F02417C
3.60 not present

This is a guessed name.

These name and version show up in the USB descriptor.

int sceUsbstorVStorSetDeviceInfoForDriver(const char* name, const char* version_string);

sceUsbstorVStorSetImgFilePathForDriver

Version NID
1.69 0x78B42CC8
3.60 not present

This is a guessed name.

Sets the filesystem image to use as USB storage. This is limited to the CMA installer ISO and a FAT image at ux0:/umass/fat.img. Other paths will return error.

int sceUsbstorVStorSetImgFilePathForDriver(const char *path);

sceUsbstorVStorStartForDriver

Version NID
1.69 0x31F7BBAD
3.60 not present

This is a guessed name.

The user is responsible for making sure that no other UDC driver is active. This activates UDC as a "PS Vita" Type A device.

int sceUsbstorVStorStartForDriver(int unk);

sceUsbstorVStorStopForDriver

Version NID
1.69 0x99C2BC8A
3.60 not present

This is a guessed name.

int sceUsbstorVStorStopForDriver(int unk);

SceUsbstorVStor

sceUsbstorVStorSetDeviceInfo

Version NID
1.69-3.60 0x3F02417C

This is a guessed name.

User wrapper for #sceUsbstorVStorSetDeviceInfoForDriver. Must have correct permissions to call.

sceUsbstorVStorSetImgFilePath

Version NID
1.69-3.60 0x8C9F93AB

This is a guessed name.

User wrapper for #sceUsbstorVStorSetImgFilePathForDriver. Must have correct permissions to call.

sceUsbstorVStorStart

Version NID
1.69-3.60 0xB606F1AF

This is a guessed name.

User wrapper for #sceUsbstorVStorStartForDriver. Must have correct permissions to call.

sceUsbstorVStorStop

Version NID
1.69-3.60 0x0FD67059

This is a guessed name.

User wrapper for #sceUsbstorVStorStopForDriver. Must have correct permissions to call.

Sample Usage

This code is made for FWs 0.990-1.69 as it used the SceUsbstorVStorForDriver library which was removed in some recent FWs.

int start_usb_storage(void) {
    int ret = SceMtpIfForDriver_0xFDF8C3C0(1); // stop MTP driver (it calls sceUsbMtpStopForDriver)
    printf("Stop: 0x%08X\n", ret);
    ret = sceUsbstorVStorSetDeviceInfoForDriver("\"PS Vita\" MC", "1.00");
    printf("SetName: 0x%08X\n", ret);
    ret = sceUsbstorVStorSetImgFilePathForDriver("ux0:/umass/fat.img");
    printf("SetPath: 0x%08X\n", ret);
    ret = SceUsbstorVStorStartForDriver(USBSTOR_DEVICE_TYPE_DIRECT_ACCESS_BLOCK_DEVICE);
    printf("Activate: 0x%08X\n", ret);
    return 0;
}

int start_usb_storage_unchecked(void) {
    int ret = SceMtpIfForDriver_0xFDF8C3C0(1); // stop MTP driver
    printf("Stop: 0x%08X\n", ret);
    ret = sceUsbstorVStorSetDeviceInfoForDriver("\"PS Vita\" MC", "1.00");
    printf("SetName: 0x%08X\n", ret);
    ret = sceUsbstorVStorSetImgFilePathForDriver("ux0:/any/path/here.img");
    printf("SetPath: 0x%08X\n", ret);
    // Activate without test
    //*(int*)0x013F9054 = 0; // set 1 for RO access
    ret = sceUdcdStartForDriver("USBDeviceControllerDriver", 0, 0);
    printf("StartUSB: 0x%08X\n", ret);
    ret = sceUdcdStartForDriver("USBStor_Driver", 0, 0);
    printf("StartStor: 0x%08X\n", ret);
    ret = sceUdcdActivateForDriver(1491);
    printf("Activate: 0x%08X\n", ret);
    return 0;
}

int stop_usb_storage(void) {
    int ret = sceUsbstorVStorStopForDriver(1); // stop storage driver
    printf("Stop: 0x%08X\n", ret);
    return ret;
}