Replace ukbhit by kbd_enter_pressed, not requiring tcgetattr:

Note that it behaves differently now
* it looks for Enter key only, not any key
* it "eats" the input, no need for (void)getchar() after it
* it works the same no matter the value of ICANON
* the mingw version has been adapted to act the similarly

This should fix its usage on Android where tcgetattr always returns -1
This commit is contained in:
Philippe Teuwen 2019-07-11 13:01:34 +02:00
commit 844d732297
27 changed files with 90 additions and 126 deletions

View file

@ -544,9 +544,7 @@ static int CmdEM410xBrute(const char *Cmd) {
char testuid[11];
testuid[10] = 0;
if (ukbhit()) {
int gc = getchar();
(void)gc;
if (kbd_enter_pressed()) {
PrintAndLogEx(WARNING, "\nAborted via keyboard!\n");
free(uidBlock);
return PM3_EOPABORTED;
@ -580,9 +578,7 @@ static int CmdEM410xBrute(const char *Cmd) {
static int CmdEM410xWatch(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
do {
if (ukbhit()) {
int gc = getchar();
(void)gc;
if (kbd_enter_pressed()) {
PrintAndLogEx(WARNING, "\naborted via keyboard!\n");
break;
}