diff options
author | Peter Johanson <[email protected]> | 2024-09-25 16:31:23 -0600 |
---|---|---|
committer | Pete Johanson <[email protected]> | 2024-09-25 17:46:50 -0600 |
commit | 5d4b6df6a7d5bc29675d016d63e0bef899f29a99 (patch) | |
tree | 3b30cae75f969a2b5aaa128b79e54699f2a15e14 | |
parent | 21e1b2acad171536923777433f08fb8313eaab7f (diff) | |
download | zmk-5d4b6df6a7d5bc29675d016d63e0bef899f29a99.tar.gz zmk-5d4b6df6a7d5bc29675d016d63e0bef899f29a99.zip |
feat(studio): Log entry into all RPC.
-rw-r--r-- | app/src/studio/behavior_subsystem.c | 4 | ||||
-rw-r--r-- | app/src/studio/core_subsystem.c | 3 | ||||
-rw-r--r-- | app/src/studio/keymap_subsystem.c | 12 |
3 files changed, 18 insertions, 1 deletions
diff --git a/app/src/studio/behavior_subsystem.c b/app/src/studio/behavior_subsystem.c index b8d1ef1d67..96c1f236e6 100644 --- a/app/src/studio/behavior_subsystem.c +++ b/app/src/studio/behavior_subsystem.c @@ -33,6 +33,7 @@ static bool encode_behavior_summaries(pb_ostream_t *stream, const pb_field_t *fi } zmk_studio_Response list_all_behaviors(const zmk_studio_Request *req) { + LOG_DBG(""); zmk_behaviors_ListAllBehaviorsResponse beh_resp = zmk_behaviors_ListAllBehaviorsResponse_init_zero; beh_resp.behaviors.funcs.encode = encode_behavior_summaries; @@ -164,9 +165,10 @@ static struct encode_metadata_sets_state state = {}; zmk_studio_Response get_behavior_details(const zmk_studio_Request *req) { uint32_t behavior_id = req->subsystem.behaviors.request_type.get_behavior_details.behavior_id; - const char *behavior_name = zmk_behavior_find_behavior_name_from_local_id(behavior_id); + LOG_DBG("behavior_id %d, name %s", behavior_id, behavior_name); + if (!behavior_name) { LOG_WRN("No behavior found for ID %d", behavior_id); return ZMK_RPC_SIMPLE_ERR(GENERIC); diff --git a/app/src/studio/core_subsystem.c b/app/src/studio/core_subsystem.c index 2cdc9d7ce4..1739919a62 100644 --- a/app/src/studio/core_subsystem.c +++ b/app/src/studio/core_subsystem.c @@ -45,6 +45,7 @@ static bool encode_device_info_serial_number(pb_ostream_t *stream, const pb_fiel #endif // IS_ENABLED(CONFIG_HWINFO) zmk_studio_Response get_device_info(const zmk_studio_Request *req) { + LOG_DBG(""); zmk_core_GetDeviceInfoResponse resp = zmk_core_GetDeviceInfoResponse_init_zero; resp.name.funcs.encode = encode_device_info_name; @@ -56,12 +57,14 @@ zmk_studio_Response get_device_info(const zmk_studio_Request *req) { } zmk_studio_Response get_lock_state(const zmk_studio_Request *req) { + LOG_DBG(""); zmk_core_LockState resp = zmk_studio_core_get_lock_state(); return CORE_RESPONSE(get_lock_state, resp); } zmk_studio_Response reset_settings(const zmk_studio_Request *req) { + LOG_DBG(""); ZMK_RPC_SUBSYSTEM_SETTINGS_RESET_FOREACH(sub) { int ret = sub->callback(); if (ret < 0) { diff --git a/app/src/studio/keymap_subsystem.c b/app/src/studio/keymap_subsystem.c index d734afb602..25297b63c8 100644 --- a/app/src/studio/keymap_subsystem.c +++ b/app/src/studio/keymap_subsystem.c @@ -98,6 +98,7 @@ static bool encode_keymap_layers(pb_ostream_t *stream, const pb_field_t *field, } zmk_studio_Response get_keymap(const zmk_studio_Request *req) { + LOG_DBG(""); zmk_keymap_Keymap resp = zmk_keymap_Keymap_init_zero; resp.layers.funcs.encode = encode_keymap_layers; @@ -117,6 +118,7 @@ zmk_studio_Response get_keymap(const zmk_studio_Request *req) { } zmk_studio_Response set_layer_binding(const zmk_studio_Request *req) { + LOG_DBG(""); const zmk_keymap_SetLayerBindingRequest *set_req = &req->subsystem.keymap.request_type.set_layer_binding; @@ -165,6 +167,7 @@ zmk_studio_Response set_layer_binding(const zmk_studio_Request *req) { } zmk_studio_Response check_unsaved_changes(const zmk_studio_Request *req) { + LOG_DBG(""); int layout_changes = zmk_physical_layouts_check_unsaved_selection(); int keymap_changes = zmk_keymap_check_unsaved_changes(); @@ -172,6 +175,7 @@ zmk_studio_Response check_unsaved_changes(const zmk_studio_Request *req) { } zmk_studio_Response save_changes(const zmk_studio_Request *req) { + LOG_DBG(""); int ret = zmk_physical_layouts_save_selected(); if (ret < 0) { @@ -192,6 +196,7 @@ zmk_studio_Response save_changes(const zmk_studio_Request *req) { } zmk_studio_Response discard_changes(const zmk_studio_Request *req) { + LOG_DBG(""); int ret = zmk_physical_layouts_revert_selected(); if (ret < 0) { return ZMK_RPC_SIMPLE_ERR(GENERIC); @@ -288,6 +293,7 @@ static bool encode_layouts(pb_ostream_t *stream, const pb_field_t *field, void * } zmk_studio_Response get_physical_layouts(const zmk_studio_Request *req) { + LOG_DBG(""); zmk_keymap_PhysicalLayouts resp = zmk_keymap_PhysicalLayouts_init_zero; resp.active_layout_index = zmk_physical_layouts_get_selected(); resp.layouts.funcs.encode = encode_layouts; @@ -336,6 +342,7 @@ static void migrate_keymap(const uint8_t old) { } zmk_studio_Response set_active_physical_layout(const zmk_studio_Request *req) { + LOG_DBG(""); uint8_t index = (uint8_t)req->subsystem.keymap.request_type.set_active_physical_layout; int old = zmk_physical_layouts_get_selected(); @@ -364,6 +371,7 @@ zmk_studio_Response set_active_physical_layout(const zmk_studio_Request *req) { } zmk_studio_Response move_layer(const zmk_studio_Request *req) { + LOG_DBG(""); const zmk_keymap_MoveLayerRequest *move_req = &req->subsystem.keymap.request_type.move_layer; zmk_keymap_MoveLayerResponse resp = zmk_keymap_MoveLayerResponse_init_zero; @@ -386,6 +394,7 @@ zmk_studio_Response move_layer(const zmk_studio_Request *req) { } zmk_studio_Response add_layer(const zmk_studio_Request *req) { + LOG_DBG(""); // Use a static here to keep the value valid during serialization static zmk_keymap_layer_id_t layer_id = 0; @@ -428,6 +437,7 @@ zmk_studio_Response add_layer(const zmk_studio_Request *req) { } zmk_studio_Response remove_layer(const zmk_studio_Request *req) { + LOG_DBG(""); const zmk_keymap_RemoveLayerRequest *rm_req = &req->subsystem.keymap.request_type.remove_layer; zmk_keymap_RemoveLayerResponse resp = zmk_keymap_RemoveLayerResponse_init_zero; @@ -456,6 +466,7 @@ zmk_studio_Response remove_layer(const zmk_studio_Request *req) { } zmk_studio_Response restore_layer(const zmk_studio_Request *req) { + LOG_DBG(""); const zmk_keymap_RestoreLayerRequest *restore_req = &req->subsystem.keymap.request_type.restore_layer; @@ -492,6 +503,7 @@ zmk_studio_Response restore_layer(const zmk_studio_Request *req) { } zmk_studio_Response set_layer_props(const zmk_studio_Request *req) { + LOG_DBG(""); const zmk_keymap_SetLayerPropsRequest *set_req = &req->subsystem.keymap.request_type.set_layer_props; |