From 695da184733eace6bc97d6b4fef02f12483a533a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sun, 11 Apr 2021 17:13:26 +0200 Subject: [PATCH] Make CLI Wakeup work for PS5 --- cli/src/wakeup.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cli/src/wakeup.c b/cli/src/wakeup.c index cf5ab45..cea2792 100644 --- a/cli/src/wakeup.c +++ b/cli/src/wakeup.c @@ -11,10 +11,14 @@ static char doc[] = "Send a PS4 wakeup packet."; #define ARG_KEY_HOST 'h' #define ARG_KEY_REGISTKEY 'r' +#define ARG_KEY_PS4 '4' +#define ARG_KEY_PS5 '5' static struct argp_option options[] = { { "host", ARG_KEY_HOST, "Host", 0, "Host to send wakeup packet to", 0 }, - { "registkey", ARG_KEY_REGISTKEY, "RegistKey", 0, "PS4 registration key", 0 }, + { "registkey", ARG_KEY_REGISTKEY, "RegistKey", 0, "Remote Play registration key (plaintext)", 0 }, + { "ps4", ARG_KEY_PS4, NULL, 0, "PlayStation 4", 0 }, + { "ps5", ARG_KEY_PS5, NULL, 0, "PlayStation 5 (default)", 0 }, { 0 } }; @@ -22,6 +26,7 @@ typedef struct arguments { const char *host; const char *registkey; + bool ps5; } Arguments; static int parse_opt(int key, char *arg, struct argp_state *state) @@ -39,6 +44,12 @@ static int parse_opt(int key, char *arg, struct argp_state *state) case ARGP_KEY_ARG: argp_usage(state); break; + case ARG_KEY_PS4: + arguments->ps5 = false; + break; + case ARG_KEY_PS5: + arguments->ps5 = true; + break; default: return ARGP_ERR_UNKNOWN; } @@ -51,6 +62,7 @@ static struct argp argp = { options, parse_opt, 0, doc, 0, 0, 0 }; CHIAKI_EXPORT int chiaki_cli_cmd_wakeup(ChiakiLog *log, int argc, char *argv[]) { Arguments arguments = { 0 }; + arguments.ps5 = true; error_t argp_r = argp_parse(&argp, argc, argv, ARGP_IN_ORDER, NULL, &arguments); if(argp_r != 0) return 1; @@ -73,5 +85,5 @@ CHIAKI_EXPORT int chiaki_cli_cmd_wakeup(ChiakiLog *log, int argc, char *argv[]) uint64_t credential = (uint64_t)strtoull(arguments.registkey, NULL, 16); - return chiaki_discovery_wakeup(log, NULL, arguments.host, credential, false); + return chiaki_discovery_wakeup(log, NULL, arguments.host, credential, arguments.ps5); } -- 2.38.5