summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-01-26 23:30:27 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-01-28 15:06:00 +0900
commit8669bbb565294b01b9978884c23cdec8516d4f65 (patch)
tree30e471741b40f70d057a17d3556f9612adb8a983 /src
parent189cacabe9a8cfb6acf04dd9c9c525fdd88e7294 (diff)
downloadsystemd-8669bbb565294b01b9978884c23cdec8516d4f65.tar.gz
locale: move logging from library-like functions to caller
Diffstat (limited to 'src')
-rw-r--r--src/locale/localed-util.c17
-rw-r--r--src/locale/localed.c15
2 files changed, 16 insertions, 16 deletions
diff --git a/src/locale/localed-util.c b/src/locale/localed-util.c
index 54e32e2e1c..f5cc46c836 100644
--- a/src/locale/localed-util.c
+++ b/src/locale/localed-util.c
@@ -605,7 +605,6 @@ int vconsole_convert_to_x11(const VCContext *vc, X11Context *ret) {
if (r < 0)
return r;
if (r == 0) {
- log_notice("No conversion found for virtual console keymap \"%s\".", vc->keymap);
*ret = (X11Context) {};
return 0;
}
@@ -613,19 +612,13 @@ int vconsole_convert_to_x11(const VCContext *vc, X11Context *ret) {
if (!streq(vc->keymap, a[0]))
continue;
- r = x11_context_copy(ret,
+ return x11_context_copy(ret,
&(X11Context) {
.layout = empty_or_dash_to_null(a[1]),
.model = empty_or_dash_to_null(a[2]),
.variant = empty_or_dash_to_null(a[3]),
.options = empty_or_dash_to_null(a[4]),
});
- if (r < 0)
- return r;
-
- log_info("The virtual console keymap '%s' is converted to X11 keyboard layout '%s' model '%s' variant '%s' options '%s'",
- vc->keymap, strempty(ret->layout), strempty(ret->model), strempty(ret->variant), strempty(ret->options));
- return 0;
}
}
@@ -819,14 +812,6 @@ int x11_convert_to_vconsole(const X11Context *xc, VCContext *ret) {
r = find_legacy_keymap(xc, &keymap);
if (r < 0)
return r;
- if (r == 0)
- /* We search for layout-variant match first, but then we also look
- * for anything which matches just the layout. So it's accurate to say
- * that we couldn't find anything which matches the layout. */
- log_notice("No conversion to virtual console map found for \"%s\".", xc->layout);
- else
- log_info("The X11 keyboard layout '%s' is converted to virtual console keymap '%s'",
- xc->layout, strempty(keymap));
*ret = (VCContext) {
.keymap = TAKE_PTR(keymap),
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 7355b2d0e2..267f27635b 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -413,6 +413,12 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro
return sd_bus_error_set_errnof(error, r, "Failed to convert keymap data: %m");
}
+ if (x11_context_isempty(&converted))
+ log_notice("No conversion found for virtual console keymap \"%s\".", strempty(in.keymap));
+ else
+ log_info("The virtual console keymap '%s' is converted to X11 keyboard layout '%s' model '%s' variant '%s' options '%s'",
+ in.keymap, strempty(converted.layout), strempty(converted.model), strempty(converted.variant), strempty(converted.options));
+
/* save the result of conversion to emit changed properties later. */
x_needs_update = !x11_context_equal(&c->x11_from_vc, &converted) || !x11_context_equal(&c->x11_from_xorg, &converted);
} else
@@ -636,6 +642,15 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err
return sd_bus_error_set_errnof(error, r, "Failed to convert keymap data: %m");
}
+ if (vc_context_isempty(&converted))
+ /* We search for layout-variant match first, but then we also look
+ * for anything which matches just the layout. So it's accurate to say
+ * that we couldn't find anything which matches the layout. */
+ log_notice("No conversion to virtual console map found for \"%s\".", strempty(in.layout));
+ else
+ log_info("The X11 keyboard layout '%s' is converted to virtual console keymap '%s'",
+ in.layout, converted.keymap);
+
/* save the result of conversion to emit changed properties later. */
convert = !vc_context_equal(&c->vc, &converted);
}