8#include <nsysuhs/uhs.h>
9#include <nsysuhs/uhs_usbspec.h>
13#include "WutUsbProbe.h"
21 void * cfgBuffer = memalign(0x40, UHS_CONFIG_BUFFER_SIZE);
26 memset(&config, 0,
sizeof(config));
27 config.controller_num = 0;
28 config.buffer = cfgBuffer;
29 config.buffer_size = UHS_CONFIG_BUFFER_SIZE;
32 memset(&handle, 0,
sizeof(handle));
34 UHSStatus openStatus = UhsClientOpen(&handle, &config);
35 if(openStatus == UHS_STATUS_OK)
37 UhsInterfaceFilter filter;
38 memset(&filter, 0,
sizeof(filter));
39 filter.match_params = MATCH_ANY;
41 UhsInterfaceProfile * profiles = (UhsInterfaceProfile *)memalign(0x40,
sizeof(UhsInterfaceProfile) * MAX_PROFILES);
44 memset(profiles, 0,
sizeof(UhsInterfaceProfile) * MAX_PROFILES);
48 int foundCount = (int)UhsQueryInterfaces(&handle, &filter, profiles, MAX_PROFILES);
50 for(
int i = 0; i < foundCount; i++)
52 bool isStorage = (profiles[i].if_desc.bInterfaceClass == USBCLASS_STORAGE);
57 entry.
ifHandle = profiles[i].if_handle;
58 entry.
vid = profiles[i].dev_desc.idVendor;
59 entry.
pid = profiles[i].dev_desc.idProduct;
64 UhsClientClose(&handle);
74 for(
int i = 0; i < a.
count; i++)
76 bool foundInB =
false;
77 for(
int j = 0; j < b.
count; j++)
One USBCLASS_STORAGE interface as seen by a single ScanUsbHardwareSignature() call.
uint16_t pid
USB product id.
uint16_t vid
USB vendor id.
uint32_t ifHandle
nsysuhs interface handle; only meaningful within one boot session
The set of USBCLASS_STORAGE interfaces nsysuhs currently reports across every controller_num probed.
static const int kMaxInterfaces
Capacity of interfaces[].
int count
Number of valid entries in interfaces[].
UsbHardwareInterfaceInfo interfaces[kMaxInterfaces]
Attached USBCLASS_STORAGE interfaces; only the first count entries are valid.