mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-05 16:09:24 +02:00
Added hidsysSetNotificationLedPattern and the struct for it.
This commit is contained in:
parent
d4789c37c9
commit
bed9213f41
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user