haze: usb_session: style

This commit is contained in:
Liam 2023-04-15 19:46:22 -04:00
parent f9f5027f26
commit dce6173137
2 changed files with 66 additions and 65 deletions

View File

@ -59,10 +59,10 @@ namespace haze {
PtpOperationCode_DeleteObject, PtpOperationCode_DeleteObject,
}; };
constexpr PtpEventCode SupportedEventCodes[] = {}; constexpr PtpEventCode SupportedEventCodes[] = { /* ... */};
constexpr PtpDevicePropertyCode SupportedPropertyCodes[] = {}; constexpr PtpDevicePropertyCode SupportedPropertyCodes[] = { /* ...*/ };
constexpr PtpObjectFormatCode SupportedCaptureFormats[] = {}; constexpr PtpObjectFormatCode SupportedCaptureFormats[] = { /* ...*/ };
constexpr PtpObjectFormatCode SupportedPlaybackFormats[] = {}; constexpr PtpObjectFormatCode SupportedPlaybackFormats[] = { /* ...*/ };
constexpr StorageId SupportedStorageIds[] = { constexpr StorageId SupportedStorageIds[] = {
StorageId_SdmcFs, StorageId_SdmcFs,

View File

@ -19,7 +19,7 @@ namespace haze {
namespace { namespace {
static constexpr u32 DefaultInterfaceNumber = 0; constexpr const u32 DefaultInterfaceNumber = 0;
} }
@ -151,15 +151,16 @@ namespace haze {
R_TRY(usbDsInitialize()); R_TRY(usbDsInitialize());
if (hosversionAtLeast(5, 0, 0)) { if (hosversionAtLeast(5, 0, 0)) {
u8 iManufacturer, iProduct, iSerialNumber;
static const u16 supported_langs[1] = { 0x0409 }; static const u16 supported_langs[1] = { 0x0409 };
R_TRY(usbDsAddUsbLanguageStringDescriptor(NULL, supported_langs, sizeof(supported_langs)/sizeof(u16))); R_TRY(usbDsAddUsbLanguageStringDescriptor(NULL, supported_langs, util::size(supported_langs)));
u8 iManufacturer, iProduct, iSerialNumber;
R_TRY(usbDsAddUsbStringDescriptor(std::addressof(iManufacturer), "Nintendo")); R_TRY(usbDsAddUsbStringDescriptor(std::addressof(iManufacturer), "Nintendo"));
R_TRY(usbDsAddUsbStringDescriptor(std::addressof(iProduct), "Nintendo Switch")); R_TRY(usbDsAddUsbStringDescriptor(std::addressof(iProduct), "Nintendo Switch"));
R_TRY(usbDsAddUsbStringDescriptor(std::addressof(iSerialNumber), "SerialNumber")); R_TRY(usbDsAddUsbStringDescriptor(std::addressof(iSerialNumber), "SerialNumber"));
// Send device descriptors /* Send device descriptors */
struct usb_device_descriptor device_descriptor = { struct usb_device_descriptor device_descriptor = {
.bLength = USB_DT_DEVICE_SIZE, .bLength = USB_DT_DEVICE_SIZE,
.bDescriptorType = USB_DT_DEVICE, .bDescriptorType = USB_DT_DEVICE,
@ -233,7 +234,7 @@ namespace haze {
} }
Result UsbSession::TransferAsync(UsbSessionEndpoint ep, void *buffer, size_t size, u32 *out_urb_id) { Result UsbSession::TransferAsync(UsbSessionEndpoint ep, void *buffer, size_t size, u32 *out_urb_id) {
return usbDsEndpoint_PostBufferAsync(m_endpoints[ep], buffer, size, out_urb_id); R_RETURN(usbDsEndpoint_PostBufferAsync(m_endpoints[ep], buffer, size, out_urb_id));
} }
Result UsbSession::GetTransferResult(UsbSessionEndpoint ep, u32 urb_id, u32 *out_transferred_size) { Result UsbSession::GetTransferResult(UsbSessionEndpoint ep, u32 urb_id, u32 *out_transferred_size) {