btm: update BtmDeviceInfo for 13.0.0

This commit is contained in:
ndeadly 2021-09-24 01:12:01 +02:00
parent 459a5c2125
commit 7c667c4dbf
3 changed files with 27 additions and 6 deletions

View File

@ -96,11 +96,11 @@ Result btmLegacyGetDeviceInfo(BtmDeviceInfoList *out);
/** /**
* @brief GetDeviceInfo [13.0.0+] * @brief GetDeviceInfo [13.0.0+]
* @param[in] id Id * @param[in] id Id
* @param[out] out \ref BtmDeviceInfo * @param[out] out \ref BtmDeviceInfoV13
* @param[in] count Size of the out array in entries. * @param[in] count Size of the out array in entries.
* @param[out] total_out Total output entries. * @param[out] total_out Total output entries.
*/ */
Result btmGetDeviceInfo(u32 id, BtmDeviceInfo *out, size_t count, s32 *total_out); Result btmGetDeviceInfo(u32 id, BtmDeviceInfoV13 *out, size_t count, s32 *total_out);
/** /**
* @brief AddDeviceInfo * @brief AddDeviceInfo

View File

@ -190,7 +190,7 @@ typedef struct {
BtmDeviceSlotMode devices[8]; ///< Array of \ref BtmDeviceSlotMode with the above count. BtmDeviceSlotMode devices[8]; ///< Array of \ref BtmDeviceSlotMode with the above count.
} BtmDeviceSlotModeList; } BtmDeviceSlotModeList;
/// DeviceInfo /// DeviceInfo [1.0.0-12.1.0]
typedef struct { typedef struct {
BtdrvAddress addr; ///< \ref BtdrvAddress BtdrvAddress addr; ///< \ref BtdrvAddress
BtmClassOfDevice class_of_device; ///< ClassOfDevice BtmClassOfDevice class_of_device; ///< ClassOfDevice
@ -203,13 +203,34 @@ typedef struct {
BtmHidDeviceInfo hid_device_info; ///< \ref BtmHidDeviceInfo (Profile = Hid) BtmHidDeviceInfo hid_device_info; ///< \ref BtmHidDeviceInfo (Profile = Hid)
} profile_info; } profile_info;
u8 reserved2[0x1C]; ///< Reserved u8 reserved2[0x1C]; ///< Reserved
} BtmDeviceInfoV1;
/// DeviceInfo [13.0.0+]
typedef struct {
BtdrvAddress addr; ///< \ref BtdrvAddress
BtmClassOfDevice class_of_device; ///< ClassOfDevice
BtmLinkKey link_key; ///< LinkKey
u8 reserved[3]; ///< Reserved
u32 profile; ///< \ref BtmProfile
union {
u8 data[0x4]; ///< Empty (Profile = None)
BtmHidDeviceInfo hid_device_info; ///< \ref BtmHidDeviceInfo (Profile = Hid)
} profile_info;
u8 reserved2[0x1C]; ///< Reserved
char name[0xFC]; ///< Name
} BtmDeviceInfoV13;
/// DeviceInfo [1.0.0-13.0.0]
typedef union {
BtmDeviceInfoV1 v1;
BtmDeviceInfoV13 v13;
} BtmDeviceInfo; } BtmDeviceInfo;
/// DeviceInfoList /// DeviceInfoList
typedef struct { typedef struct {
u8 device_count; ///< DeviceCount u8 device_count; ///< DeviceCount
u8 reserved[3]; ///< Reserved u8 reserved[3]; ///< Reserved
BtmDeviceInfo devices[10]; ///< Array of \ref BtmDeviceInfo with the above count. BtmDeviceInfoV1 devices[10]; ///< Array of \ref BtmDeviceInfoV1 with the above count.
} BtmDeviceInfoList; } BtmDeviceInfoList;
/// DeviceProperty /// DeviceProperty

View File

@ -215,11 +215,11 @@ Result btmLegacyGetDeviceInfo(BtmDeviceInfoList *out) {
return _btmCmdOutBufPtrFixed(out, sizeof(*out), 9); return _btmCmdOutBufPtrFixed(out, sizeof(*out), 9);
} }
Result btmGetDeviceInfo(u32 id, BtmDeviceInfo *out, size_t count, s32 *total_out) { Result btmGetDeviceInfo(u32 id, BtmDeviceInfoV13 *out, size_t count, s32 *total_out) {
if (hosversionBefore(13,0,0)) if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmCmdInIdOutBufPtr(id, out, sizeof(BtmDeviceInfo)*count, total_out, 9); return _btmCmdInIdOutBufPtr(id, out, sizeof(BtmDeviceInfoV13)*count, total_out, 9);
} }
Result btmAddDeviceInfo(const BtmDeviceInfo *info) { Result btmAddDeviceInfo(const BtmDeviceInfo *info) {