From a774fb81cc487e1dd8f55a924f62bfce7045dc54 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sat, 19 Oct 2019 19:51:51 -0400 Subject: [PATCH] Added hidsysSetNotificationLedPatternWithTimeout. Updated docs with sysver requirements which were previously missing. --- nx/include/switch/services/hidsys.h | 12 ++++++++++++ nx/source/services/hidsys.c | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/nx/include/switch/services/hidsys.h b/nx/include/switch/services/hidsys.h index 5f2a06de..6da6b5e2 100644 --- a/nx/include/switch/services/hidsys.h +++ b/nx/include/switch/services/hidsys.h @@ -110,13 +110,25 @@ Result hidsysGetUniquePadIds(u64 *UniquePadIds, s32 count, s32 *total_entries); /** * @brief Sets the HOME-button notification LED pattern, for the specified controller. + * @note Generally this should only be used if \ref hidsysSetNotificationLedPatternWithTimeout is not usable. + * @note Only available on [7.0.0+]. * @param pattern \ref HidsysNotificationLedPattern * @param UniquePadId UniquePadId for the controller. */ Result hidsysSetNotificationLedPattern(const HidsysNotificationLedPattern *pattern, u64 UniquePadId); +/** + * @brief Sets the HOME-button notification LED pattern, for the specified controller. The LED will automatically be disabled once the specified timeout occurs. + * @note Only available on [9.0.0+], and with controllers which have the [9.0.0+] firmware installed. + * @param[in] pattern \ref HidsysNotificationLedPattern + * @param[in] UniquePadId UniquePadId for the controller. + * @param[in] timeout Timeout in nanoseconds. + */ +Result hidsysSetNotificationLedPatternWithTimeout(const HidsysNotificationLedPattern *pattern, u64 UniquePadId, u64 timeout); + /** * @brief Gets the unique pad's serial number. + * @note Only available on [5.0.0+]. * @param UniquePadId UniquePadId for the controller. * @param serial Pointer to output the serial to. (The buffer size needs to be at least 0x19 bytes) */ diff --git a/nx/source/services/hidsys.c b/nx/source/services/hidsys.c index dd62a932..79315b4a 100644 --- a/nx/source/services/hidsys.c +++ b/nx/source/services/hidsys.c @@ -146,6 +146,19 @@ Result hidsysSetNotificationLedPattern(const HidsysNotificationLedPattern *patte return serviceDispatchIn(&g_hidsysSrv, 830, in); } +Result hidsysSetNotificationLedPatternWithTimeout(const HidsysNotificationLedPattern *pattern, u64 UniquePadId, u64 timeout) { + if (hosversionBefore(9,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + const struct { + HidsysNotificationLedPattern pattern; + u64 UniquePadId; + u64 timeout; + } in = { *pattern, UniquePadId, timeout }; + + return serviceDispatchIn(&g_hidsysSrv, 831, in); +} + Result hidsysGetUniquePadSerialNumber(u64 UniquePadId, char *serial) { if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);