|
|
|
@ -21,21 +21,10 @@ static int hid_listener_keycode_pressed(const struct zmk_keycode_state_changed *
@@ -21,21 +21,10 @@ static int hid_listener_keycode_pressed(const struct zmk_keycode_state_changed *
|
|
|
|
|
|
|
|
|
|
LOG_DBG("usage_page 0x%02X keycode 0x%02X implicit_mods 0x%02X explicit_mods 0x%02X", |
|
|
|
|
ev->usage_page, ev->keycode, ev->implicit_modifiers, ev->explicit_modifiers); |
|
|
|
|
switch (ev->usage_page) { |
|
|
|
|
case HID_USAGE_KEY: |
|
|
|
|
err = zmk_hid_keyboard_press(ev->keycode); |
|
|
|
|
if (err < 0) { |
|
|
|
|
LOG_ERR("Unable to press keycode"); |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case HID_USAGE_CONSUMER: |
|
|
|
|
err = zmk_hid_consumer_press(ev->keycode); |
|
|
|
|
if (err < 0) { |
|
|
|
|
LOG_ERR("Unable to press keycode"); |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
err = zmk_hid_press(ZMK_HID_USAGE(ev->usage_page, ev->keycode)); |
|
|
|
|
if (err < 0) { |
|
|
|
|
LOG_DBG("Unable to press keycode"); |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
explicit_mods_changed = zmk_hid_register_mods(ev->explicit_modifiers); |
|
|
|
|
implicit_mods_changed = zmk_hid_implicit_modifiers_press(ev->implicit_modifiers); |
|
|
|
@ -56,20 +45,10 @@ static int hid_listener_keycode_released(const struct zmk_keycode_state_changed
@@ -56,20 +45,10 @@ static int hid_listener_keycode_released(const struct zmk_keycode_state_changed
|
|
|
|
|
|
|
|
|
|
LOG_DBG("usage_page 0x%02X keycode 0x%02X implicit_mods 0x%02X explicit_mods 0x%02X", |
|
|
|
|
ev->usage_page, ev->keycode, ev->implicit_modifiers, ev->explicit_modifiers); |
|
|
|
|
switch (ev->usage_page) { |
|
|
|
|
case HID_USAGE_KEY: |
|
|
|
|
err = zmk_hid_keyboard_release(ev->keycode); |
|
|
|
|
if (err < 0) { |
|
|
|
|
LOG_ERR("Unable to release keycode"); |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case HID_USAGE_CONSUMER: |
|
|
|
|
err = zmk_hid_consumer_release(ev->keycode); |
|
|
|
|
if (err < 0) { |
|
|
|
|
LOG_ERR("Unable to release keycode"); |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
err = zmk_hid_release(ZMK_HID_USAGE(ev->usage_page, ev->keycode)); |
|
|
|
|
if (err < 0) { |
|
|
|
|
LOG_DBG("Unable to release keycode"); |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
explicit_mods_changed = zmk_hid_unregister_mods(ev->explicit_modifiers); |
|
|
|
|