mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
btm: add BtmDeviceCondition definitions
(cherry picked from commit a598dca0e1d8cb4c4f3c053494048832c05a79ed) (cherry picked from commit 9736386850dc4b987b095a43eceefc469996b2fa)
This commit is contained in:
parent
58885db2cd
commit
fcdbab21e9
@ -64,7 +64,7 @@ typedef enum {
|
|||||||
|
|
||||||
/// BdName
|
/// BdName
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 name[0x20]; ///< Name string.
|
char name[0x20]; ///< Name string.
|
||||||
} BtmBdName;
|
} BtmBdName;
|
||||||
|
|
||||||
/// ClassOfDevice
|
/// ClassOfDevice
|
||||||
@ -91,9 +91,68 @@ typedef struct {
|
|||||||
u8 feature_set; ///< Same as BtdrvAdapterProperty::feature_set.
|
u8 feature_set; ///< Same as BtdrvAdapterProperty::feature_set.
|
||||||
} BtmHostDeviceProperty;
|
} BtmHostDeviceProperty;
|
||||||
|
|
||||||
/// DeviceCondition
|
/// BtmConnectedDevice
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 unk_x0[0x368]; ///< Unknown
|
BtdrvAddress address;
|
||||||
|
u8 pad[2];
|
||||||
|
u32 unk_x8;
|
||||||
|
char name[0x20];
|
||||||
|
u8 unk_x2C[0x1C];
|
||||||
|
u16 vid;
|
||||||
|
u16 pid;
|
||||||
|
u8 unk_x4C[0x20];
|
||||||
|
} BtmConnectedDevice;
|
||||||
|
|
||||||
|
/// DeviceCondition [1.0.0-5.0.2]
|
||||||
|
typedef struct {
|
||||||
|
u32 unk_x0;
|
||||||
|
u32 unk_x4;
|
||||||
|
u8 unk_x8;
|
||||||
|
u8 unk_x9;
|
||||||
|
u8 max_count;
|
||||||
|
u8 connected_count;
|
||||||
|
BtmConnectedDevice devices[8];
|
||||||
|
} BtmDeviceConditionV100;
|
||||||
|
|
||||||
|
/// DeviceCondition [5.1.0-7.0.1]
|
||||||
|
typedef struct {
|
||||||
|
u32 unk_x0;
|
||||||
|
u32 unk_x4;
|
||||||
|
u8 unk_x8;
|
||||||
|
u8 unk_x9[2];
|
||||||
|
u8 max_count;
|
||||||
|
u8 connected_count;
|
||||||
|
u8 pad[3];
|
||||||
|
BtmConnectedDevice devices[8];
|
||||||
|
} BtmDeviceConditionV510;
|
||||||
|
|
||||||
|
/// DeviceCondition [8.0.0-8.1.1]
|
||||||
|
typedef struct {
|
||||||
|
u32 unk_x0;
|
||||||
|
u32 unk_x4;
|
||||||
|
u8 unk_x8;
|
||||||
|
u8 unk_x9;
|
||||||
|
u8 max_count;
|
||||||
|
u8 connected_count;
|
||||||
|
BtmConnectedDevice devices[8];
|
||||||
|
} BtmDeviceConditionV800;
|
||||||
|
|
||||||
|
/// DeviceCondition [9.0.0+]
|
||||||
|
typedef struct {
|
||||||
|
u32 unk_x0;
|
||||||
|
u8 unk_x4;
|
||||||
|
u8 unk_x5;
|
||||||
|
u8 max_count;
|
||||||
|
u8 connected_count;
|
||||||
|
BtmConnectedDevice devices[8];
|
||||||
|
} BtmDeviceConditionV900;
|
||||||
|
|
||||||
|
/// DeviceCondition
|
||||||
|
typedef union {
|
||||||
|
BtmDeviceConditionV100 v100;
|
||||||
|
BtmDeviceConditionV510 v510;
|
||||||
|
BtmDeviceConditionV800 v800;
|
||||||
|
BtmDeviceConditionV900 v900;
|
||||||
} BtmDeviceCondition;
|
} BtmDeviceCondition;
|
||||||
|
|
||||||
/// DeviceSlotMode
|
/// DeviceSlotMode
|
||||||
|
@ -157,7 +157,12 @@ Result btmAcquireDeviceConditionEvent(Event* out_event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result btmGetDeviceCondition(BtmDeviceCondition *out) {
|
Result btmGetDeviceCondition(BtmDeviceCondition *out) {
|
||||||
return _btmCmdOutBufPtrFixed(out, sizeof(*out), 3);
|
size_t buff_size;
|
||||||
|
if (hosversionAtLeast(9,0,0)) buff_size = sizeof(BtmDeviceConditionV900);
|
||||||
|
else if (hosversionAtLeast(8,0,0)) buff_size = sizeof(BtmDeviceConditionV800);
|
||||||
|
else if (hosversionAtLeast(5,1,0)) buff_size = sizeof(BtmDeviceConditionV510);
|
||||||
|
else buff_size = sizeof(BtmDeviceConditionV100);
|
||||||
|
return _btmCmdOutBufPtrFixed(out, buff_size, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result btmSetBurstMode(BtdrvAddress addr, bool flag) {
|
Result btmSetBurstMode(BtdrvAddress addr, bool flag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user