Cleaning out prototype traces
This commit is contained in:
parent
e2b97f1127
commit
a339a9a082
4 changed files with 4 additions and 28 deletions
|
@ -106,7 +106,7 @@ static int send_consumer_report() {
|
||||||
|
|
||||||
switch (current_endpoint) {
|
switch (current_endpoint) {
|
||||||
#if IS_ENABLED(CONFIG_ZMK_USB)
|
#if IS_ENABLED(CONFIG_ZMK_USB)
|
||||||
case ZMK_ENDPOINT_USB: {
|
case ZMK_ENDPOINT_USB: {
|
||||||
int err = zmk_usb_hid_send_report((uint8_t *)consumer_report, sizeof(*consumer_report));
|
int err = zmk_usb_hid_send_report((uint8_t *)consumer_report, sizeof(*consumer_report));
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("FAILED TO SEND OVER USB: %d", err);
|
LOG_ERR("FAILED TO SEND OVER USB: %d", err);
|
||||||
|
@ -116,7 +116,7 @@ static int send_consumer_report() {
|
||||||
#endif /* IS_ENABLED(CONFIG_ZMK_USB) */
|
#endif /* IS_ENABLED(CONFIG_ZMK_USB) */
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_BLE)
|
#if IS_ENABLED(CONFIG_ZMK_BLE)
|
||||||
case ZMK_ENDPOINT_BLE: {
|
case ZMK_ENDPOINT_BLE: {
|
||||||
int err = zmk_hog_send_consumer_report(&consumer_report->body);
|
int err = zmk_hog_send_consumer_report(&consumer_report->body);
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("FAILED TO SEND OVER HOG: %d", err);
|
LOG_ERR("FAILED TO SEND OVER HOG: %d", err);
|
||||||
|
@ -264,7 +264,6 @@ static void disconnect_current_endpoint() {
|
||||||
|
|
||||||
zmk_endpoints_send_report(HID_USAGE_KEY);
|
zmk_endpoints_send_report(HID_USAGE_KEY);
|
||||||
zmk_endpoints_send_report(HID_USAGE_CONSUMER);
|
zmk_endpoints_send_report(HID_USAGE_CONSUMER);
|
||||||
zmk_endpoints_send_report(HID_USAGE_GD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_current_endpoint() {
|
static void update_current_endpoint() {
|
||||||
|
|
|
@ -16,7 +16,7 @@ static struct zmk_hid_keyboard_report keyboard_report = {
|
||||||
static struct zmk_hid_consumer_report consumer_report = {.report_id = 2, .body = {.keys = {0}}};
|
static struct zmk_hid_consumer_report consumer_report = {.report_id = 2, .body = {.keys = {0}}};
|
||||||
|
|
||||||
static struct zmk_hid_mouse_report mouse_report = {.report_id = 4, .body = {
|
static struct zmk_hid_mouse_report mouse_report = {.report_id = 4, .body = {
|
||||||
.buttons = 0, .x = 0, .y = 0, .wheel_hor = 0, .wheel_vert = 0}};
|
.buttons = 0, .x = 0, .y = 0, .wheel_vert = 0, .wheel_hor = 0}};
|
||||||
|
|
||||||
// Keep track of how often a modifier was pressed.
|
// Keep track of how often a modifier was pressed.
|
||||||
// Only release the modifier if the count is 0.
|
// Only release the modifier if the count is 0.
|
||||||
|
|
|
@ -37,13 +37,6 @@ static int hid_listener_keycode_pressed(const struct zmk_keycode_state_changed *
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HID_USAGE_GD:
|
|
||||||
err = zmk_hid_mouse_buttons_press(ev->keycode);
|
|
||||||
if (err) {
|
|
||||||
LOG_ERR("Unable to press button");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
explicit_mods_changed = zmk_hid_register_mods(ev->explicit_modifiers);
|
explicit_mods_changed = zmk_hid_register_mods(ev->explicit_modifiers);
|
||||||
implicit_mods_changed = zmk_hid_implicit_modifiers_press(ev->implicit_modifiers);
|
implicit_mods_changed = zmk_hid_implicit_modifiers_press(ev->implicit_modifiers);
|
||||||
|
@ -78,14 +71,6 @@ static int hid_listener_keycode_released(const struct zmk_keycode_state_changed
|
||||||
LOG_ERR("Unable to release keycode");
|
LOG_ERR("Unable to release keycode");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case HID_USAGE_GD:
|
|
||||||
err = zmk_hid_mouse_buttons_release(ev->keycode);
|
|
||||||
if (err) {
|
|
||||||
LOG_ERR("Unable to release button");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit_mods_changed = zmk_hid_unregister_mods(ev->explicit_modifiers);
|
explicit_mods_changed = zmk_hid_unregister_mods(ev->explicit_modifiers);
|
||||||
|
|
|
@ -187,8 +187,6 @@ K_MSGQ_DEFINE(zmk_hog_keyboard_msgq, sizeof(struct zmk_hid_keyboard_report_body)
|
||||||
void send_keyboard_report_callback(struct k_work *work) {
|
void send_keyboard_report_callback(struct k_work *work) {
|
||||||
struct zmk_hid_keyboard_report_body report;
|
struct zmk_hid_keyboard_report_body report;
|
||||||
|
|
||||||
LOG_ERR("Sending keyboard callback");
|
|
||||||
|
|
||||||
while (k_msgq_get(&zmk_hog_keyboard_msgq, &report, K_NO_WAIT) == 0) {
|
while (k_msgq_get(&zmk_hog_keyboard_msgq, &report, K_NO_WAIT) == 0) {
|
||||||
struct bt_conn *conn = destination_connection();
|
struct bt_conn *conn = destination_connection();
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
|
@ -214,7 +212,6 @@ K_WORK_DEFINE(hog_keyboard_work, send_keyboard_report_callback);
|
||||||
|
|
||||||
int zmk_hog_send_keyboard_report(struct zmk_hid_keyboard_report_body *report) {
|
int zmk_hog_send_keyboard_report(struct zmk_hid_keyboard_report_body *report) {
|
||||||
int err = k_msgq_put(&zmk_hog_keyboard_msgq, report, K_MSEC(100));
|
int err = k_msgq_put(&zmk_hog_keyboard_msgq, report, K_MSEC(100));
|
||||||
LOG_ERR("Sending keyboard report");
|
|
||||||
if (err) {
|
if (err) {
|
||||||
switch (err) {
|
switch (err) {
|
||||||
case -EAGAIN: {
|
case -EAGAIN: {
|
||||||
|
@ -285,14 +282,10 @@ int zmk_hog_send_consumer_report(struct zmk_hid_consumer_report_body *report) {
|
||||||
};
|
};
|
||||||
|
|
||||||
K_MSGQ_DEFINE(zmk_hog_mouse_msgq, sizeof(struct zmk_hid_mouse_report_body),
|
K_MSGQ_DEFINE(zmk_hog_mouse_msgq, sizeof(struct zmk_hid_mouse_report_body),
|
||||||
CONFIG_ZMK_BLE_MOUSE_REPORT_QUEUE_SIZE, 4);
|
CONFIG_ZMK_BLE_MOUSE_REPORT_QUEUE_SIZE, 4);
|
||||||
|
|
||||||
|
|
||||||
void send_mouse_report_callback(struct k_work *work) {
|
void send_mouse_report_callback(struct k_work *work) {
|
||||||
struct zmk_hid_mouse_report_body report;
|
struct zmk_hid_mouse_report_body report;
|
||||||
|
|
||||||
LOG_ERR("Sending mouse callback");
|
|
||||||
|
|
||||||
while (k_msgq_get(&zmk_hog_mouse_msgq, &report, K_NO_WAIT) == 0) {
|
while (k_msgq_get(&zmk_hog_mouse_msgq, &report, K_NO_WAIT) == 0) {
|
||||||
struct bt_conn *conn = destination_connection();
|
struct bt_conn *conn = destination_connection();
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
|
@ -318,7 +311,6 @@ K_WORK_DEFINE(hog_mouse_work, send_mouse_report_callback);
|
||||||
|
|
||||||
int zmk_hog_send_mouse_report(struct zmk_hid_mouse_report_body *report) {
|
int zmk_hog_send_mouse_report(struct zmk_hid_mouse_report_body *report) {
|
||||||
int err = k_msgq_put(&zmk_hog_mouse_msgq, report, K_MSEC(100));
|
int err = k_msgq_put(&zmk_hog_mouse_msgq, report, K_MSEC(100));
|
||||||
LOG_ERR("Sending mouse report");
|
|
||||||
if (err) {
|
if (err) {
|
||||||
switch (err) {
|
switch (err) {
|
||||||
case -EAGAIN: {
|
case -EAGAIN: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue