Drop the trailing newline from the log messages

Punt this job to the caller, any structured logging handler doesn't need
them anyway and it makes handling of messages more awkward.

For our default log handlers (fprintf) we can just append them
ourselves.

Fixes #19
This commit is contained in:
Peter Hutterer 2022-08-02 16:41:01 +10:00
parent 876d722356
commit 37467881e6
15 changed files with 140 additions and 140 deletions

View file

@ -55,7 +55,7 @@ ei_device_set_state(struct ei_device *device,
{
enum ei_device_state old_state = device->state;
device->state = state;
log_debug(ei_device_get_context(device), "device %#x: %s → %s\n",
log_debug(ei_device_get_context(device), "device %#x: %s → %s",
device->id, ei_device_state_to_string(old_state),
ei_device_state_to_string(state));
}
@ -313,7 +313,7 @@ ei_device_set_type(struct ei_device *device, enum ei_device_type type)
device->type = type;
break;
default:
log_bug(ei_device_get_context(device), "Invalid device type %u\n", type);
log_bug(ei_device_get_context(device), "Invalid device type %u", type);
break;
}
}
@ -368,7 +368,7 @@ _flush_frame(struct ei_device *device, const char *func)
{
if (device->send_frame_event) {
log_bug_client(ei_device_get_context(device),
"%s: missing call to ei_device_frame()\n", func);
"%s: missing call to ei_device_frame()", func);
ei_device_frame_now(device);
}
}
@ -409,13 +409,13 @@ ei_device_pointer_motion(struct ei_device *device,
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a pointer\n", __func__);
"%s: device is not a pointer", __func__);
return;
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
@ -428,13 +428,13 @@ ei_device_pointer_motion_absolute(struct ei_device *device,
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not an absolute pointer\n", __func__);
"%s: device is not an absolute pointer", __func__);
return;
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
@ -454,13 +454,13 @@ ei_device_pointer_button(struct ei_device *device,
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a pointer\n", __func__);
"%s: device is not a pointer", __func__);
return;
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
@ -468,7 +468,7 @@ ei_device_pointer_button(struct ei_device *device,
* numerical buttons instead of BTN_LEFT and friends. */
if (button < 0x110) {
log_bug_client(ei_device_get_context(device),
"%s: button code must be one of BTN_*\n", __func__);
"%s: button code must be one of BTN_*", __func__);
return;
}
@ -495,12 +495,12 @@ ei_device_pointer_scroll(struct ei_device *device,
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
@ -515,12 +515,12 @@ ei_device_pointer_scroll_stop(struct ei_device *device, bool x, bool y)
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
@ -545,12 +545,12 @@ ei_device_pointer_scroll_cancel(struct ei_device *device, bool x, bool y)
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
@ -580,12 +580,12 @@ ei_device_pointer_scroll_discrete(struct ei_device *device,
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
@ -600,13 +600,13 @@ ei_device_keyboard_key(struct ei_device *device,
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_KEYBOARD)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a keyboard\n", __func__);
"%s: device is not a keyboard", __func__);
return;
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
@ -662,13 +662,13 @@ ei_touch_down(struct ei_touch *touch, double x, double y)
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
if (touch->state != TOUCH_IS_NEW) {
log_bug_client(ei_device_get_context(device),
"%s: touch %u already down or up\n", __func__, touch->tracking_id);
"%s: touch %u already down or up", __func__, touch->tracking_id);
return;
}
@ -676,7 +676,7 @@ ei_touch_down(struct ei_touch *touch, double x, double y)
list_for_each(r, &device->regions, link) {
if (!ei_region_contains(r, x, y)) {
log_bug_client(ei_device_get_context(device),
"%s: touch %u has invalid x/y coordinates\n", __func__, touch->tracking_id);
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
touch->state = TOUCH_IS_UP;
return;
}
@ -694,13 +694,13 @@ ei_touch_motion(struct ei_touch *touch, double x, double y)
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
if (touch->state != TOUCH_IS_DOWN) {
log_bug_client(ei_device_get_context(device),
"%s: touch %u is not currently down\n", __func__, touch->tracking_id);
"%s: touch %u is not currently down", __func__, touch->tracking_id);
return;
}
@ -708,7 +708,7 @@ ei_touch_motion(struct ei_touch *touch, double x, double y)
list_for_each(r, &device->regions, link) {
if (!ei_region_contains(r, x, y)) {
log_bug_client(ei_device_get_context(device),
"%s: touch %u has invalid x/y coordinates\n", __func__, touch->tracking_id);
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
ei_touch_up(touch);
return;
}
@ -723,13 +723,13 @@ ei_touch_up(struct ei_touch *touch)
struct ei_device *device = ei_touch_get_device(touch);
if (device->state != EI_DEVICE_STATE_EMULATING) {
log_bug_client(ei_device_get_context(device),
"%s: device is not not emulating\n", __func__);
"%s: device is not not emulating", __func__);
return;
}
if (touch->state != TOUCH_IS_DOWN) {
log_bug_client(ei_device_get_context(device),
"%s: touch %u is not currently down\n", __func__, touch->tracking_id);
"%s: touch %u is not currently down", __func__, touch->tracking_id);
return;
}
@ -800,7 +800,7 @@ ei_device_event_pointer_rel(struct ei_device *device, double x, double y)
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a pointer\n", __func__);
"%s: device is not a pointer", __func__);
return -EINVAL;
}
@ -831,7 +831,7 @@ ei_device_event_pointer_abs(struct ei_device *device,
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not an absolute pointer\n", __func__);
"%s: device is not an absolute pointer", __func__);
return -EINVAL;
}
@ -852,7 +852,7 @@ ei_device_event_pointer_button(struct ei_device *device,
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a pointer\n", __func__);
"%s: device is not a pointer", __func__);
return -EINVAL;
}
@ -871,7 +871,7 @@ ei_device_event_pointer_scroll(struct ei_device *device,
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
return -EINVAL;
}
@ -890,7 +890,7 @@ ei_device_event_pointer_scroll_discrete(struct ei_device *device,
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
return -EINVAL;
}
@ -908,7 +908,7 @@ ei_device_event_pointer_scroll_stop(struct ei_device *device, bool x, bool y)
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
return -EINVAL;
}
@ -926,7 +926,7 @@ ei_device_event_pointer_scroll_cancel(struct ei_device *device, bool x, bool y)
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
return -EINVAL;
}
@ -944,7 +944,7 @@ ei_device_event_keyboard_key(struct ei_device *device,
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_KEYBOARD)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a keyboard\n", __func__);
"%s: device is not a keyboard", __func__);
return -EINVAL;
}
@ -961,7 +961,7 @@ ei_device_event_touch_down(struct ei_device *device, uint32_t touchid, double x,
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_TOUCH)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a touch device\n", __func__);
"%s: device is not a touch device", __func__);
return -EINVAL;
}
@ -978,7 +978,7 @@ ei_device_event_touch_motion(struct ei_device *device, uint32_t touchid, double
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_TOUCH)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a touch device\n", __func__);
"%s: device is not a touch device", __func__);
return -EINVAL;
}
@ -995,7 +995,7 @@ ei_device_event_touch_up(struct ei_device *device, uint32_t touchid)
{
if (!ei_device_has_capability(device, EI_DEVICE_CAP_TOUCH)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not a touch device\n", __func__);
"%s: device is not a touch device", __func__);
return -EINVAL;
}

