hidsys: Fixed cmd order. Fixed output size for hidsysGetUniquePadSerialNumber.

This commit is contained in:
yellows8 2019-10-20 02:35:30 -04:00
parent 26a0ee4af3
commit 0403c988ba
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 19 additions and 19 deletions

View File

@ -108,6 +108,14 @@ Result hidsysEnableAppletToGetInput(bool enable);
*/
Result hidsysGetUniquePadIds(u64 *UniquePadIds, s32 count, s32 *total_entries);
/**
* @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 0x11 bytes)
*/
Result hidsysGetUniquePadSerialNumber(u64 UniquePadId, char *serial);
/**
* @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.
@ -125,11 +133,3 @@ Result hidsysSetNotificationLedPattern(const HidsysNotificationLedPattern *patte
* @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)
*/
Result hidsysGetUniquePadSerialNumber(u64 UniquePadId, char *serial);

View File

@ -134,6 +134,17 @@ Result hidsysGetUniquePadIds(u64 *UniquePadIds, s32 count, s32 *total_entries) {
return rc;
}
Result hidsysGetUniquePadSerialNumber(u64 UniquePadId, char *serial) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
char out[0x10]={0};
if (serial) memset(serial, 0, 0x11);
Result rc = serviceDispatchInOut(&g_hidsysSrv, 809, UniquePadId, out);
if (R_SUCCEEDED(rc) && serial) memcpy(serial, out, 0x10);
return rc;
}
Result hidsysSetNotificationLedPattern(const HidsysNotificationLedPattern *pattern, u64 UniquePadId) {
if (hosversionBefore(7,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -158,14 +169,3 @@ Result hidsysSetNotificationLedPatternWithTimeout(const HidsysNotificationLedPat
return serviceDispatchIn(&g_hidsysSrv, 831, in);
}
Result hidsysGetUniquePadSerialNumber(u64 UniquePadId, char *serial) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
char out[0x18]={0};
if (serial) memset(serial, 0, 0x19);
Result rc = serviceDispatchInOut(&g_hidsysSrv, 809, UniquePadId, out);
if (R_SUCCEEDED(rc) && serial) memcpy(serial, out, 0x18);
return rc;
}