X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-terminal%2Fidev-keyboard.c;h=f90f1b56d553d8bc8f08239c7d1f6def9e523907;hb=adfe5671ef794099068038dfccbf1eb5134433c8;hp=ad2d74af1526a1b77344c1a744091e5903271966;hpb=2f0dd5164d36956197b9e649a100d5cfe08bb247;p=elogind.git
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index ad2d74af1..f90f1b56d 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -19,7 +19,6 @@
along with systemd; If not, see .
***/
-#include
#include
#include
#include
@@ -284,8 +283,8 @@ static int kbdctx_refresh_compose_table(kbdctx *kc, const char *lang) {
* it as a hard-failure but just continue. Preferably, we want
* xkb to tell us exactly whether compilation failed or whether
* there is no compose file available for this locale. */
- log_debug("idev-keyboard: cannot load compose-table for '%s': %s",
- lang, strerror(-r));
+ log_debug_errno(r, "idev-keyboard: cannot load compose-table for '%s': %m",
+ lang);
r = 0;
kt = NULL;
}
@@ -332,11 +331,8 @@ static int kbdctx_refresh_keymap(kbdctx *kc) {
/* TODO: add a fallback keymap that's compiled-in */
r = kbdmap_new_from_names(&km, kc, kc->last_x11_model, kc->last_x11_layout,
kc->last_x11_variant, kc->last_x11_options);
- if (r < 0) {
- log_debug("idev-keyboard: cannot create keymap from locale1: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "idev-keyboard: cannot create keymap from locale1: %m");
kbdmap_unref(kc->kbdmap);
kc->kbdmap = km;
@@ -377,7 +373,7 @@ static int kbdctx_set_locale(sd_bus *bus, const char *member, sd_bus_message *m,
error:
if (r < 0)
- log_debug("idev-keyboard: cannot parse locale property from locale1: %s", strerror(-r));
+ log_debug_errno(r, "idev-keyboard: cannot parse locale property from locale1: %m");
return r;
}
@@ -448,8 +444,7 @@ static int kbdctx_query_locale(kbdctx *kc) {
return 0;
error:
- log_debug("idev-keyboard: cannot send GetAll to locale1: %s", strerror(-r));
- return r;
+ return log_debug_errno(r, "idev-keyboard: cannot send GetAll to locale1: %m");
}
static int kbdctx_locale_props_changed_fn(sd_bus *bus,
@@ -480,8 +475,7 @@ static int kbdctx_locale_props_changed_fn(sd_bus *bus,
return 0;
error:
- log_debug("idev-keyboard: cannot handle PropertiesChanged from locale1: %s", strerror(-r));
- return r;
+ return log_debug_errno(r, "idev-keyboard: cannot handle PropertiesChanged from locale1: %m");
}
static int kbdctx_setup_bus(kbdctx *kc) {
@@ -496,10 +490,8 @@ static int kbdctx_setup_bus(kbdctx *kc) {
"path='/org/freedesktop/locale1'",
kbdctx_locale_props_changed_fn,
kc);
- if (r < 0) {
- log_debug("idev-keyboard: cannot setup locale1 link: %s", strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_debug_errno(r, "idev-keyboard: cannot setup locale1 link: %m");
return kbdctx_query_locale(kc);
}
@@ -514,15 +506,12 @@ static void kbdctx_log_fn(struct xkb_context *ctx, enum xkb_log_level lvl, const
sd_lvl = LOG_INFO;
else if (lvl >= XKB_LOG_LEVEL_WARNING)
sd_lvl = LOG_INFO; /* most XKB warnings really are informational */
- else if (lvl >= XKB_LOG_LEVEL_ERROR)
- sd_lvl = LOG_ERR;
- else if (lvl >= XKB_LOG_LEVEL_CRITICAL)
- sd_lvl = LOG_CRIT;
else
- sd_lvl = LOG_CRIT;
+ /* XKB_LOG_LEVEL_ERROR and worse */
+ sd_lvl = LOG_ERR;
snprintf(buf, sizeof(buf), "idev-xkb: %s", format);
- log_metav(sd_lvl, __FILE__, __LINE__, __func__, buf, args);
+ log_internalv(sd_lvl, 0, __FILE__, __LINE__, __func__, buf, args);
}
static kbdctx *kbdctx_ref(kbdctx *kc) {
@@ -638,7 +627,7 @@ idev_device *idev_find_keyboard(idev_session *s, const char *name) {
assert_return(s, NULL);
assert_return(name, NULL);
- kname = strappenda("keyboard/", name);
+ kname = strjoina("keyboard/", name);
return hashmap_get(s->device_map, kname);
}
@@ -648,8 +637,8 @@ static int keyboard_raise_data(idev_keyboard *k, idev_data *data) {
r = idev_session_raise_device_data(d->session, d, data);
if (r < 0)
- log_debug("idev-keyboard: %s/%s: error while raising data event: %s",
- d->session->name, d->name, strerror(-r));
+ log_debug_errno(r, "idev-keyboard: %s/%s: error while raising data event: %m",
+ d->session->name, d->name);
return r;
}
@@ -800,7 +789,7 @@ int idev_keyboard_new(idev_device **out, idev_session *s, const char *name) {
if (r < 0)
return r;
- kname = strappenda("keyboard/", name);
+ kname = strjoina("keyboard/", name);
r = idev_device_add(d, kname);
if (r < 0)
return r;
@@ -952,8 +941,8 @@ static void keyboard_repeat(idev_keyboard *k) {
r = keyboard_fill(k, repdata, false, evkbd->keycode, KBDKEY_REPEAT, num, keysyms);
if (r < 0) {
- log_debug("idev-keyboard: %s/%s: cannot set key-repeat: %s",
- d->session->name, d->name, strerror(-r));
+ log_debug_errno(r, "idev-keyboard: %s/%s: cannot set key-repeat: %m",
+ d->session->name, d->name);
k->repeating = false;
keyboard_arm(k, 0);
} else {
@@ -977,8 +966,8 @@ static void keyboard_repeat(idev_keyboard *k) {
r = keyboard_fill(k, repdata, false, repkbd->keycode, KBDKEY_REPEAT, num, keysyms);
if (r < 0) {
- log_debug("idev-keyboard: %s/%s: cannot update key-repeat: %s",
- d->session->name, d->name, strerror(-r));
+ log_debug_errno(r, "idev-keyboard: %s/%s: cannot update key-repeat: %m",
+ d->session->name, d->name);
k->repeating = false;
keyboard_arm(k, 0);
}
@@ -1067,8 +1056,8 @@ static int keyboard_feed_evdev(idev_keyboard *k, idev_data *data) {
return keyboard_raise_data(k, &k->evdata);
error:
- log_debug("idev-keyboard: %s/%s: cannot handle event: %s",
- d->session->name, d->name, strerror(-r));
+ log_debug_errno(r, "idev-keyboard: %s/%s: cannot handle event: %m",
+ d->session->name, d->name);
k->repeating = false;
keyboard_arm(k, 0);
return 0;
@@ -1128,9 +1117,8 @@ static int keyboard_update_kbdmap(idev_keyboard *k) {
return 0;
error:
- log_debug("idev-keyboard: %s/%s: cannot adopt new keymap: %s",
- d->session->name, d->name, strerror(-r));
- return r;
+ return log_debug_errno(r, "idev-keyboard: %s/%s: cannot adopt new keymap: %m",
+ d->session->name, d->name);
}
static int keyboard_update_kbdtbl(idev_keyboard *k) {
@@ -1162,9 +1150,8 @@ static int keyboard_update_kbdtbl(idev_keyboard *k) {
return 0;
error:
- log_debug("idev-keyboard: %s/%s: cannot adopt new compose table: %s",
- d->session->name, d->name, strerror(-r));
- return r;
+ return log_debug_errno(r, "idev-keyboard: %s/%s: cannot adopt new compose table: %m",
+ d->session->name, d->name);
}
static const idev_device_vtable keyboard_vtable = {