View file

@ -160,7 +160,7 @@ check_event_type(struct ei_event *event,
if (!rc)
log_bug_client(ei_event_get_context(event),
"Invalid event type %u passed to %s()\n",
"Invalid event type %u passed to %s()",
type, function_name);
return rc;

View file

@ -72,7 +72,7 @@ ei_default_log_handler(struct ei *ei,
size_t idx = priority/10;
assert(idx < ARRAY_LENGTH(lut));
fprintf(stderr, " %8s | %s%4s%s | %s", timestamp,
fprintf(stderr, " %8s | %s%4s%s | %s\n", timestamp,
lut[idx].color, lut[idx].prefix, reset_code, message);
last_time = now;

View file

@ -116,19 +116,19 @@ portal_connect(struct ei_portal *portal, const char *session_handle)
0);
if (rc < 0) {
log_error(ei, "Failed to call method: %s\n", strerror(-rc));
log_error(ei, "Failed to call method: %s", strerror(-rc));
goto out;
}
int status;
rc = sd_bus_message_read(response, "u", &status);
if (rc < 0) {
log_error(ei, "Failed to extract status, invalid message format: %s\n", strerror(-rc));
log_error(ei, "Failed to extract status, invalid message format: %s", strerror(-rc));
goto out;
}
if (status != 0) {
log_info(ei, "Unable to get fd from portal\n");
log_info(ei, "Unable to get fd from portal");
ei_disconnect(ei);
return;
}
@ -136,19 +136,19 @@ portal_connect(struct ei_portal *portal, const char *session_handle)
const char *key;
rc = sd_bus_message_read(response, "a{sv}", 1, &key, "h", &eisfd);
if (rc < 0) {
log_error(ei, "Failed to extract fd, invalid message format: %s\n", strerror(-rc));
log_error(ei, "Failed to extract fd, invalid message format: %s", strerror(-rc));
goto out;
}
if (!streq(key, "fd")) {
log_error(ei, "Invalid key '%s', expected 'fd'\n", key);
log_error(ei, "Invalid key '%s', expected 'fd'", key);
goto out;
}
/* the fd is owned by the message */
rc = xerrno(dup(eisfd));
if (rc < 0) {
log_error(ei, "Failed to dup fd: %s\n", strerror(-rc));
log_error(ei, "Failed to dup fd: %s", strerror(-rc));
goto out;
} else {
eisfd = rc;
@ -156,7 +156,7 @@ portal_connect(struct ei_portal *portal, const char *session_handle)
fcntl(eisfd, F_SETFL, flags | O_NONBLOCK);
}
log_debug(ei, "Initiating ei context with fd %d from portal\n", eisfd);
log_debug(ei, "Initiating ei context with fd %d from portal", eisfd);
/* We're done with DBus, lets clean up */
source_remove(portal->bus_source);
@ -166,7 +166,7 @@ portal_connect(struct ei_portal *portal, const char *session_handle)
rc = ei_set_connection(ei, eisfd);
out:
if (rc < 0) {
log_error(ei, "Failed to set the connection: %s\n", strerror(-rc));
log_error(ei, "Failed to set the connection: %s", strerror(-rc));
ei_disconnect(ei);
}
}
@ -186,25 +186,25 @@ portal_response_received(sd_bus_message *m, void *userdata, sd_bus_error *error)
int rc = sd_bus_message_read(m, "u", &response);
if (rc < 0) {
log_error(ei, "Failed to read response from signal: %s\n", strerror(-rc));
log_error(ei, "Failed to read response from signal: %s", strerror(-rc));
ei_disconnect(ei);
return 0;
}
log_debug(ei, "Portal CreateSession reponse is %u\n", response);
log_debug(ei, "Portal CreateSession reponse is %u", response);
const char *session_handle = NULL;
if (response == 0) {
const char *key;
rc = sd_bus_message_read(m, "a{sv}", 1, &key, "s", &session_handle);
if (rc < 0) {
log_error(ei, "Failed to read session handle from signal: %s\n", strerror(-rc));
log_error(ei, "Failed to read session handle from signal: %s", strerror(-rc));
ei_disconnect(ei);
return 0;
}
if (!streq(key, "session_handle")) {
log_error(ei, "Invalid or unhandled option: %ss\n", key);
log_error(ei, "Invalid or unhandled option: %ss", key);
ei_disconnect(ei);
return 0;
}
@ -265,7 +265,7 @@ portal_init(struct ei *ei, const char *busname)
int rc = sd_bus_open_user(&bus);
if (rc < 0) {
log_error(ei, "Failed to init dbus: %s\n", strerror(-rc));
log_error(ei, "Failed to init dbus: %s", strerror(-rc));
return -ECONNREFUSED;
}
@ -282,7 +282,7 @@ portal_init(struct ei *ei, const char *busname)
portal_response_received,
portal);
if (rc < 0) {
log_error(ei, "Failed to subscribe to signal: %s\n", strerror(-rc));
log_error(ei, "Failed to subscribe to signal: %s", strerror(-rc));
return -ECONNREFUSED;
}
@ -294,7 +294,7 @@ portal_init(struct ei *ei, const char *busname)
session_closed_received,
portal);
if (rc < 0) {
log_error(ei, "Failed to subscribe to signal: %s\n", strerror(-rc));
log_error(ei, "Failed to subscribe to signal: %s", strerror(-rc));
return -ECONNREFUSED;
}
@ -313,17 +313,17 @@ portal_init(struct ei *ei, const char *busname)
);
if (rc < 0) {
log_error(ei, "Failed to call method: %s\n", strerror(-rc));
log_error(ei, "Failed to call method: %s", strerror(-rc));
return -ECONNREFUSED;
}
rc = sd_bus_message_read(response, "o", &path);
if (rc < 0) {
log_error(ei, "Failed to parse response: %s\n", strerror(-rc));
log_error(ei, "Failed to parse response: %s", strerror(-rc));
return -ECONNREFUSED;
}
log_debug(ei, "portal Response object is %s\n", path);
log_debug(ei, "portal Response object is %s", path);
struct source *s = source_new(sd_bus_get_fd(bus), dbus_dispatch, portal);
source_never_close_fd(s); /* the bus object handles the fd */

