mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-08-13 03:28:48 +00:00
haze: usb_session: style
This commit is contained in:
parent
f9f5027f26
commit
dce6173137
2 changed files with 66 additions and 65 deletions
|
@ -59,10 +59,10 @@ namespace haze {
|
|||
PtpOperationCode_DeleteObject,
|
||||
};
|
||||
|
||||
constexpr PtpEventCode SupportedEventCodes[] = {};
|
||||
constexpr PtpDevicePropertyCode SupportedPropertyCodes[] = {};
|
||||
constexpr PtpObjectFormatCode SupportedCaptureFormats[] = {};
|
||||
constexpr PtpObjectFormatCode SupportedPlaybackFormats[] = {};
|
||||
constexpr PtpEventCode SupportedEventCodes[] = { /* ... */};
|
||||
constexpr PtpDevicePropertyCode SupportedPropertyCodes[] = { /* ...*/ };
|
||||
constexpr PtpObjectFormatCode SupportedCaptureFormats[] = { /* ...*/ };
|
||||
constexpr PtpObjectFormatCode SupportedPlaybackFormats[] = { /* ...*/ };
|
||||
|
||||
constexpr StorageId SupportedStorageIds[] = {
|
||||
StorageId_SdmcFs,
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace haze {
|
|||
|
||||
namespace {
|
||||
|
||||
static constexpr u32 DefaultInterfaceNumber = 0;
|
||||
constexpr const u32 DefaultInterfaceNumber = 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -150,16 +150,17 @@ namespace haze {
|
|||
Result UsbSession::Initialize(const UsbCommsInterfaceInfo *info, u16 id_vendor, u16 id_product) {
|
||||
R_TRY(usbDsInitialize());
|
||||
|
||||
if (hosversionAtLeast(5,0,0)) {
|
||||
u8 iManufacturer, iProduct, iSerialNumber;
|
||||
static const u16 supported_langs[1] = {0x0409};
|
||||
if (hosversionAtLeast(5, 0, 0)) {
|
||||
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(iProduct), "Nintendo Switch"));
|
||||
R_TRY(usbDsAddUsbStringDescriptor(std::addressof(iSerialNumber), "SerialNumber"));
|
||||
|
||||
// Send device descriptors
|
||||
/* Send device descriptors */
|
||||
struct usb_device_descriptor device_descriptor = {
|
||||
.bLength = USB_DT_DEVICE_SIZE,
|
||||
.bDescriptorType = USB_DT_DEVICE,
|
||||
|
@ -207,9 +208,9 @@ namespace haze {
|
|||
R_TRY(usbDsSetBinaryObjectStore(bos, sizeof(bos)));
|
||||
}
|
||||
|
||||
R_TRY(hosversionAtLeast(5,0,0) ? this->Initialize5x(info) : this->Initialize1x(info));
|
||||
R_TRY(hosversionAtLeast(5, 0, 0) ? this->Initialize5x(info) : this->Initialize1x(info));
|
||||
|
||||
if (hosversionAtLeast(5,0,0)) {
|
||||
if (hosversionAtLeast(5, 0, 0)) {
|
||||
R_TRY(usbDsEnable());
|
||||
}
|
||||
|
||||
|
@ -233,7 +234,7 @@ namespace haze {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue