Fixed usbhs 3.0.0+ support with usbHsAcquireUsbIf.

This commit is contained in:
yellows8 2018-12-26 11:18:09 -05:00
parent 36a2404e4b
commit e9cc565e92
2 changed files with 9 additions and 2 deletions

View File

@ -89,7 +89,7 @@ typedef struct {
Event eventCtrlXfer; ///< [2.0.0+] Signaled when CtrlXferAsync finishes.
s32 ID;
UsbHsInterface inf; ///< Initialized with the input interface from \ref usbHsAcquireUsbIf, then the first 0x1B8-bytes are overwritten with the cmd output (data before pathstr).
UsbHsInterface inf; ///< Initialized with the input interface from \ref usbHsAcquireUsbIf, then overwritten with the cmd output. Pre-3.0.0 this only overwrites the first 0x1B8-bytes (data before pathstr).
} UsbHsClientIfSession;
typedef struct {

View File

@ -337,7 +337,14 @@ Result usbHsAcquireUsbIf(UsbHsClientIfSession* s, UsbHsInterface *interface) {
s32 ID;
} *raw;
ipcAddRecvBuffer(&c, &s->inf.inf, sizeof(UsbHsInterfaceInfo), BufferType_Normal);
if (!kernelAbove300()) {
ipcAddRecvBuffer(&c, &s->inf.inf, sizeof(UsbHsInterfaceInfo), BufferType_Normal);
}
else {
size_t tmpoff = offsetof(UsbHsInterfaceInfo, output_endpoint_descs[12]);
ipcAddRecvBuffer(&c, &s->inf.inf, tmpoff, BufferType_Normal);
ipcAddRecvBuffer(&c, &s->inf.inf.output_endpoint_descs[12], sizeof(UsbHsInterface) - tmpoff, BufferType_Normal);
}
raw = serviceIpcPrepareHeader(&g_usbHsSrv, &c, sizeof(*raw));