uxkb: print warning if LED update fails

If we cannot write LED states to an input device, we should print proper
warnings instead of ignoring it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-12-09 22:06:51 +01:00
parent f951f6b705
commit 98970835d9

View File

@ -151,7 +151,7 @@ static void uxkb_dev_update_keyboard_leds(struct uterm_input_dev *dev)
{ LED_SCROLLL, XKB_LED_NAME_SCROLL },
};
struct input_event events[sizeof(leds) / sizeof(*leds)];
int i;
int i, ret;
if (!(dev->capabilities & UTERM_DEVICE_HAS_LEDS))
return;
@ -166,7 +166,9 @@ static void uxkb_dev_update_keyboard_leds(struct uterm_input_dev *dev)
events[i].value = 1;
}
write(dev->rfd, events, sizeof(events));
ret = write(dev->rfd, events, sizeof(events));
if (ret != sizeof(events))
log_warning("cannot update LED state (%d): %m", errno);
}
static inline int uxkb_dev_resize_event(struct uterm_input_dev *dev, size_t s)