to into account button swap
This commit is contained in:
parent
931672c665
commit
144ac21a4f
|
@ -435,6 +435,26 @@ void hid_task(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void past_credentials(bool user)
|
||||||
|
{
|
||||||
|
if (!credentials || 0 == strlen(username) || 0 == strlen(password)) {
|
||||||
|
printf("no credentials to paste\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
user_paste = 0;
|
||||||
|
pass_paste = 0;
|
||||||
|
pasted_when = board_millis();
|
||||||
|
|
||||||
|
if (user) {
|
||||||
|
send_hid_report(username[user_paste++]);
|
||||||
|
printf("pasting username and password\r\n");
|
||||||
|
} else {
|
||||||
|
send_hid_report(password[pass_paste++]);
|
||||||
|
printf("pasting password\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void button_task(void)
|
void button_task(void)
|
||||||
{
|
{
|
||||||
static uint32_t button1_ms = 0; // when the button has been pressed (in ms)
|
static uint32_t button1_ms = 0; // when the button has been pressed (in ms)
|
||||||
|
@ -485,25 +505,9 @@ void button_task(void)
|
||||||
printf("clearing credentials\r\n");
|
printf("clearing credentials\r\n");
|
||||||
}
|
}
|
||||||
} else if (!button1_pressed && button1_ok && !button2_ok) { // button 1 released
|
} else if (!button1_pressed && button1_ok && !button2_ok) { // button 1 released
|
||||||
if (!credentials) {
|
past_credentials(!config.button_swap);
|
||||||
printf("no credentials saved\r\n");
|
|
||||||
} else {
|
|
||||||
user_paste = 0;
|
|
||||||
pass_paste = 0;
|
|
||||||
pasted_when = board_millis();
|
|
||||||
send_hid_report(username[user_paste++]);
|
|
||||||
printf("pasting username and password\r\n");
|
|
||||||
}
|
|
||||||
} else if (!button2_pressed && !button1_ok && button2_ok) { // button 2 released
|
} else if (!button2_pressed && !button1_ok && button2_ok) { // button 2 released
|
||||||
if (!credentials) {
|
past_credentials(config.button_swap);
|
||||||
printf("no credentials saved\r\n");
|
|
||||||
} else {
|
|
||||||
user_paste = 0;
|
|
||||||
pass_paste = 0;
|
|
||||||
pasted_when = board_millis();
|
|
||||||
send_hid_report(password[pass_paste++]);
|
|
||||||
printf("pasting password\r\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear button state
|
// clear button state
|
||||||
|
|
Loading…
Reference in New Issue