From 7ae659c2cb70f98a2529f9f1be54aa682be7eb02 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Wed, 28 Nov 2018 15:03:06 -0500 Subject: [PATCH] Handle the output u8 in _usbDsGetSession, without using it in the callers. --- nx/source/services/usb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nx/source/services/usb.c b/nx/source/services/usb.c index 981f7677..b19718f1 100644 --- a/nx/source/services/usb.c +++ b/nx/source/services/usb.c @@ -375,7 +375,7 @@ Result usbDsSetVidPidBcd(const UsbDsDeviceInfo* deviceinfo) { return rc; } -static Result _usbDsGetSession(Service* srv, Service* srv_out, u64 cmd_id, const void* buf0, size_t buf0size, const void* buf1, size_t buf1size) { +static Result _usbDsGetSession(Service* srv, Service* srv_out, u64 cmd_id, const void* buf0, size_t buf0size, const void* buf1, size_t buf1size, u8 *out) { IpcCommand c; ipcInitialize(&c); @@ -403,10 +403,13 @@ static Result _usbDsGetSession(Service* srv, Service* srv_out, u64 cmd_id, const struct { u64 magic; u64 result; + u8 out; } *resp = r.Raw; rc = resp->result; + if (R_SUCCEEDED(rc) && out) *out = resp->out; + if (R_SUCCEEDED(rc)) { serviceCreate(srv_out, r.Handles[0]); } @@ -529,7 +532,7 @@ Result usbDsGetDsInterface(UsbDsInterface** interface, struct usb_interface_desc Result rc; for (unsigned int i = 0; i < TOTAL_INTERFACES; i++) { send_desc.bInterfaceNumber = i; - rc = _usbDsGetSession(&g_usbDsSrv, &srv, 2, &send_desc, USB_DT_INTERFACE_SIZE, interface_name, strlen(interface_name)+1); + rc = _usbDsGetSession(&g_usbDsSrv, &srv, 2, &send_desc, USB_DT_INTERFACE_SIZE, interface_name, strlen(interface_name)+1, NULL); if (R_SUCCEEDED(rc)) { break; } @@ -929,7 +932,7 @@ Result usbDsInterface_GetDsEndpoint(UsbDsInterface* interface, UsbDsEndpoint** e UsbDsEndpoint* ptr = _usbDsAllocateEndpoint(interface); if(ptr==NULL)return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory); - Result rc = _usbDsGetSession(&interface->h, &ptr->h, 0, descriptor, USB_DT_ENDPOINT_SIZE, NULL, 0); + Result rc = _usbDsGetSession(&interface->h, &ptr->h, 0, descriptor, USB_DT_ENDPOINT_SIZE, NULL, 0, NULL); if (R_SUCCEEDED(rc)) rc = _usbDsGetEvent(&ptr->h, &ptr->CompletionEvent, 2);//GetCompletionEvent