diff options
Diffstat (limited to 'rust/qmk-hid-com/src_c/src/main.c')
-rw-r--r-- | rust/qmk-hid-com/src_c/src/main.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/rust/qmk-hid-com/src_c/src/main.c b/rust/qmk-hid-com/src_c/src/main.c new file mode 100644 index 0000000..48d490e --- /dev/null +++ b/rust/qmk-hid-com/src_c/src/main.c @@ -0,0 +1,28 @@ +#include <stdlib.h> + +#include "error.h" +#include "hid/hid.h" +#include "keyboard/keyboard.h" + +int main(int argc, const char *argv[]) { + if (argc != 3) { + fail("Usage: %s <usage> <usage_page>", argv[0]); + } + + char *ep; + uint32_t usage = (uint32_t)strtoul(argv[1], &ep, 0); + if (*ep != 0) { + fail("Invalid usage: %x", usage); + } + + uint32_t usage_page = (uint32_t)strtoul(argv[2], &ep, 0); + if (*ep != 0) { + fail("Invalid usage: %x", usage_page); + } + + uint32_t key_value = read_next(usage, usage_page); + + struct qmk_unicode_type qmk_unicode_type = init_qmk_unicode(); + type_keycode(&qmk_unicode_type, key_value); + destroy_qmk_unicode(qmk_unicode_type); +} |