diff --git a/nx/include/switch/services/btdrv.h b/nx/include/switch/services/btdrv.h index 1a5d410c..5ed71fd9 100644 --- a/nx/include/switch/services/btdrv.h +++ b/nx/include/switch/services/btdrv.h @@ -20,7 +20,9 @@ typedef enum { /// HidEventType typedef enum { + BtdrvHidEventType_Unknown0 = 0, ///< Unknown. Only used with \ref btdrvGetHidEventInfo. BtdrvHidEventType_Unknown4 = 4, ///< Unknown. + BtdrvHidEventType_Unknown7 = 7, ///< Unknown. Only used with \ref btdrvGetHidEventInfo. BtdrvHidEventType_Unknown8 = 8, ///< Unknown. BtdrvHidEventType_Unknown9 = 9, ///< Unknown. } BtdrvHidEventType; @@ -250,6 +252,15 @@ Result btdrvGetAdapterProperty(BtdrvBluetoothPropertyType type, void* buffer, si */ Result btdrvSetAdapterProperty(BtdrvBluetoothPropertyType type, const void* buffer, size_t size); +/** + * @brief GetEventInfo + * @note This is used by btm-sysmodule. + * @param[out] buffer Output buffer. 0x400-bytes from state is written here. + * @param[in] size Output buffer size. + * @oaram[out] type Output EventType. + */ +Result btdrvGetEventInfo(void* buffer, size_t size, u32 *type); + /** * @brief WriteHidData * @param[in] addr \ref BtdrvAddress @@ -281,6 +292,15 @@ Result btdrvSetHidReport(BtdrvAddress addr, u32 type, BtdrvHidReport *buffer); */ Result btdrvGetHidReport(BtdrvAddress addr, u8 unk, u32 type); +/** + * @brief GetHidEventInfo + * @note This is used by btm-sysmodule. + * @param[out] buffer Output buffer. 0x480-bytes from state is written here. + * @param[in] size Output buffer size. + * @oaram[out] type \ref BtdrvHidEventType, always ::BtdrvHidEventType_Unknown0 or ::BtdrvHidEventType_Unknown7. + */ +Result btdrvGetHidEventInfo(void* buffer, size_t size, BtdrvHidEventType *type); + /** * @brief RegisterHidReportEvent * @note This also does sharedmem init/handling if needed, on [7.0.0+]. diff --git a/nx/source/services/btdrv.c b/nx/source/services/btdrv.c index 631e9231..df1af9f4 100644 --- a/nx/source/services/btdrv.c +++ b/nx/source/services/btdrv.c @@ -119,6 +119,10 @@ Result btdrvSetAdapterProperty(BtdrvBluetoothPropertyType type, const void* buff ); } +Result btdrvGetEventInfo(void* buffer, size_t size, u32 *type) { + return _btdrvCmdOutU32OutBuf(buffer, size, type, 15); +} + Result btdrvWriteHidData(BtdrvAddress addr, BtdrvHidReport *buffer) { size_t size = hosversionBefore(9,0,0) ? sizeof(BtdrvHidData) : sizeof(BtdrvHidReport); return serviceDispatchIn(&g_btdrvSrv, 19, addr, @@ -159,6 +163,13 @@ Result btdrvGetHidReport(BtdrvAddress addr, u8 unk, u32 type) { return serviceDispatchIn(&g_btdrvSrv, 22, in); } +Result btdrvGetHidEventInfo(void* buffer, size_t size, BtdrvHidEventType *type) { + u32 tmp=0; + Result rc = _btdrvCmdOutU32OutBuf(buffer, size, &tmp, 27); + if (R_SUCCEEDED(rc) && type) *type = tmp; + return rc; +} + Result btdrvRegisterHidReportEvent(Event* out_event) { Result rc=0; Handle tmphandle=0;