From 527b813bcfa0b3cd43e526d0b34eb156addc6366 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sat, 28 Nov 2020 12:31:28 -0500 Subject: [PATCH] notif: Use hidLaShowControllerFirmwareUpdate if needed. --- nx/include/switch/services/notif.h | 3 ++- nx/source/services/notif.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/nx/include/switch/services/notif.h b/nx/include/switch/services/notif.h index b691764b..210c6001 100644 --- a/nx/include/switch/services/notif.h +++ b/nx/include/switch/services/notif.h @@ -44,7 +44,7 @@ typedef struct { /// Maximum alarms that can be registered at the same time by the host Application. #define NOTIF_MAX_ALARMS 8 -/// Initialize notif. Only available on [9.0.0+]. Note that using Alarms also requires the [9.0.0+] firmware update for controllers to be installed. +/// Initialize notif. Only available on [9.0.0+]. Result notifInitialize(NotifServiceType service_type); /// Exit notif. @@ -116,6 +116,7 @@ Result notifAlarmSettingDisable(NotifAlarmSetting *alarm_setting, u32 day_of_wee /** * @brief Registers the specified AlarmSetting. * @note See \ref NOTIF_MAX_ALARMS for the maximum alarms. + * @note When indicated by the output from \ref hidIsFirmwareUpdateNeededForNotification, this will use \ref hidLaShowControllerFirmwareUpdate. * @param[out] alarm_setting_id AlarmSettingId * @param[in] alarm_setting \ref NotifAlarmSetting * @param[in] buffer Input buffer containing the ApplicationParameter. Optional, can be NULL. diff --git a/nx/source/services/notif.c b/nx/source/services/notif.c index d4ab7f29..58264cf7 100644 --- a/nx/source/services/notif.c +++ b/nx/source/services/notif.c @@ -1,6 +1,8 @@ #include #include "service_guard.h" +#include "services/hid.h" #include "services/notif.h" +#include "applets/hid_la.h" #include "runtime/hosversion.h" @@ -108,6 +110,12 @@ Result notifAlarmSettingDisable(NotifAlarmSetting *alarm_setting, u32 day_of_wee } Result notifRegisterAlarmSetting(u16 *alarm_setting_id, const NotifAlarmSetting *alarm_setting, const void* buffer, size_t size) { + Result rc=0; + bool flag=0; + HidLaControllerFirmwareUpdateArg arg={.enable_force_update = 1}; + rc = hidIsFirmwareUpdateNeededForNotification(&flag); + if (R_SUCCEEDED(rc) && flag) hidLaShowControllerFirmwareUpdate(&arg); + serviceAssumeDomain(&g_notifSrv); return serviceDispatchOut(&g_notifSrv, 500, *alarm_setting_id, .buffer_attrs = {