Skip to content

Commit 695da18

Browse files
committed
Make CLI Wakeup work for PS5
1 parent 7870a28 commit 695da18

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

cli/src/wakeup.c

+14-2
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@ static char doc[] = "Send a PS4 wakeup packet.";
1111

1212
#define ARG_KEY_HOST 'h'
1313
#define ARG_KEY_REGISTKEY 'r'
14+
#define ARG_KEY_PS4 '4'
15+
#define ARG_KEY_PS5 '5'
1416

1517
static struct argp_option options[] = {
1618
{ "host", ARG_KEY_HOST, "Host", 0, "Host to send wakeup packet to", 0 },
17-
{ "registkey", ARG_KEY_REGISTKEY, "RegistKey", 0, "PS4 registration key", 0 },
19+
{ "registkey", ARG_KEY_REGISTKEY, "RegistKey", 0, "Remote Play registration key (plaintext)", 0 },
20+
{ "ps4", ARG_KEY_PS4, NULL, 0, "PlayStation 4", 0 },
21+
{ "ps5", ARG_KEY_PS5, NULL, 0, "PlayStation 5 (default)", 0 },
1822
{ 0 }
1923
};
2024

2125
typedef struct arguments
2226
{
2327
const char *host;
2428
const char *registkey;
29+
bool ps5;
2530
} Arguments;
2631

2732
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)
3944
case ARGP_KEY_ARG:
4045
argp_usage(state);
4146
break;
47+
case ARG_KEY_PS4:
48+
arguments->ps5 = false;
49+
break;
50+
case ARG_KEY_PS5:
51+
arguments->ps5 = true;
52+
break;
4253
default:
4354
return ARGP_ERR_UNKNOWN;
4455
}
@@ -51,6 +62,7 @@ static struct argp argp = { options, parse_opt, 0, doc, 0, 0, 0 };
5162
CHIAKI_EXPORT int chiaki_cli_cmd_wakeup(ChiakiLog *log, int argc, char *argv[])
5263
{
5364
Arguments arguments = { 0 };
65+
arguments.ps5 = true;
5466
error_t argp_r = argp_parse(&argp, argc, argv, ARGP_IN_ORDER, NULL, &arguments);
5567
if(argp_r != 0)
5668
return 1;
@@ -73,5 +85,5 @@ CHIAKI_EXPORT int chiaki_cli_cmd_wakeup(ChiakiLog *log, int argc, char *argv[])
7385

7486
uint64_t credential = (uint64_t)strtoull(arguments.registkey, NULL, 16);
7587

76-
return chiaki_discovery_wakeup(log, NULL, arguments.host, credential, false);
88+
return chiaki_discovery_wakeup(log, NULL, arguments.host, credential, arguments.ps5);
7789
}

0 commit comments

Comments
 (0)