View file

@ -54,7 +54,7 @@ ei_proto_handle_message(struct ei *ei,
#define call(field, ...) \
({ \
int r = (interface->field == NULL) ? -EPROTO : interface->field(__VA_ARGS__); \
log_debug(ei, "message type '" #field "': errno %d (%s)\n", -r, strerror(-r)); \
log_debug(ei, "message type '" #field "': errno %d (%s)", -r, strerror(-r)); \
r; \
})
@ -261,7 +261,7 @@ log_wire_message(struct ei *ei, const ClientMessage *msg, int error)
if (message == NULL)
assert(!"Unimplemented message type");
log_debug(ei, "sending wire message %s (%s)\n", message,
log_debug(ei, "sending wire message %s (%s)", message,
strerror(-error));
#undef MSG_STRING_CASE

View file

@ -215,7 +215,7 @@ update_event_timestamp(struct ei_event *event, uint64_t time)
case EI_EVENT_TOUCH_MOTION:
if (event->timestamp != 0) {
log_bug(ei_event_get_context(event),
"Unexpected timestamp for event of type: %s\n",
"Unexpected timestamp for event of type: %s",
ei_event_type_to_string(event->type));
return;
}
@ -223,7 +223,7 @@ update_event_timestamp(struct ei_event *event, uint64_t time)
break;
default:
log_bug(ei_event_get_context(event),
"Unexpected event %s in pending queue event\n",
"Unexpected event %s in pending queue event",
ei_event_type_to_string(event->type));
return;
}
@ -269,7 +269,7 @@ queue_event(struct ei *ei, struct ei_event *event)
break;
}
log_debug(ei, "queuing %sevent type %s (%u)\n",
log_debug(ei, "queuing %sevent type %s (%u)",
prefix,
ei_event_type_to_string(event->type), event->type);
@ -279,7 +279,7 @@ queue_event(struct ei *ei, struct ei_event *event)
static void
insert_event(struct ei *ei, struct ei_event *event)
{
log_debug(ei, "inserting event type %s (%u)\n",
log_debug(ei, "inserting event type %s (%u)",
ei_event_type_to_string(event->type), event->type);
list_insert(&ei->event_queue, &event->link);
@ -619,7 +619,7 @@ static int
handle_msg_seat_added(struct ei *ei, uint32_t seatid,
const char *name, uint32_t capabilities)
{
log_debug(ei, "Added seat %#x '%s' with caps %#x\n",
log_debug(ei, "Added seat %#x '%s' with caps %#x",
seatid, name, capabilities);
struct ei_seat *seat = ei_seat_new(ei, seatid, name, capabilities);
@ -635,7 +635,7 @@ handle_msg_seat_added(struct ei *ei, uint32_t seatid,
static int
handle_msg_seat_removed(struct ei *ei, uint32_t seatid)
{
log_debug(ei, "server removed seat %#x\n", seatid);
log_debug(ei, "server removed seat %#x", seatid);
struct ei_seat *seat = ei_find_seat(ei, seatid);
if (seat) {
@ -653,7 +653,7 @@ handle_msg_device_added(struct ei *ei, uint32_t deviceid, uint32_t seatid,
struct ei_seat *seat = ei_find_seat(ei, seatid);
if (!seat) {
log_bug(ei, "Invalid seat id %#x for device %s (%#x)\n",
log_bug(ei, "Invalid seat id %#x for device %s (%#x)",
seatid, name, deviceid);
return 0;
}
@ -663,7 +663,7 @@ handle_msg_device_added(struct ei *ei, uint32_t deviceid, uint32_t seatid,
* won't know which unless we keep some device ID table. Not worth
* it, so just silently ignore */
if (ei_seat_find_device(seat, deviceid)) {
log_error(ei, "Server sent duplicate device id %#x\n", deviceid);
log_error(ei, "Server sent duplicate device id %#x", deviceid);
return -EINVAL;
}
@ -672,7 +672,7 @@ handle_msg_device_added(struct ei *ei, uint32_t deviceid, uint32_t seatid,
case EI_DEVICE_TYPE_VIRTUAL:
break;
default:
log_error(ei, "Server sent invalid device type %u\n", type);
log_error(ei, "Server sent invalid device type %u", type);
return -EINVAL;
}
@ -685,7 +685,7 @@ handle_msg_device_added(struct ei *ei, uint32_t deviceid, uint32_t seatid,
ei_device_added(device);
log_debug(ei,
"Added device %#x '%s' caps: %s%s%s%s seat: %s\n",
"Added device %#x '%s' caps: %s%s%s%s seat: %s",
deviceid, name,
ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) ? "p" : "",
ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE) ? "a" : "",
@ -701,7 +701,7 @@ handle_msg_device_keymap(struct ei *ei, uint32_t deviceid,
enum ei_keymap_type keymap_type,
int keymap_fd, size_t keymap_sz)
{
log_debug(ei, "Adding keymap for %#x\n", deviceid);
log_debug(ei, "Adding keymap for %#x", deviceid);
struct ei_device *device = ei_find_device(ei, deviceid);
if (!device)
@ -727,7 +727,7 @@ ei_insert_device_removed_event(struct ei_device *device)
static int
handle_msg_device_added_done(struct ei *ei, uint32_t deviceid)
{
log_debug(ei, "Done with device %#x\n", deviceid);
log_debug(ei, "Done with device %#x", deviceid);
struct ei_device *device = ei_find_device(ei, deviceid);
if (!device)
@ -745,7 +745,7 @@ handle_msg_device_region(struct ei *ei, uint32_t deviceid,
uint32_t w, uint32_t h,
double scale)
{
log_debug(ei, "Adding device region for %#x\n", deviceid);
log_debug(ei, "Adding device region for %#x", deviceid);
struct ei_device *device = ei_find_device(ei, deviceid);
if (!device)
@ -766,14 +766,14 @@ handle_msg_keyboard_modifiers(struct ei *ei, uint32_t deviceid,
uint32_t depressed, uint32_t latched,
uint32_t locked, uint32_t group)
{
log_debug(ei, "Setting modifiers for %#x\n", deviceid);
log_debug(ei, "Setting modifiers for %#x", deviceid);
struct ei_device *device = ei_find_device(ei, deviceid);
if (!device)
return 0;
if (!ei_device_has_capability(device, EI_DEVICE_CAP_KEYBOARD)) {
log_bug(ei,"Modifier event for non-keyboard\n");
log_bug(ei,"Modifier event for non-keyboard");
return -EPROTO;
}
@ -802,7 +802,7 @@ handle_msg_property(struct ei *ei, const char *name, const char *value,
static int
handle_msg_device_removed(struct ei *ei, uint32_t deviceid)
{
log_debug(ei, "Removed device %#x\n", deviceid);
log_debug(ei, "Removed device %#x", deviceid);
struct ei_device *device = ei_find_device(ei, deviceid);
if (!device)
@ -816,7 +816,7 @@ handle_msg_device_removed(struct ei *ei, uint32_t deviceid)
static int
handle_msg_device_resumed(struct ei *ei, uint32_t deviceid)
{
log_debug(ei, "Resumed device %#x\n", deviceid);
log_debug(ei, "Resumed device %#x", deviceid);
struct ei_device *device = ei_find_device(ei, deviceid);
if (device) {
@ -830,7 +830,7 @@ handle_msg_device_resumed(struct ei *ei, uint32_t deviceid)
static int
handle_msg_device_paused(struct ei *ei, uint32_t deviceid)
{
log_debug(ei, "Paused device %#x\n", deviceid);
log_debug(ei, "Paused device %#x", deviceid);
struct ei_device *device = ei_find_device(ei, deviceid);
if (device) {
@ -1138,7 +1138,7 @@ static int handle_msg_disconnected(struct ei *ei) {
#define DISCONNECT_IF_SENDER_CONTEXT(ei_) do {\
if (ei_->is_sender) { \
log_bug_client(ei_, "Invalid event from receiver EIS context. Disconnecting\n"); \
log_bug_client(ei_, "Invalid event from receiver EIS context. Disconnecting"); \
return -ECANCELED; \
} \
} while(0)
@ -1406,12 +1406,12 @@ connection_dispatch(struct source *source, void *userdata)
"DISCONNECTING",
};
if (rc == -ECANCELED)
log_info(ei, "Disconnected\n");
log_info(ei, "Disconnected");
else if (rc)
log_warn(ei, "Connnection error: %s\n", strerror(-rc));
log_warn(ei, "Connnection error: %s", strerror(-rc));
if (old_state != ei->state)
log_debug(ei, "Connnection dispatch: %s -> %s\n",
log_debug(ei, "Connnection dispatch: %s -> %s",
states[old_state],
states[ei->state]);
}
@ -1439,7 +1439,7 @@ ei_set_connection(struct ei *ei, int fd)
ei->state = EI_STATE_CONNECTING;
}
if (rc != 0) {
log_error(ei, "message failed to send: %s\n", strerror(-rc));
log_error(ei, "message failed to send: %s", strerror(-rc));
ei_disconnect(ei);
}
}
@ -1453,12 +1453,12 @@ _public_ void
ei_configure_name(struct ei *ei, const char *name)
{
if (ei->state != EI_STATE_NEW) {
log_bug_client(ei,"Client is already connected\n");
log_bug_client(ei,"Client is already connected");
return;
}
if (strlen(name) > 1024) {
log_bug_client(ei, "Client name too long\n");
log_bug_client(ei, "Client name too long");
return;
}
@ -1477,7 +1477,7 @@ ei_now(struct ei *ei)
* happening are so slim it's not worth worrying about. Plus,
* if this fails we're likely to be inside eis_device_frame()
* so we should flush a frame event before disconnecting and... */
log_error(ei, "clock_gettime failed: %s\n", strerror(-rc));
log_error(ei, "clock_gettime failed: %s", strerror(-rc));
}
return ts;
}

View file

@ -229,13 +229,13 @@ eis_client_connect(struct eis_client *client)
break;
default:
log_bug_client(eis_client_get_context(client),
"%s: client already connected\n", __func__);
"%s: client already connected", __func__);
return;
}
int rc = client_send_connect(client);
if (rc) {
log_debug(eis_client_get_context(client), "Message failed to send: %s\n", strerror(-rc));
log_debug(eis_client_get_context(client), "Message failed to send: %s", strerror(-rc));
eis_client_disconnect(client);
} else {
client->state = EIS_CLIENT_STATE_CONNECTED;
@ -300,7 +300,7 @@ client_msg_bind_seat(struct eis_client *client, uint32_t seatid, uint32_t caps)
#define DISCONNECT_IF_RECEIVER_CONTEXT(client_) do { \
if (!(client_)->is_sender) { \
struct eis *_ctx = eis_client_get_context(client_); \
log_bug_client(_ctx, "Invalid event from receiver ei context. Disconnecting client\n"); \
log_bug_client(_ctx, "Invalid event from receiver ei context. Disconnecting client"); \
return -EINVAL; \
} \
} while(0)
@ -641,12 +641,12 @@ client_dispatch(struct source *source, void *userdata)
"DISCONNECTED",
};
if (rc == -ECANCELED)
log_info(eis_client_parent(client), "Disconnected\n");
log_info(eis_client_parent(client), "Disconnected");
else if (rc)
log_warn(eis_client_parent(client), "Client error: %s\n",
log_warn(eis_client_parent(client), "Client error: %s",
strerror(-rc));
if (old_state != client->state) {
log_debug(eis_client_parent(client), "Client dispatch: %s -> %s\n",
log_debug(eis_client_parent(client), "Client dispatch: %s -> %s",
client_states[old_state],
client_states[client->state]);
}

View file

@ -101,13 +101,13 @@ eis_keymap_add(struct eis_keymap *keymap)
if (device->state != EIS_DEVICE_STATE_NEW) {
log_bug_client(eis_device_get_context(device),
"%s: device already (dis)connected\n", __func__);
"%s: device already (dis)connected", __func__);
return;
}
if (device->keymap) {
log_bug_client(eis_device_get_context(device),
"%s: only one keymap can only be assigned and only once\n", __func__);
"%s: only one keymap can only be assigned and only once", __func__);
return;
}
@ -215,7 +215,7 @@ eis_device_configure_type(struct eis_device *device, enum eis_device_type type)
case EIS_DEVICE_TYPE_PHYSICAL:
break;
default:
log_bug_client(eis_device_get_context(device), "Invalid device type %u\n", type);
log_bug_client(eis_device_get_context(device), "Invalid device type %u", type);
return;
}
@ -248,12 +248,12 @@ _public_ void
eis_device_configure_size(struct eis_device *device, uint32_t width, uint32_t height)
{
if (device->type != EIS_DEVICE_TYPE_PHYSICAL) {
log_bug_client(eis_device_get_context(device), "Device type physical requird for size\n");
log_bug_client(eis_device_get_context(device), "Device type physical requird for size");
return;
}
if (width > 2000 || height > 2000)
log_warn(eis_device_get_context(device), "Suspicious device size: %ux%umm\n", width, height);
log_warn(eis_device_get_context(device), "Suspicious device size: %ux%umm", width, height);
device->width = width;
device->height = height;
@ -264,13 +264,13 @@ eis_device_add(struct eis_device *device)
{
if (device->state != EIS_DEVICE_STATE_NEW) {
log_bug_client(eis_device_get_context(device),
"%s: device already (dis)connected\n", __func__);
"%s: device already (dis)connected", __func__);
return;
}
if (!device->capabilities) {
log_bug_client(eis_device_get_context(device),
"%s: adding device without capabilities\n", __func__);
"%s: adding device without capabilities", __func__);
}
device->state = EIS_DEVICE_STATE_PAUSED;
@ -329,7 +329,7 @@ _flush_frame(struct eis_device *device, const char *func)
{
if (device->send_frame_event) {
log_bug_client(eis_device_get_context(device),
"%s: missing call to eis_device_frame()\n", func);
"%s: missing call to eis_device_frame()", func);
eis_device_frame_now(device);
}
}
@ -367,7 +367,7 @@ eis_device_pointer_motion(struct eis_device *device,
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a pointer\n", __func__);
"%s: device is not a pointer", __func__);
return;
}
@ -385,7 +385,7 @@ eis_device_pointer_motion_absolute(struct eis_device *device,
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not an absolute pointer\n", __func__);
"%s: device is not an absolute pointer", __func__);
return;
}
@ -410,7 +410,7 @@ eis_device_pointer_button(struct eis_device *device,
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a pointer\n", __func__);
"%s: device is not a pointer", __func__);
return;
}
@ -421,7 +421,7 @@ eis_device_pointer_button(struct eis_device *device,
* numerical buttons instead of BTN_LEFT and friends. */
if (button < 0x110) {
log_bug_client(eis_device_get_context(device),
"%s: button code must be one of BTN_*\n", __func__);
"%s: button code must be one of BTN_*", __func__);
return;
}
@ -450,7 +450,7 @@ eis_device_pointer_scroll(struct eis_device *device,
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
}
if (device->state != EIS_DEVICE_STATE_EMULATING)
@ -469,7 +469,7 @@ eis_device_pointer_scroll_stop(struct eis_device *device, bool x, bool y)
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
}
if (device->state != EIS_DEVICE_STATE_EMULATING)
return;
@ -497,7 +497,7 @@ eis_device_pointer_scroll_cancel(struct eis_device *device, bool x, bool y)
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
}
if (device->state != EIS_DEVICE_STATE_EMULATING)
return;
@ -530,7 +530,7 @@ eis_device_pointer_scroll_discrete(struct eis_device *device,
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
}
if (device->state != EIS_DEVICE_STATE_EMULATING)
@ -549,7 +549,7 @@ eis_device_keyboard_key(struct eis_device *device,
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_KEYBOARD)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a keyboard\n", __func__);
"%s: device is not a keyboard", __func__);
return;
}
@ -610,7 +610,7 @@ eis_touch_down(struct eis_touch *touch, double x, double y)
if (touch->state != TOUCH_IS_NEW) {
log_bug_client(eis_device_get_context(device),
"%s: touch %u already down or up\n", __func__, touch->tracking_id);
"%s: touch %u already down or up", __func__, touch->tracking_id);
return;
}
@ -618,7 +618,7 @@ eis_touch_down(struct eis_touch *touch, double x, double y)
list_for_each(r, &device->regions, link) {
if (!eis_region_contains(r, x, y)) {
log_bug_client(eis_device_get_context(device),
"%s: touch %u has invalid x/y coordinates\n", __func__, touch->tracking_id);
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
touch->state = TOUCH_IS_UP;
return;
}
@ -641,7 +641,7 @@ eis_touch_motion(struct eis_touch *touch, double x, double y)
list_for_each(r, &device->regions, link) {
if (!eis_region_contains(r, x, y)) {
log_bug_client(eis_device_get_context(device),
"%s: touch %u has invalid x/y coordinates\n", __func__, touch->tracking_id);
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
eis_touch_up(touch);
return;
}
@ -659,7 +659,7 @@ eis_touch_up(struct eis_touch *touch)
if (touch->state != TOUCH_IS_DOWN) {
log_bug_client(eis_device_get_context(device),
"%s: touch %u is not currently down\n", __func__, touch->tracking_id);
"%s: touch %u is not currently down", __func__, touch->tracking_id);
return;
}
@ -701,7 +701,7 @@ eis_device_event_pointer_rel(struct eis_device *device,
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a pointer\n", __func__);
"%s: device is not a pointer", __func__);
return -EINVAL;
}
@ -732,7 +732,7 @@ eis_device_event_pointer_abs(struct eis_device *device,
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not an absolute pointer\n", __func__);
"%s: device is not an absolute pointer", __func__);
return -EINVAL;
}
@ -753,7 +753,7 @@ eis_device_event_pointer_button(struct eis_device *device,
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a pointer\n", __func__);
"%s: device is not a pointer", __func__);
return -EINVAL;
}
@ -772,7 +772,7 @@ eis_device_event_pointer_scroll(struct eis_device *device,
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
return -EINVAL;
}
@ -791,7 +791,7 @@ eis_device_event_pointer_scroll_discrete(struct eis_device *device,
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
return -EINVAL;
}
@ -809,7 +809,7 @@ eis_device_event_pointer_scroll_stop(struct eis_device *device, bool x, bool y)
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
return -EINVAL;
}
@ -827,7 +827,7 @@ eis_device_event_pointer_scroll_cancel(struct eis_device *device, bool x, bool y
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a (absolute) pointer\n", __func__);
"%s: device is not a (absolute) pointer", __func__);
return -EINVAL;
}
@ -845,7 +845,7 @@ eis_device_event_keyboard_key(struct eis_device *device,
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_KEYBOARD)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a keyboard\n", __func__);
"%s: device is not a keyboard", __func__);
return -EINVAL;
}
@ -862,7 +862,7 @@ eis_device_event_touch_down(struct eis_device *device, uint32_t touchid, double
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_TOUCH)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a touch device\n", __func__);
"%s: device is not a touch device", __func__);
return -EINVAL;
}
@ -879,7 +879,7 @@ eis_device_event_touch_motion(struct eis_device *device, uint32_t touchid, doubl
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_TOUCH)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a touch device\n", __func__);
"%s: device is not a touch device", __func__);
return -EINVAL;
}
@ -896,7 +896,7 @@ eis_device_event_touch_up(struct eis_device *device, uint32_t touchid)
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_TOUCH)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a touch device\n", __func__);
"%s: device is not a touch device", __func__);
return -EINVAL;
}
@ -990,7 +990,7 @@ eis_device_keyboard_send_xkb_modifiers(struct eis_device *device, uint32_t depre
{
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_KEYBOARD)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a keyboard\n", __func__);
"%s: device is not a keyboard", __func__);
return;
}

