Added hidsysSetNotificationLedPattern and the struct for it.

This commit is contained in:
yellows8 2019-04-25 19:27:45 -04:00
parent d4789c37c9
commit bed9213f41
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 52 additions and 0 deletions

View File

@ -9,6 +9,11 @@
#include "../services/hid.h"
#include "../services/sm.h"
/// Structure for \ref hidsysSetNotificationLedPattern.
typedef struct {
u8 unk_x0[0x48]; ///< TODO
} HidsysNotificationLedPattern;
Result hidsysInitialize(void);
void hidsysExit(void);
@ -41,3 +46,10 @@ Result hidsysGetUniquePadsFromNpad(HidControllerID id, u64 *UniquePadIds, size_t
*/
Result hidsysGetUniquePadIds(u64 *UniquePadIds, size_t count, size_t *total_entries);
/**
* @brief Sets the HOME-button notification LED pattern, for the specified controller.
* @param pattern \ref HidsysNotificationLedPattern
* @param UniquePadId UniquePadId for the controller.
*/
Result hidsysSetNotificationLedPattern(HidsysNotificationLedPattern *pattern, u64 UniquePadId);

View File

@ -261,3 +261,43 @@ Result hidsysGetUniquePadIds(u64 *UniquePadIds, size_t count, size_t *total_entr
return rc;
}
Result hidsysSetNotificationLedPattern(HidsysNotificationLedPattern *pattern, u64 UniquePadId) {
if (hosversionBefore(7,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
Result rc;
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
HidsysNotificationLedPattern pattern;
u64 UniquePadId;
} *raw;
raw = serviceIpcPrepareHeader(&g_hidsysSrv, &c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 830;
memcpy(&raw->pattern, pattern, sizeof(*pattern));
raw->UniquePadId = UniquePadId;
rc = serviceIpcDispatch(&g_hidsysSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
struct {
u64 magic;
u64 result;
u64 total_entries;
} *resp;
serviceIpcParse(&g_hidsysSrv, &r, sizeof(*resp));
resp = r.Raw;
}
return rc;
}