mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 10:32:15 +02:00
Added usbCommsGetInfo.
This commit is contained in:
parent
6942c8db75
commit
27dcf8eab0
@ -7,6 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
#include "../../types.h"
|
||||
#include "../../services/usbds.h"
|
||||
|
||||
typedef struct {
|
||||
u8 bInterfaceClass;
|
||||
@ -37,3 +38,9 @@ size_t usbCommsReadEx(void* buffer, size_t size, u32 interface);
|
||||
|
||||
/// Same as usbCommsWrite except with the specified interface.
|
||||
size_t usbCommsWriteEx(const void* buffer, size_t size, u32 interface);
|
||||
|
||||
/// Gets the raw usbDs data for the default usbComms interface.
|
||||
Result usbCommsGetInfo(UsbDsInterface ** interface, UsbDsEndpoint ** endpoint_in, UsbDsEndpoint ** endpoint_out);
|
||||
|
||||
/// Same as usbCommsGetInfo except with the specified interface.
|
||||
Result usbCommsGetInfoEx(UsbDsInterface ** interface, UsbDsEndpoint ** endpoint_in, UsbDsEndpoint ** endpoint_out, u32 interface);
|
@ -599,3 +599,27 @@ size_t usbCommsWrite(const void* buffer, size_t size)
|
||||
return usbCommsWriteEx(buffer, size, 0);
|
||||
}
|
||||
|
||||
Result usbCommsGetInfoEx(UsbDsInterface ** interface, UsbDsEndpoint ** endpoint_in, UsbDsEndpoint ** endpoint_out, u32 interface) {
|
||||
|
||||
usbCommsInterface *inter = &g_usbCommsInterfaces[interface];
|
||||
Result rc;
|
||||
|
||||
if interface >= TOTAL_INTERFACES || !inter->initialized {
|
||||
*interface = NULL;
|
||||
*endpoint_in = NULL;
|
||||
*endpoint_out = NULL;
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
}
|
||||
else {
|
||||
*interface = inter->interface;
|
||||
*endpoint_in = inter->endpoint_in;
|
||||
*endpoint_out = outter->endpoint_out;
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result usbCommsGetInfo(UsbDsInterface ** interface, UsbDsEndpoint ** endpoint_in, UsbDsEndpoint ** endpoint_out) {
|
||||
return usbCommsGetInfoEx(interface, endpoint_in, endpoint_out, 0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user