View file

@ -162,7 +162,7 @@ check_event_type(struct eis_event *event,
if (!rc)
log_bug_client(eis_event_get_context(event),
"Invalid event type %u passed to %s()\n",
"Invalid event type %u passed to %s()",
type, function_name);
return rc;

View file

@ -72,7 +72,7 @@ eis_default_log_handler(struct eis *eis,
size_t idx = priority/10;
assert(idx < ARRAY_LENGTH(lut));
fprintf(stderr, " EIS: %8s | %s%4s%s | %s", timestamp,
fprintf(stderr, " EIS: %8s | %s%4s%s | %s\n", timestamp,
lut[idx].color, lut[idx].prefix, reset_code, message);
last_time = now;

View file

@ -85,7 +85,7 @@ log_wire_message(struct eis *eis, const ServerMessage *msg)
if (message == NULL)
assert(!"Unimplemented message type");
log_debug(eis, "sending wire message %s\n", message);
log_debug(eis, "sending wire message %s", message);
#undef MSG_STRING_CASE
}
@ -505,7 +505,7 @@ eis_proto_handle_message(struct eis_client *client,
#define call(field, ...) \
({ \
int r = (interface->field == NULL) ? -EPROTO : interface->field(__VA_ARGS__); \
log_debug(eis_client_get_context(client), "message type '" #field "': errno %d (%s)\n", -r, strerror(-r)); \
log_debug(eis_client_get_context(client), "message type '" #field "': errno %d (%s)", -r, strerror(-r)); \
r; \
})

View file

@ -61,7 +61,7 @@ eis_device_new_region(struct eis_device *device)
case EIS_DEVICE_TYPE_VIRTUAL:
break;
case EIS_DEVICE_TYPE_PHYSICAL:
log_bug_client(eis_device_get_context(device), "Regions on physical devices are not supported\n");
log_bug_client(eis_device_get_context(device), "Regions on physical devices are not supported");
return NULL;
}
@ -114,7 +114,7 @@ eis_region_add(struct eis_region *region)
if (device->state != EIS_DEVICE_STATE_NEW) {
log_bug_client(eis_device_get_context(device),
"%s: device already (dis)connected\n", __func__);
"%s: device already (dis)connected", __func__);
return;
}

View file

@ -93,7 +93,7 @@ eis_seat_add(struct eis_seat *seat)
case EIS_SEAT_STATE_REMOVED_INTERNALLY:
case EIS_SEAT_STATE_DEAD:
log_bug_client(eis_client_get_context(client),
"%s: seat already added/removed/dead\n", __func__);
"%s: seat already added/removed/dead", __func__);
return;
}
@ -115,7 +115,7 @@ eis_seat_bind(struct eis_seat *seat, uint32_t caps)
case EIS_SEAT_STATE_REMOVED_INTERNALLY:
case EIS_SEAT_STATE_DEAD:
log_bug_client(eis_client_get_context(client),
"%s: seat cannot be bound\n", __func__);
"%s: seat cannot be bound", __func__);
return;
}
@ -161,7 +161,7 @@ eis_seat_remove(struct eis_seat *seat)
case EIS_SEAT_STATE_REMOVED:
case EIS_SEAT_STATE_DEAD:
log_bug_client(eis_client_get_context(client),
"%s: seat already removed\n", __func__);
"%s: seat already removed", __func__);
return;
}

