Skip to content

Commit 9c2a9f8

Browse files
committed
Disable logging of keyboard commands.
1 parent b8638f1 commit 9c2a9f8

File tree

6 files changed

+38
-7
lines changed

6 files changed

+38
-7
lines changed

SerialPrograms/Source/Controllers/Controller.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,11 @@ class ControllerContext final : public CancellableScope{
218218
public:
219219
using ControllerType = Type;
220220

221+
221222
public:
223+
virtual ~ControllerContext(){
224+
detach();
225+
}
222226
ControllerContext(ControllerType& controller)
223227
: m_controller(controller)
224228
{}
@@ -233,10 +237,9 @@ class ControllerContext final : public CancellableScope{
233237
{
234238
attach(context);
235239
}
236-
virtual ~ControllerContext(){
237-
detach();
238-
}
239240

241+
242+
public:
240243
ControllerType* operator->(){
241244
m_lifetime_sanitizer.check_usage();
242245
return &m_controller;
@@ -245,6 +248,8 @@ class ControllerContext final : public CancellableScope{
245248
operator ControllerType&() const{ return m_controller; }
246249
ControllerType& controller() const{ return m_controller; }
247250

251+
252+
public:
248253
void wait_for_all_requests() const{
249254
auto scope = m_lifetime_sanitizer.check_scope();
250255
m_controller.wait_for_all(this);

SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_Routines_HID_Keyboard.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,21 @@ int register_message_converters_HID_Keyboard(){
2727
if (body.size() != sizeof(pabb_Message_Command_HID_Keyboard_State)){ ss << "(invalid size)" << std::endl; return ss.str(); }
2828
const auto* params = (const pabb_Message_Command_HID_Keyboard_State*)body.c_str();
2929
ss << "seqnum = " << (uint64_t)params->seqnum;
30+
ss << ", milliseconds = " << params->milliseconds;
3031

32+
// Do not log the contents of the command due to privacy concerns.
33+
// (people entering passwords)
34+
#if 0
3135
ss << std::hex;
3236
ss << ", 0x" << params->report.key[0];
3337
ss << ", 0x" << params->report.key[1];
3438
ss << ", 0x" << params->report.key[2];
3539
ss << ", 0x" << params->report.key[3];
3640
ss << ", 0x" << params->report.key[4];
3741
ss << ", 0x" << params->report.key[5];
38-
3942
ss << std::dec;
40-
ss << ", milliseconds = " << params->milliseconds;
43+
#endif
44+
4145
return ss.str();
4246
}
4347
);

SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_Routines_NS1_WirelessControllers.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ int register_message_converters_NS1_WirelessControllers(){
7272
const auto* params = (const pabb_Message_Command_NS1_WirelessController_Buttons*)body.c_str();
7373
ss << "seqnum = " << (uint64_t)params->seqnum;
7474
ss << ", milliseconds = " << params->milliseconds;
75+
76+
// Do not log the contents of the command due to privacy concerns.
77+
// (people entering passwords)
78+
7579
return ss.str();
7680
}
7781
);
@@ -88,6 +92,10 @@ int register_message_converters_NS1_WirelessControllers(){
8892
const auto* params = (const pabb_Message_Command_NS1_WirelessController_FullState*)body.c_str();
8993
ss << "seqnum = " << (uint64_t)params->seqnum;
9094
ss << ", milliseconds = " << params->milliseconds;
95+
96+
// Do not log the contents of the command due to privacy concerns.
97+
// (people entering passwords)
98+
9199
return ss.str();
92100
}
93101
);

SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_Routines_NS2_WiredController.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "Common/SerialPABotBase/SerialPABotBase_Messages_NS2_WiredController.h"
99
#include "ClientSource/Libraries/MessageConverter.h"
1010
#include "CommonFramework/GlobalSettingsPanel.h"
11-
#include "NintendoSwitch/Controllers/NintendoSwitch_ControllerButtons.h"
11+
//#include "NintendoSwitch/Controllers/NintendoSwitch_ControllerButtons.h"
1212

1313
namespace PokemonAutomation{
1414
namespace SerialPABotBase{
@@ -28,7 +28,9 @@ int register_message_converters_NS2_WiredController(){
2828
if (body.size() != sizeof(pabb_Message_Command_NS2_WiredController_State)){ ss << "(invalid size)" << std::endl; return ss.str(); }
2929
const auto* params = (const pabb_Message_Command_NS2_WiredController_State*)body.c_str();
3030
ss << "seqnum = " << (uint64_t)params->seqnum;
31+
ss << ", milliseconds = " << params->milliseconds;
3132

33+
#if 0
3234
uint32_t buttons = params->report.buttons0;
3335
buttons |= (uint32_t)params->report.buttons1 << 8;
3436
if (params->report.dpad_byte & 0x80){
@@ -39,7 +41,8 @@ int register_message_converters_NS2_WiredController(){
3941

4042
ss << ", LJ = (" << (int)params->report.left_joystick_x << "," << (int)params->report.left_joystick_y << ")";
4143
ss << ", RJ = (" << (int)params->report.right_joystick_x << "," << (int)params->report.right_joystick_y << ")";
42-
ss << ", milliseconds = " << params->milliseconds;
44+
#endif
45+
4346
return ss.str();
4447
}
4548
);

SerialPrograms/Source/Controllers/StandardHid/StandardHid_KeyboardWithScheduler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ void KeyboardControllerWithScheduler::issue_keys(
6262
}
6363
execute_schedule(cancellable, schedule);
6464
if (m_logging_throttler){
65+
// Do not log the contents of the command due to privacy concerns.
66+
// (people entering passwords)
6567
m_logger.log(
6668
"issue_keys(): "
6769
"delay = " + std::to_string(delay.count()) + "ms" +

SerialPrograms/Source/NintendoSwitch/Controllers/NintendoSwitch_ControllerWithScheduler.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ void ControllerWithScheduler::issue_full_controller_state(
238238
}
239239
execute_schedule(cancellable, schedule);
240240
if (m_logging_throttler){
241+
// Do not log the contents of the command due to privacy concerns.
242+
// (people entering passwords)
243+
#if 0
241244
m_logger.log(
242245
"issue_controller_state(): (" + button_to_string(button) +
243246
"), dpad(" + dpad_to_string(position) +
@@ -246,6 +249,12 @@ void ControllerWithScheduler::issue_full_controller_state(
246249
"), hold = " + std::to_string(hold.count()) + "ms",
247250
COLOR_DARKGREEN
248251
);
252+
#else
253+
m_logger.log(
254+
"issue_controller_state(): hold = " + std::to_string(hold.count()) + "ms",
255+
COLOR_DARKGREEN
256+
);
257+
#endif
249258
}
250259
}
251260

0 commit comments

Comments
 (0)