console_key_logger.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. Copyright 2018-2022 Eric Gebhart <e.a.gebhart@gmail.com>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #if defined( CONSOLE_ENABLE) && defined(CONSOLE_KEY_LOGGER_ENABLE)
  15. #include USERSPACE_H
  16. #include "print.h"
  17. #include "console_key_logger.h"
  18. void process_console_key_logger(uint16_t keycode, keyrecord_t *record) {
  19. if (record->event.pressed) {
  20. uprintf("0x%04X,%u,%u,%u,%b,0x%02X,0x%02X,%u\n",
  21. keycode,
  22. record->event.key.row,
  23. record->event.key.col,
  24. get_highest_layer(layer_state),
  25. record->event.pressed,
  26. get_mods(),
  27. get_oneshot_mods(),
  28. record->tap.count
  29. );
  30. }
  31. }
  32. #endif