View file

@ -91,7 +91,7 @@ listener_dispatch(struct source *source, void *data)
struct eis_socket *socket = data;
struct eis *eis = eis_socket_parent(socket);
log_debug(eis, "New client connection waiting\n");
log_debug(eis, "New client connection waiting");
int fd = accept4(source_get_fd(source), NULL, NULL, SOCK_NONBLOCK|SOCK_CLOEXEC);
if (fd == -1)
return;

View file

@ -152,7 +152,7 @@ update_event_timestamp(struct eis_event *event, uint64_t time)
case EIS_EVENT_TOUCH_MOTION:
if (event->timestamp != 0) {
log_bug(eis_event_get_context(event),
"Unexpected timestamp for event of type: %s\n",
"Unexpected timestamp for event of type: %s",
eis_event_type_to_string(event->type));
return;
}
@ -160,7 +160,7 @@ update_event_timestamp(struct eis_event *event, uint64_t time)
break;
default:
log_bug(eis_event_get_context(event),
"Unexpected event %s in pending queue event\n",
"Unexpected event %s in pending queue event",
eis_event_type_to_string(event->type));
return;
}
@ -209,7 +209,7 @@ eis_queue_event(struct eis_event *event)
break;
}
log_debug(eis, "queuing %sevent type %s (%u)\n",
log_debug(eis, "queuing %sevent type %s (%u)",
prefix,
eis_event_type_to_string(event->type), event->type);
@ -445,7 +445,7 @@ eis_now(struct eis *eis)
* happening are so slim it's not worth worrying about. Plus,
* if this fails we're likely to be inside ei_device_frame()
* so we should flush a frame event before disconnecting and... */
log_error(eis, "clock_gettime failed: %s\n", strerror(-rc));
log_error(eis, "clock_gettime failed: %s", strerror(-rc));
}
return ts;
}