From 4cd512baa15a17e13858a3d842c738af2fa5f804 Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Fri, 3 Jul 2020 10:39:15 +0200 Subject: Remove trailing dot in log messages Signed-off-by: Marc Schink --- libjaylink/device.c | 112 ++++++++++++++++++++++----------------------- libjaylink/discovery.c | 4 +- libjaylink/discovery_tcp.c | 40 ++++++++-------- libjaylink/discovery_usb.c | 34 +++++++------- libjaylink/emucom.c | 28 ++++++------ libjaylink/fileio.c | 40 ++++++++-------- libjaylink/jtag.c | 22 ++++----- libjaylink/swd.c | 14 +++--- libjaylink/swo.c | 50 ++++++++++---------- libjaylink/target.c | 42 ++++++++--------- libjaylink/transport.c | 14 +++--- libjaylink/transport_tcp.c | 84 +++++++++++++++++----------------- libjaylink/transport_usb.c | 86 +++++++++++++++++----------------- 13 files changed, 285 insertions(+), 285 deletions(-) diff --git a/libjaylink/device.c b/libjaylink/device.c index a7f7001..3477a0f 100644 --- a/libjaylink/device.c +++ b/libjaylink/device.c @@ -149,7 +149,7 @@ JAYLINK_API int jaylink_get_devices(struct jaylink_context *ctx, tmp = allocate_device_list(num); if (!tmp) { - log_err(ctx, "Failed to allocate device list."); + log_err(ctx, "Failed to allocate device list"); return JAYLINK_ERR_MALLOC; } @@ -329,7 +329,7 @@ JAYLINK_API int jaylink_device_get_usb_bus_ports( MAX_USB_PATH_DEPTH); if (ret == LIBUSB_ERROR_OVERFLOW) { - log_err(ctx, "Failed to get port numbers: %s.", + log_err(ctx, "Failed to get port numbers: %s", libusb_error_name(ret)); return JAYLINK_ERR_ARG; } @@ -549,17 +549,17 @@ JAYLINK_API void jaylink_unref_device(struct jaylink_device *dev) if (dev->iface == JAYLINK_HIF_USB) { #ifdef HAVE_LIBUSB log_dbg(ctx, "Device destroyed (bus:address = " - "%03u:%03u).", + "%03u:%03u)", libusb_get_bus_number(dev->usb_dev), libusb_get_device_address(dev->usb_dev)); libusb_unref_device(dev->usb_dev); #endif } else if (dev->iface == JAYLINK_HIF_TCP) { - log_dbg(ctx, "Device destroyed (IPv4 address = %s).", + log_dbg(ctx, "Device destroyed (IPv4 address = %s)", dev->ipv4_address); } else { - log_err(ctx, "BUG: Invalid host interface: %u.", + log_err(ctx, "BUG: Invalid host interface: %u", dev->iface); } @@ -616,7 +616,7 @@ JAYLINK_API int jaylink_open(struct jaylink_device *dev, handle = allocate_device_handle(dev); if (!handle) { - log_err(dev->ctx, "Device handle malloc failed."); + log_err(dev->ctx, "Device handle malloc failed"); return JAYLINK_ERR_MALLOC; } @@ -714,7 +714,7 @@ JAYLINK_API int jaylink_get_firmware_version( ret = transport_start_write_read(devh, 1, 2, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -724,7 +724,7 @@ JAYLINK_API int jaylink_get_firmware_version( ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -732,7 +732,7 @@ JAYLINK_API int jaylink_get_firmware_version( ret = transport_read(devh, buf, 2); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -746,7 +746,7 @@ JAYLINK_API int jaylink_get_firmware_version( ret = transport_start_read(devh, dummy); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -754,14 +754,14 @@ JAYLINK_API int jaylink_get_firmware_version( tmp = malloc(dummy); if (!tmp) { - log_err(ctx, "Firmware version string malloc failed."); + log_err(ctx, "Firmware version string malloc failed"); return JAYLINK_ERR_MALLOC; } ret = transport_read(devh, (uint8_t *)tmp, dummy); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); free(tmp); return ret; @@ -823,7 +823,7 @@ JAYLINK_API int jaylink_get_hardware_info(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 5, length, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -834,7 +834,7 @@ JAYLINK_API int jaylink_get_hardware_info(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 5); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -842,7 +842,7 @@ JAYLINK_API int jaylink_get_hardware_info(struct jaylink_device_handle *devh, ret = transport_read(devh, (uint8_t *)info, length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -901,7 +901,7 @@ JAYLINK_API int jaylink_get_counters(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 5, length, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -912,7 +912,7 @@ JAYLINK_API int jaylink_get_counters(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 5); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -920,7 +920,7 @@ JAYLINK_API int jaylink_get_counters(struct jaylink_device_handle *devh, ret = transport_read(devh, (uint8_t *)values, length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -969,7 +969,7 @@ JAYLINK_API int jaylink_get_hardware_version( ret = transport_start_write_read(devh, 1, 4, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -979,7 +979,7 @@ JAYLINK_API int jaylink_get_hardware_version( ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -987,7 +987,7 @@ JAYLINK_API int jaylink_get_hardware_version( ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1030,7 +1030,7 @@ JAYLINK_API int jaylink_get_hardware_status(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 1, 8, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1040,7 +1040,7 @@ JAYLINK_API int jaylink_get_hardware_status(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1048,7 +1048,7 @@ JAYLINK_API int jaylink_get_hardware_status(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 8); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1105,7 +1105,7 @@ JAYLINK_API int jaylink_get_caps(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 1, JAYLINK_DEV_CAPS_SIZE, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1115,7 +1115,7 @@ JAYLINK_API int jaylink_get_caps(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1123,7 +1123,7 @@ JAYLINK_API int jaylink_get_caps(struct jaylink_device_handle *devh, ret = transport_read(devh, caps, JAYLINK_DEV_CAPS_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1173,7 +1173,7 @@ JAYLINK_API int jaylink_get_extended_caps(struct jaylink_device_handle *devh, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1183,7 +1183,7 @@ JAYLINK_API int jaylink_get_extended_caps(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1191,7 +1191,7 @@ JAYLINK_API int jaylink_get_extended_caps(struct jaylink_device_handle *devh, ret = transport_read(devh, caps, JAYLINK_DEV_EXT_CAPS_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1231,7 +1231,7 @@ JAYLINK_API int jaylink_get_free_memory(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 1, 4, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1241,7 +1241,7 @@ JAYLINK_API int jaylink_get_free_memory(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1249,7 +1249,7 @@ JAYLINK_API int jaylink_get_free_memory(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1294,7 +1294,7 @@ JAYLINK_API int jaylink_read_raw_config(struct jaylink_device_handle *devh, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1304,7 +1304,7 @@ JAYLINK_API int jaylink_read_raw_config(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1312,7 +1312,7 @@ JAYLINK_API int jaylink_read_raw_config(struct jaylink_device_handle *devh, ret = transport_read(devh, config, JAYLINK_DEV_CONFIG_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1353,7 +1353,7 @@ JAYLINK_API int jaylink_write_raw_config(struct jaylink_device_handle *devh, ret = transport_start_write(devh, 1 + JAYLINK_DEV_CONFIG_SIZE, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1363,7 +1363,7 @@ JAYLINK_API int jaylink_write_raw_config(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1371,7 +1371,7 @@ JAYLINK_API int jaylink_write_raw_config(struct jaylink_device_handle *devh, ret = transport_write(devh, config, JAYLINK_DEV_CONFIG_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1548,7 +1548,7 @@ JAYLINK_API int jaylink_register(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 14, REG_MIN_SIZE, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1556,7 +1556,7 @@ JAYLINK_API int jaylink_register(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 14); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1564,7 +1564,7 @@ JAYLINK_API int jaylink_register(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, REG_MIN_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1576,12 +1576,12 @@ JAYLINK_API int jaylink_register(struct jaylink_device_handle *devh, if (num > JAYLINK_MAX_CONNECTIONS) { log_err(ctx, "Maximum number of device connections exceeded: " - "%u.", num); + "%u", num); return JAYLINK_ERR_PROTO; } if (entry_size != REG_CONN_INFO_SIZE) { - log_err(ctx, "Invalid connection entry size: %u bytes.", + log_err(ctx, "Invalid connection entry size: %u bytes", entry_size); return JAYLINK_ERR_PROTO; } @@ -1591,7 +1591,7 @@ JAYLINK_API int jaylink_register(struct jaylink_device_handle *devh, if (size > REG_MAX_SIZE) { log_err(ctx, "Maximum registration information size exceeded: " - "%u bytes.", size); + "%u bytes", size); return JAYLINK_ERR_PROTO; } @@ -1599,7 +1599,7 @@ JAYLINK_API int jaylink_register(struct jaylink_device_handle *devh, ret = transport_start_read(devh, size - REG_MIN_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return JAYLINK_ERR; } @@ -1608,14 +1608,14 @@ JAYLINK_API int jaylink_register(struct jaylink_device_handle *devh, size - REG_MIN_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return JAYLINK_ERR; } } if (!handle) { - log_err(ctx, "Obtained invalid connection handle."); + log_err(ctx, "Obtained invalid connection handle"); return JAYLINK_ERR_PROTO; } @@ -1688,7 +1688,7 @@ JAYLINK_API int jaylink_unregister(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 14, REG_MIN_SIZE, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1696,7 +1696,7 @@ JAYLINK_API int jaylink_unregister(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 14); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1704,7 +1704,7 @@ JAYLINK_API int jaylink_unregister(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, REG_MIN_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -1715,12 +1715,12 @@ JAYLINK_API int jaylink_unregister(struct jaylink_device_handle *devh, if (num > JAYLINK_MAX_CONNECTIONS) { log_err(ctx, "Maximum number of device connections exceeded: " - "%u.", num); + "%u", num); return JAYLINK_ERR_PROTO; } if (entry_size != REG_CONN_INFO_SIZE) { - log_err(ctx, "Invalid connection entry size: %u bytes.", + log_err(ctx, "Invalid connection entry size: %u bytes", entry_size); return JAYLINK_ERR_PROTO; } @@ -1730,7 +1730,7 @@ JAYLINK_API int jaylink_unregister(struct jaylink_device_handle *devh, if (size > REG_MAX_SIZE) { log_err(ctx, "Maximum registration information size exceeded: " - "%u bytes.", size); + "%u bytes", size); return JAYLINK_ERR_PROTO; } @@ -1738,7 +1738,7 @@ JAYLINK_API int jaylink_unregister(struct jaylink_device_handle *devh, ret = transport_start_read(devh, size - REG_MIN_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return JAYLINK_ERR; } @@ -1747,7 +1747,7 @@ JAYLINK_API int jaylink_unregister(struct jaylink_device_handle *devh, size - REG_MIN_SIZE); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return JAYLINK_ERR; } diff --git a/libjaylink/discovery.c b/libjaylink/discovery.c index 1ac96e7..0327700 100644 --- a/libjaylink/discovery.c +++ b/libjaylink/discovery.c @@ -87,7 +87,7 @@ JAYLINK_API int jaylink_discovery_scan(struct jaylink_context *ctx, ret = discovery_usb_scan(ctx); if (ret != JAYLINK_OK) { - log_err(ctx, "USB device discovery failed."); + log_err(ctx, "USB device discovery failed"); return ret; } } @@ -97,7 +97,7 @@ JAYLINK_API int jaylink_discovery_scan(struct jaylink_context *ctx, ret = discovery_tcp_scan(ctx); if (ret != JAYLINK_OK) { - log_err(ctx, "TCP/IP device discovery failed."); + log_err(ctx, "TCP/IP device discovery failed"); return ret; } } diff --git a/libjaylink/discovery_tcp.c b/libjaylink/discovery_tcp.c index 0013ae9..4079169 100644 --- a/libjaylink/discovery_tcp.c +++ b/libjaylink/discovery_tcp.c @@ -160,46 +160,46 @@ static struct jaylink_device *probe_device(struct jaylink_context *ctx, * Use inet_ntoa() instead of inet_ntop() because the latter requires * at least Windows Vista. */ - log_dbg(ctx, "Received advertisement message (IPv4 address = %s).", + log_dbg(ctx, "Received advertisement message (IPv4 address = %s)", inet_ntoa(addr->sin_addr)); if (!parse_adv_message(&tmp, buffer)) { - log_dbg(ctx, "Received invalid advertisement message."); + log_dbg(ctx, "Received invalid advertisement message"); return NULL; } - log_dbg(ctx, "Found device (IPv4 address = %s).", tmp.ipv4_address); - log_dbg(ctx, "Device: MAC address = %02x:%02x:%02x:%02x:%02x:%02x.", + log_dbg(ctx, "Found device (IPv4 address = %s)", tmp.ipv4_address); + log_dbg(ctx, "Device: MAC address = %02x:%02x:%02x:%02x:%02x:%02x", tmp.mac_address[0], tmp.mac_address[1], tmp.mac_address[2], tmp.mac_address[3], tmp.mac_address[4], tmp.mac_address[5]); - log_dbg(ctx, "Device: Serial number = %u.", tmp.serial_number); + log_dbg(ctx, "Device: Serial number = %u", tmp.serial_number); if (tmp.has_product_name) - log_dbg(ctx, "Device: Product = %s.", tmp.product_name); + log_dbg(ctx, "Device: Product = %s", tmp.product_name); if (tmp.has_nickname) - log_dbg(ctx, "Device: Nickname = %s.", tmp.nickname); + log_dbg(ctx, "Device: Nickname = %s", tmp.nickname); dev = find_device(ctx->discovered_devs, &tmp); if (dev) { - log_dbg(ctx, "Ignoring already discovered device."); + log_dbg(ctx, "Ignoring already discovered device"); return NULL; } dev = find_device(ctx->devs, &tmp); if (dev) { - log_dbg(ctx, "Using existing device instance."); + log_dbg(ctx, "Using existing device instance"); return jaylink_ref_device(dev); } - log_dbg(ctx, "Allocating new device instance."); + log_dbg(ctx, "Allocating new device instance"); dev = device_allocate(ctx); if (!dev) { - log_warn(ctx, "Device instance malloc failed."); + log_warn(ctx, "Device instance malloc failed"); return NULL; } @@ -243,7 +243,7 @@ JAYLINK_PRIV int discovery_tcp_scan(struct jaylink_context *ctx) sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sock < 0) { - log_err(ctx, "Failed to create discovery socket."); + log_err(ctx, "Failed to create discovery socket"); return JAYLINK_ERR; } @@ -252,7 +252,7 @@ JAYLINK_PRIV int discovery_tcp_scan(struct jaylink_context *ctx) if (!socket_set_option(sock, SOL_SOCKET, SO_BROADCAST, &opt_value, sizeof(opt_value))) { log_err(ctx, "Failed to enable broadcast option for discovery " - "socket."); + "socket"); socket_close(sock); return JAYLINK_ERR; } @@ -264,7 +264,7 @@ JAYLINK_PRIV int discovery_tcp_scan(struct jaylink_context *ctx) if (!socket_bind(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in))) { - log_err(ctx, "Failed to bind discovery socket."); + log_err(ctx, "Failed to bind discovery socket"); socket_close(sock); return JAYLINK_ERR; } @@ -276,19 +276,19 @@ JAYLINK_PRIV int discovery_tcp_scan(struct jaylink_context *ctx) memset(buf, 0, DISC_MESSAGE_SIZE); memcpy(buf, "Discover", 8); - log_dbg(ctx, "Sending discovery message."); + log_dbg(ctx, "Sending discovery message"); length = DISC_MESSAGE_SIZE; if (!socket_sendto(sock, (char *)buf, &length, 0, (const struct sockaddr *)&addr, sizeof(addr))) { - log_err(ctx, "Failed to send discovery message."); + log_err(ctx, "Failed to send discovery message"); socket_close(sock); return JAYLINK_ERR_IO; } if (length < DISC_MESSAGE_SIZE) { - log_err(ctx, "Only sent %zu bytes of discovery message.", + log_err(ctx, "Only sent %zu bytes of discovery message", length); socket_close(sock); return JAYLINK_ERR_IO; @@ -317,7 +317,7 @@ JAYLINK_PRIV int discovery_tcp_scan(struct jaylink_context *ctx) if (!socket_recvfrom(sock, buf, &length, 0, (struct sockaddr *)&addr, &addr_length)) { log_warn(ctx, "Failed to receive advertisement " - "message."); + "message"); continue; } @@ -340,11 +340,11 @@ JAYLINK_PRIV int discovery_tcp_scan(struct jaylink_context *ctx) socket_close(sock); if (ret < 0) { - log_err(ctx, "select() failed."); + log_err(ctx, "select() failed"); return JAYLINK_ERR; } - log_dbg(ctx, "Found %zu TCP/IP device(s).", num_devs); + log_dbg(ctx, "Found %zu TCP/IP device(s)", num_devs); return JAYLINK_OK; } diff --git a/libjaylink/discovery_usb.c b/libjaylink/discovery_usb.c index 12d35dd..3c9b941 100644 --- a/libjaylink/discovery_usb.c +++ b/libjaylink/discovery_usb.c @@ -147,7 +147,7 @@ static struct jaylink_device *probe_device(struct jaylink_context *ctx, ret = libusb_get_device_descriptor(usb_dev, &desc); if (ret != LIBUSB_SUCCESS) { - log_warn(ctx, "Failed to get device descriptor: %s.", + log_warn(ctx, "Failed to get device descriptor: %s", libusb_error_name(ret)); return NULL; } @@ -169,7 +169,7 @@ static struct jaylink_device *probe_device(struct jaylink_context *ctx, return NULL; log_dbg(ctx, "Found device (VID:PID = %04x:%04x, bus:address = " - "%03u:%03u).", desc.idVendor, desc.idProduct, + "%03u:%03u)", desc.idVendor, desc.idProduct, libusb_get_bus_number(usb_dev), libusb_get_device_address(usb_dev)); @@ -180,15 +180,15 @@ static struct jaylink_device *probe_device(struct jaylink_context *ctx, dev = find_device(ctx, usb_dev); if (dev) { - log_dbg(ctx, "Device: USB address = %u.", dev->usb_address); + log_dbg(ctx, "Device: USB address = %u", dev->usb_address); if (dev->has_serial_number) - log_dbg(ctx, "Device: Serial number = %u.", + log_dbg(ctx, "Device: Serial number = %u", dev->serial_number); else - log_dbg(ctx, "Device: Serial number = N/A."); + log_dbg(ctx, "Device: Serial number = N/A"); - log_dbg(ctx, "Using existing device instance."); + log_dbg(ctx, "Using existing device instance"); return jaylink_ref_device(dev); } @@ -196,7 +196,7 @@ static struct jaylink_device *probe_device(struct jaylink_context *ctx, ret = libusb_open(usb_dev, &usb_devh); if (ret != LIBUSB_SUCCESS) { - log_warn(ctx, "Failed to open device: %s.", + log_warn(ctx, "Failed to open device: %s", libusb_error_name(ret)); return NULL; } @@ -210,31 +210,31 @@ static struct jaylink_device *probe_device(struct jaylink_context *ctx, libusb_close(usb_devh); if (ret < 0) { - log_warn(ctx, "Failed to retrieve serial number: %s.", + log_warn(ctx, "Failed to retrieve serial number: %s", libusb_error_name(ret)); has_serial_number = false; } if (has_serial_number) { if (!parse_serial_number(buf, &serial_number)) { - log_warn(ctx, "Failed to parse serial number."); + log_warn(ctx, "Failed to parse serial number"); return NULL; } } - log_dbg(ctx, "Device: USB address = %u.", usb_address); + log_dbg(ctx, "Device: USB address = %u", usb_address); if (has_serial_number) - log_dbg(ctx, "Device: Serial number = %u.", serial_number); + log_dbg(ctx, "Device: Serial number = %u", serial_number); else - log_dbg(ctx, "Device: Serial number = N/A."); + log_dbg(ctx, "Device: Serial number = N/A"); - log_dbg(ctx, "Allocating new device instance."); + log_dbg(ctx, "Allocating new device instance"); dev = device_allocate(ctx); if (!dev) { - log_warn(ctx, "Device instance malloc failed."); + log_warn(ctx, "Device instance malloc failed"); return NULL; } @@ -258,10 +258,10 @@ JAYLINK_PRIV int discovery_usb_scan(struct jaylink_context *ctx) if (ret == LIBUSB_ERROR_IO) { log_err(ctx, "Failed to retrieve device list: input/output " - "error."); + "error"); return JAYLINK_ERR_IO; } else if (ret < 0) { - log_err(ctx, "Failed to retrieve device list: %s.", + log_err(ctx, "Failed to retrieve device list: %s", libusb_error_name(ret)); return JAYLINK_ERR; } @@ -279,7 +279,7 @@ JAYLINK_PRIV int discovery_usb_scan(struct jaylink_context *ctx) } libusb_free_device_list(devs, true); - log_dbg(ctx, "Found %zu USB device(s).", num); + log_dbg(ctx, "Found %zu USB device(s)", num); return JAYLINK_OK; } diff --git a/libjaylink/emucom.c b/libjaylink/emucom.c index 035cb99..0971da1 100644 --- a/libjaylink/emucom.c +++ b/libjaylink/emucom.c @@ -105,7 +105,7 @@ JAYLINK_API int jaylink_emucom_read(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 10, 4, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -119,7 +119,7 @@ JAYLINK_API int jaylink_emucom_read(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 10); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -127,7 +127,7 @@ JAYLINK_API int jaylink_emucom_read(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -143,14 +143,14 @@ JAYLINK_API int jaylink_emucom_read(struct jaylink_device_handle *devh, } if (tmp & EMUCOM_ERR) { - log_err(ctx, "Failed to read from channel 0x%x: 0x%x.", + log_err(ctx, "Failed to read from channel 0x%x: 0x%x", channel, tmp); return JAYLINK_ERR_DEV; } if (tmp > *length) { log_err(ctx, "Requested at most %u bytes but device " - "returned %u bytes.", *length, tmp); + "returned %u bytes", *length, tmp); return JAYLINK_ERR_PROTO; } @@ -162,7 +162,7 @@ JAYLINK_API int jaylink_emucom_read(struct jaylink_device_handle *devh, ret = transport_start_read(devh, tmp); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -170,7 +170,7 @@ JAYLINK_API int jaylink_emucom_read(struct jaylink_device_handle *devh, ret = transport_read(devh, buffer, tmp); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -221,7 +221,7 @@ JAYLINK_API int jaylink_emucom_write(struct jaylink_device_handle *devh, ret = transport_start_write(devh, 10, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -235,7 +235,7 @@ JAYLINK_API int jaylink_emucom_write(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 10); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -243,7 +243,7 @@ JAYLINK_API int jaylink_emucom_write(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, *length, 4, false); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -251,7 +251,7 @@ JAYLINK_API int jaylink_emucom_write(struct jaylink_device_handle *devh, ret = transport_write(devh, buffer, *length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -259,7 +259,7 @@ JAYLINK_API int jaylink_emucom_write(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -270,14 +270,14 @@ JAYLINK_API int jaylink_emucom_write(struct jaylink_device_handle *devh, return JAYLINK_ERR_DEV_NOT_SUPPORTED; if (tmp & EMUCOM_ERR) { - log_err(ctx, "Failed to write to channel 0x%x: 0x%x.", + log_err(ctx, "Failed to write to channel 0x%x: 0x%x", channel, tmp); return JAYLINK_ERR_DEV; } if (tmp > *length) { log_err(ctx, "Only %u bytes were supposed to be written, but " - "the device reported %u written bytes.", *length, tmp); + "the device reported %u written bytes", *length, tmp); return JAYLINK_ERR_PROTO; } diff --git a/libjaylink/fileio.c b/libjaylink/fileio.c index 933c366..296d152 100644 --- a/libjaylink/fileio.c +++ b/libjaylink/fileio.c @@ -105,7 +105,7 @@ JAYLINK_API int jaylink_file_read(struct jaylink_device_handle *devh, ret = transport_start_write(devh, 18 + filename_length, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -131,7 +131,7 @@ JAYLINK_API int jaylink_file_read(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 18 + filename_length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -139,7 +139,7 @@ JAYLINK_API int jaylink_file_read(struct jaylink_device_handle *devh, ret = transport_start_read(devh, *length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -147,7 +147,7 @@ JAYLINK_API int jaylink_file_read(struct jaylink_device_handle *devh, ret = transport_read(devh, buffer, *length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -155,7 +155,7 @@ JAYLINK_API int jaylink_file_read(struct jaylink_device_handle *devh, ret = transport_start_read(devh, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -163,7 +163,7 @@ JAYLINK_API int jaylink_file_read(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -240,7 +240,7 @@ JAYLINK_API int jaylink_file_write(struct jaylink_device_handle *devh, ret = transport_start_write(devh, 18 + filename_length, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -266,7 +266,7 @@ JAYLINK_API int jaylink_file_write(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 18 + filename_length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -274,7 +274,7 @@ JAYLINK_API int jaylink_file_write(struct jaylink_device_handle *devh, ret = transport_start_write(devh, *length, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -282,7 +282,7 @@ JAYLINK_API int jaylink_file_write(struct jaylink_device_handle *devh, ret = transport_write(devh, buffer, *length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -290,7 +290,7 @@ JAYLINK_API int jaylink_file_write(struct jaylink_device_handle *devh, ret = transport_start_read(devh, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -298,7 +298,7 @@ JAYLINK_API int jaylink_file_write(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -359,7 +359,7 @@ JAYLINK_API int jaylink_file_get_size(struct jaylink_device_handle *devh, ret = transport_start_write(devh, 6 + length, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -377,7 +377,7 @@ JAYLINK_API int jaylink_file_get_size(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 6 + length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -385,7 +385,7 @@ JAYLINK_API int jaylink_file_get_size(struct jaylink_device_handle *devh, ret = transport_start_read(devh, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -393,7 +393,7 @@ JAYLINK_API int jaylink_file_get_size(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -451,7 +451,7 @@ JAYLINK_API int jaylink_file_delete(struct jaylink_device_handle *devh, ret = transport_start_write(devh, 6 + length, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -469,7 +469,7 @@ JAYLINK_API int jaylink_file_delete(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 6 + length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -477,7 +477,7 @@ JAYLINK_API int jaylink_file_delete(struct jaylink_device_handle *devh, ret = transport_start_read(devh, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -485,7 +485,7 @@ JAYLINK_API int jaylink_file_delete(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } diff --git a/libjaylink/jtag.c b/libjaylink/jtag.c index c0c65de..7080c97 100644 --- a/libjaylink/jtag.c +++ b/libjaylink/jtag.c @@ -108,7 +108,7 @@ JAYLINK_API int jaylink_jtag_io(struct jaylink_device_handle *devh, read_length, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -120,7 +120,7 @@ JAYLINK_API int jaylink_jtag_io(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -128,7 +128,7 @@ JAYLINK_API int jaylink_jtag_io(struct jaylink_device_handle *devh, ret = transport_write(devh, tms, num_bytes); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -136,7 +136,7 @@ JAYLINK_API int jaylink_jtag_io(struct jaylink_device_handle *devh, ret = transport_write(devh, tdi, num_bytes); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -144,7 +144,7 @@ JAYLINK_API int jaylink_jtag_io(struct jaylink_device_handle *devh, ret = transport_read(devh, tdo, num_bytes); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -155,7 +155,7 @@ JAYLINK_API int jaylink_jtag_io(struct jaylink_device_handle *devh, ret = transport_read(devh, &status, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -163,7 +163,7 @@ JAYLINK_API int jaylink_jtag_io(struct jaylink_device_handle *devh, if (status == JTAG_IO_ERR_NO_MEMORY) { return JAYLINK_ERR_DEV_NO_MEMORY; } else if (status > 0) { - log_err(ctx, "JTAG I/O operation failed: 0x%x.", status); + log_err(ctx, "JTAG I/O operation failed: 0x%x", status); return JAYLINK_ERR_DEV; } @@ -196,7 +196,7 @@ JAYLINK_API int jaylink_jtag_clear_trst(struct jaylink_device_handle *devh) ret = transport_start_write(devh, 1, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -206,7 +206,7 @@ JAYLINK_API int jaylink_jtag_clear_trst(struct jaylink_device_handle *devh) ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -240,7 +240,7 @@ JAYLINK_API int jaylink_jtag_set_trst(struct jaylink_device_handle *devh) ret = transport_start_write(devh, 1, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -250,7 +250,7 @@ JAYLINK_API int jaylink_jtag_set_trst(struct jaylink_device_handle *devh) ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } diff --git a/libjaylink/swd.c b/libjaylink/swd.c index 29265b7..4631dd5 100644 --- a/libjaylink/swd.c +++ b/libjaylink/swd.c @@ -88,7 +88,7 @@ JAYLINK_API int jaylink_swd_io(struct jaylink_device_handle *devh, num_bytes + 1, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -100,7 +100,7 @@ JAYLINK_API int jaylink_swd_io(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -108,7 +108,7 @@ JAYLINK_API int jaylink_swd_io(struct jaylink_device_handle *devh, ret = transport_write(devh, direction, num_bytes); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -116,7 +116,7 @@ JAYLINK_API int jaylink_swd_io(struct jaylink_device_handle *devh, ret = transport_write(devh, out, num_bytes); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -124,7 +124,7 @@ JAYLINK_API int jaylink_swd_io(struct jaylink_device_handle *devh, ret = transport_read(devh, in, num_bytes); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -132,7 +132,7 @@ JAYLINK_API int jaylink_swd_io(struct jaylink_device_handle *devh, ret = transport_read(devh, &status, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -140,7 +140,7 @@ JAYLINK_API int jaylink_swd_io(struct jaylink_device_handle *devh, if (status == SWD_IO_ERR_NO_MEMORY) { return JAYLINK_ERR_DEV_NO_MEMORY; } else if (status > 0) { - log_err(ctx, "SWD I/O operation failed: 0x%x.", status); + log_err(ctx, "SWD I/O operation failed: 0x%x", status); return JAYLINK_ERR_DEV; } diff --git a/libjaylink/swo.c b/libjaylink/swo.c index 6037f64..39fcad8 100644 --- a/libjaylink/swo.c +++ b/libjaylink/swo.c @@ -86,7 +86,7 @@ JAYLINK_API int jaylink_swo_start(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 21, 4, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -111,7 +111,7 @@ JAYLINK_API int jaylink_swo_start(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 21); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -119,7 +119,7 @@ JAYLINK_API int jaylink_swo_start(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -127,7 +127,7 @@ JAYLINK_API int jaylink_swo_start(struct jaylink_device_handle *devh, status = buffer_get_u32(buf, 0); if (status > 0) { - log_err(ctx, "Failed to start capture: 0x%x.", status); + log_err(ctx, "Failed to start capture: 0x%x", status); return JAYLINK_ERR_DEV; } @@ -167,7 +167,7 @@ JAYLINK_API int jaylink_swo_stop(struct jaylink_device_handle *devh) ret = transport_start_write_read(devh, 3, 4, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -179,7 +179,7 @@ JAYLINK_API int jaylink_swo_stop(struct jaylink_device_handle *devh) ret = transport_write(devh, buf, 3); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -187,7 +187,7 @@ JAYLINK_API int jaylink_swo_stop(struct jaylink_device_handle *devh) ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -195,7 +195,7 @@ JAYLINK_API int jaylink_swo_stop(struct jaylink_device_handle *devh) status = buffer_get_u32(buf, 0); if (status > 0) { - log_err(ctx, "Failed to stop capture: 0x%x.", status); + log_err(ctx, "Failed to stop capture: 0x%x", status); return JAYLINK_ERR_DEV; } @@ -243,7 +243,7 @@ JAYLINK_API int jaylink_swo_read(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 9, 8, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -260,7 +260,7 @@ JAYLINK_API int jaylink_swo_read(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 9); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -268,7 +268,7 @@ JAYLINK_API int jaylink_swo_read(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 8); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -278,7 +278,7 @@ JAYLINK_API int jaylink_swo_read(struct jaylink_device_handle *devh, if (tmp > *length) { log_err(ctx, "Received %u bytes but only %u bytes were " - "requested.", tmp, *length); + "requested", tmp, *length); return JAYLINK_ERR_PROTO; } @@ -288,7 +288,7 @@ JAYLINK_API int jaylink_swo_read(struct jaylink_device_handle *devh, ret = transport_start_read(devh, tmp); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -296,14 +296,14 @@ JAYLINK_API int jaylink_swo_read(struct jaylink_device_handle *devh, ret = transport_read(devh, buffer, tmp); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } } if (status > 0) { - log_err(ctx, "Failed to read data: 0x%x.", status); + log_err(ctx, "Failed to read data: 0x%x", status); return JAYLINK_ERR_DEV; } @@ -361,7 +361,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 9, 4, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -378,7 +378,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 9); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -386,7 +386,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -394,7 +394,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, tmp = buffer_get_u32(buf, 0); if (tmp & SWO_ERR) { - log_err(ctx, "Failed to retrieve speed information: 0x%x.", + log_err(ctx, "Failed to retrieve speed information: 0x%x", tmp); return JAYLINK_ERR_DEV; } @@ -402,7 +402,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, length = tmp; if (length != 28) { - log_err(ctx, "Unexpected number of bytes received: %u.", + log_err(ctx, "Unexpected number of bytes received: %u", length); return JAYLINK_ERR_PROTO; } @@ -411,7 +411,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, ret = transport_start_read(devh, length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_read() failed: %s.", + log_err(ctx, "transport_start_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -419,7 +419,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, length); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -428,7 +428,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, speed->min_div = buffer_get_u32(buf, 8); if (!speed->min_div) { - log_err(ctx, "Minimum frequency divider is zero."); + log_err(ctx, "Minimum frequency divider is zero"); return JAYLINK_ERR_PROTO; } @@ -436,7 +436,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, if (speed->max_div < speed->min_div) { log_err(ctx, "Maximum frequency divider is less than minimum " - "frequency divider."); + "frequency divider"); return JAYLINK_ERR_PROTO; } @@ -445,7 +445,7 @@ JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, if (speed->max_prescaler < speed->min_prescaler) { log_err(ctx, "Maximum prescaler is less than minimum " - "prescaler."); + "prescaler"); return JAYLINK_ERR_PROTO; } diff --git a/libjaylink/target.c b/libjaylink/target.c index 264335b..1f7244e 100644 --- a/libjaylink/target.c +++ b/libjaylink/target.c @@ -74,7 +74,7 @@ JAYLINK_API int jaylink_set_speed(struct jaylink_device_handle *devh, ret = transport_start_write(devh, 3, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -85,7 +85,7 @@ JAYLINK_API int jaylink_set_speed(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 3); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -140,7 +140,7 @@ JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 1, 6, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -150,7 +150,7 @@ JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -158,7 +158,7 @@ JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 6); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -166,7 +166,7 @@ JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, div = buffer_get_u16(buf, 4); if (!div) { - log_err(ctx, "Minimum frequency divider is zero."); + log_err(ctx, "Minimum frequency divider is zero"); return JAYLINK_ERR_PROTO; } @@ -226,7 +226,7 @@ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, ret = transport_start_write_read(devh, 2, 4, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -237,7 +237,7 @@ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 2); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -245,7 +245,7 @@ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -294,7 +294,7 @@ JAYLINK_API int jaylink_get_available_interfaces( ret = transport_start_write_read(devh, 2, 4, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -305,7 +305,7 @@ JAYLINK_API int jaylink_get_available_interfaces( ret = transport_write(devh, buf, 2); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -313,7 +313,7 @@ JAYLINK_API int jaylink_get_available_interfaces( ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -361,7 +361,7 @@ JAYLINK_API int jaylink_get_selected_interface( ret = transport_start_write_read(devh, 2, 4, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write_read() failed: %s.", + log_err(ctx, "transport_start_write_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -372,7 +372,7 @@ JAYLINK_API int jaylink_get_selected_interface( ret = transport_write(devh, buf, 2); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -380,7 +380,7 @@ JAYLINK_API int jaylink_get_selected_interface( ret = transport_read(devh, buf, 4); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_read() failed: %s.", + log_err(ctx, "transport_read() failed: %s", jaylink_strerror(ret)); return ret; } @@ -416,7 +416,7 @@ JAYLINK_API int jaylink_clear_reset(struct jaylink_device_handle *devh) ret = transport_start_write(devh, 1, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -426,7 +426,7 @@ JAYLINK_API int jaylink_clear_reset(struct jaylink_device_handle *devh) ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -460,7 +460,7 @@ JAYLINK_API int jaylink_set_reset(struct jaylink_device_handle *devh) ret = transport_start_write(devh, 1, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_write() failed: %s.", + log_err(ctx, "transport_start_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -470,7 +470,7 @@ JAYLINK_API int jaylink_set_reset(struct jaylink_device_handle *devh) ret = transport_write(devh, buf, 1); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } @@ -513,7 +513,7 @@ JAYLINK_API int jaylink_set_target_power(struct jaylink_device_handle *devh, ret = transport_start_write(devh, 2, true); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_start_wrte() failed: %s.", + log_err(ctx, "transport_start_wrte() failed: %s", jaylink_strerror(ret)); return ret; } @@ -524,7 +524,7 @@ JAYLINK_API int jaylink_set_target_power(struct jaylink_device_handle *devh, ret = transport_write(devh, buf, 2); if (ret != JAYLINK_OK) { - log_err(ctx, "transport_write() failed: %s.", + log_err(ctx, "transport_write() failed: %s", jaylink_strerror(ret)); return ret; } diff --git a/libjaylink/transport.c b/libjaylink/transport.c index 0c276b3..ad9d6f5 100644 --- a/libjaylink/transport.c +++ b/libjaylink/transport.c @@ -60,7 +60,7 @@ JAYLINK_PRIV int transport_open(struct jaylink_device_handle *devh) ret = transport_tcp_open(devh); break; default: - log_err(devh->dev->ctx, "BUG: Invalid host interface: %u.", + log_err(devh->dev->ctx, "BUG: Invalid host interface: %u", devh->dev->iface); return JAYLINK_ERR; } @@ -93,7 +93,7 @@ JAYLINK_PRIV int transport_close(struct jaylink_device_handle *devh) ret = transport_tcp_close(devh); break; default: - log_err(devh->dev->ctx, "BUG: Invalid host interface: %u.", + log_err(devh->dev->ctx, "BUG: Invalid host interface: %u", devh->dev->iface); return JAYLINK_ERR; } @@ -131,7 +131,7 @@ JAYLINK_PRIV int transport_start_write(struct jaylink_device_handle *devh, ret = transport_tcp_start_write(devh, length, has_command); break; default: - log_err(devh->dev->ctx, "BUG: Invalid host interface: %u.", + log_err(devh->dev->ctx, "BUG: Invalid host interface: %u", devh->dev->iface); return JAYLINK_ERR; } @@ -167,7 +167,7 @@ JAYLINK_PRIV int transport_start_read(struct jaylink_device_handle *devh, ret = transport_tcp_start_read(devh, length); break; default: - log_err(devh->dev->ctx, "BUG: Invalid host interface: %u.", + log_err(devh->dev->ctx, "BUG: Invalid host interface: %u", devh->dev->iface); return JAYLINK_ERR; } @@ -212,7 +212,7 @@ JAYLINK_PRIV int transport_start_write_read(struct jaylink_device_handle *devh, read_length, has_command); break; default: - log_err(devh->dev->ctx, "BUG: Invalid host interface: %u.", + log_err(devh->dev->ctx, "BUG: Invalid host interface: %u", devh->dev->iface); return JAYLINK_ERR; } @@ -258,7 +258,7 @@ JAYLINK_PRIV int transport_write(struct jaylink_device_handle *devh, ret = transport_tcp_write(devh, buffer, length); break; default: - log_err(devh->dev->ctx, "BUG: Invalid host interface: %u.", + log_err(devh->dev->ctx, "BUG: Invalid host interface: %u", devh->dev->iface); return JAYLINK_ERR; } @@ -300,7 +300,7 @@ JAYLINK_PRIV int transport_read(struct jaylink_device_handle *devh, ret = transport_tcp_read(devh, buffer, length); break; default: - log_err(devh->dev->ctx, "BUG: Invalid host interface: %u.", + log_err(devh->dev->ctx, "BUG: Invalid host interface: %u", devh->dev->iface); return JAYLINK_ERR; } diff --git a/libjaylink/transport_tcp.c b/libjaylink/transport_tcp.c index f84b105..1ba978a 100644 --- a/libjaylink/transport_tcp.c +++ b/libjaylink/transport_tcp.c @@ -82,7 +82,7 @@ static int initialize_handle(struct jaylink_device_handle *devh) devh->buffer = malloc(devh->buffer_size); if (!devh->buffer) { - log_err(ctx, "Transport buffer malloc failed."); + log_err(ctx, "Transport buffer malloc failed"); return JAYLINK_ERR_MALLOC; } @@ -113,18 +113,18 @@ static int _recv(struct jaylink_device_handle *devh, uint8_t *buffer, tmp = length; if (!socket_recv(devh->sock, buffer, &tmp, 0)) { - log_err(ctx, "Failed to receive data from device."); + log_err(ctx, "Failed to receive data from device"); return JAYLINK_ERR_IO; } else if (!tmp) { log_err(ctx, "Failed to receive data from device: " - "remote connection closed."); + "remote connection closed"); return JAYLINK_ERR_IO; } buffer += tmp; length -= tmp; - log_dbgio(ctx, "Received %zu bytes from device.", tmp); + log_dbgio(ctx, "Received %zu bytes from device", tmp); } return JAYLINK_OK; @@ -144,35 +144,35 @@ static int handle_server_hello(struct jaylink_device_handle *devh) ret = _recv(devh, buf, sizeof(buf)); if (ret != JAYLINK_OK) { - log_err(ctx, "Failed to receive hello message."); + log_err(ctx, "Failed to receive hello message"); return ret; } if (buf[0] == RESP_MAX_CONNECTIONS) { - log_err(ctx, "Maximum number of connections reached."); + log_err(ctx, "Maximum number of connections reached"); return JAYLINK_ERR; } if (buf[0] != CMD_SERVER) { - log_err(ctx, "Invalid hello message received."); + log_err(ctx, "Invalid hello message received"); return JAYLINK_ERR_PROTO; } proto_version = buffer_get_u16(buf, 1); - log_dbg(ctx, "Protocol version: 0x%04x.", proto_version); + log_dbg(ctx, "Protocol version: 0x%04x", proto_version); length = buf[3]; ret = _recv(devh, (uint8_t *)name, length); if (ret != JAYLINK_OK) { - log_err(ctx, "Failed to receive server name."); + log_err(ctx, "Failed to receive server name"); return ret; } name[length] = '\0'; - log_dbg(ctx, "Server name: %s.", name); + log_dbg(ctx, "Server name: %s", name); return JAYLINK_OK; } @@ -189,7 +189,7 @@ static int set_socket_timeouts(struct jaylink_device_handle *devh) if (!socket_set_option(devh->sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout))) { - log_err(ctx, "Failed to set socket receive timeout."); + log_err(ctx, "Failed to set socket receive timeout"); return JAYLINK_ERR; } @@ -197,7 +197,7 @@ static int set_socket_timeouts(struct jaylink_device_handle *devh) if (!socket_set_option(devh->sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout))) { - log_err(ctx, "Failed to set socket send timeout."); + log_err(ctx, "Failed to set socket send timeout"); return JAYLINK_ERR; } #else @@ -208,7 +208,7 @@ static int set_socket_timeouts(struct jaylink_device_handle *devh) if (!socket_set_option(devh->sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval))) { - log_err(ctx, "Failed to set socket receive timeout."); + log_err(ctx, "Failed to set socket receive timeout"); return JAYLINK_ERR; } @@ -217,7 +217,7 @@ static int set_socket_timeouts(struct jaylink_device_handle *devh) if (!socket_set_option(devh->sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval))) { - log_err(ctx, "Failed to set socket send timeout."); + log_err(ctx, "Failed to set socket send timeout"); return JAYLINK_ERR; } #endif @@ -236,13 +236,13 @@ JAYLINK_PRIV int transport_tcp_open(struct jaylink_device_handle *devh) dev = devh->dev; ctx = dev->ctx; - log_dbg(ctx, "Trying to open device (IPv4 address = %s).", + log_dbg(ctx, "Trying to open device (IPv4 address = %s)", dev->ipv4_address); ret = initialize_handle(devh); if (ret != JAYLINK_OK) { - log_err(ctx, "Initialize device handle failed."); + log_err(ctx, "Initialize device handle failed"); return ret; } @@ -254,7 +254,7 @@ JAYLINK_PRIV int transport_tcp_open(struct jaylink_device_handle *devh) ret = getaddrinfo(dev->ipv4_address, PORT_STRING, &hints, &info); if (ret != 0) { - log_err(ctx, "Address lookup failed."); + log_err(ctx, "Address lookup failed"); cleanup_handle(devh); return JAYLINK_ERR; } @@ -277,12 +277,12 @@ JAYLINK_PRIV int transport_tcp_open(struct jaylink_device_handle *devh) freeaddrinfo(info); if (sock < 0) { - log_err(ctx, "Failed to open device."); + log_err(ctx, "Failed to open device"); cleanup_handle(devh); return JAYLINK_ERR; } - log_dbg(ctx, "Device opened successfully."); + log_dbg(ctx, "Device opened successfully"); devh->sock = sock; ret = set_socket_timeouts(devh); @@ -310,12 +310,12 @@ JAYLINK_PRIV int transport_tcp_close(struct jaylink_device_handle *devh) ctx = devh->dev->ctx; - log_dbg(ctx, "Closing device (IPv4 address = %s).", + log_dbg(ctx, "Closing device (IPv4 address = %s)", devh->dev->ipv4_address); cleanup_handle(devh); - log_dbg(ctx, "Device closed successfully."); + log_dbg(ctx, "Device closed successfully"); return JAYLINK_OK; } @@ -330,15 +330,15 @@ JAYLINK_PRIV int transport_tcp_start_write(struct jaylink_device_handle *devh, ctx = devh->dev->ctx; - log_dbgio(ctx, "Starting write operation (length = %zu bytes).", + log_dbgio(ctx, "Starting write operation (length = %zu bytes)", length); if (devh->write_pos > 0) log_warn(ctx, "Last write operation left %zu bytes in the " - "buffer.", devh->write_pos); + "buffer", devh->write_pos); if (devh->write_length > 0) - log_warn(ctx, "Last write operation was not performed."); + log_warn(ctx, "Last write operation was not performed"); devh->write_length = length; devh->write_pos = 0; @@ -361,15 +361,15 @@ JAYLINK_PRIV int transport_tcp_start_read(struct jaylink_device_handle *devh, ctx = devh->dev->ctx; - log_dbgio(ctx, "Starting read operation (length = %zu bytes).", + log_dbgio(ctx, "Starting read operation (length = %zu bytes)", length); if (devh->bytes_available > 0) log_dbg(ctx, "Last read operation left %zu bytes in the " - "buffer.", devh->bytes_available); + "buffer", devh->bytes_available); if (devh->read_length > 0) - log_warn(ctx, "Last read operation left %zu bytes.", + log_warn(ctx, "Last read operation left %zu bytes", devh->read_length); devh->read_length = length; @@ -389,21 +389,21 @@ JAYLINK_PRIV int transport_tcp_start_write_read( ctx = devh->dev->ctx; log_dbgio(ctx, "Starting write / read operation (length = " - "%zu / %zu bytes).", write_length, read_length); + "%zu / %zu bytes)", write_length, read_length); if (devh->write_pos > 0) log_warn(ctx, "Last write operation left %zu bytes in the " - "buffer.", devh->write_pos); + "buffer", devh->write_pos); if (devh->write_length > 0) - log_warn(ctx, "Last write operation was not performed."); + log_warn(ctx, "Last write operation was not performed"); if (devh->bytes_available > 0) log_warn(ctx, "Last read operation left %zu bytes in the " - "buffer.", devh->bytes_available); + "buffer", devh->bytes_available); if (devh->read_length > 0) - log_warn(ctx, "Last read operation left %zu bytes.", + log_warn(ctx, "Last read operation left %zu bytes", devh->read_length); devh->write_length = write_length; @@ -433,14 +433,14 @@ static int _send(struct jaylink_device_handle *devh, const uint8_t *buffer, tmp = length; if (!socket_send(devh->sock, buffer, &tmp, 0)) { - log_err(ctx, "Failed to send data to device."); + log_err(ctx, "Failed to send data to device"); return JAYLINK_ERR_IO; } buffer += tmp; length -= tmp; - log_dbgio(ctx, "Sent %zu bytes to device.", tmp); + log_dbgio(ctx, "Sent %zu bytes to device", tmp); } return JAYLINK_OK; @@ -464,7 +464,7 @@ static bool adjust_buffer(struct jaylink_device_handle *devh, size_t size) buffer = realloc(devh->buffer, size); if (!buffer) { - log_err(ctx, "Failed to adjust buffer size to %zu bytes.", + log_err(ctx, "Failed to adjust buffer size to %zu bytes", size); return false; } @@ -472,7 +472,7 @@ static bool adjust_buffer(struct jaylink_device_handle *devh, size_t size) devh->buffer = buffer; devh->buffer_size = size; - log_dbg(ctx, "Adjusted buffer size to %zu bytes.", size); + log_dbg(ctx, "Adjusted buffer size to %zu bytes", size); return true; } @@ -488,7 +488,7 @@ JAYLINK_PRIV int transport_tcp_write(struct jaylink_device_handle *devh, if (length > devh->write_length) { log_err(ctx, "Requested to write %zu bytes but only %zu bytes " - "are expected for the write operation.", length, + "are expected for the write operation", length, devh->write_length); return JAYLINK_ERR_ARG; } @@ -508,7 +508,7 @@ JAYLINK_PRIV int transport_tcp_write(struct jaylink_device_handle *devh, devh->write_length -= length; devh->write_pos += length; - log_dbgio(ctx, "Wrote %zu bytes into buffer.", length); + log_dbgio(ctx, "Wrote %zu bytes into buffer", length); return JAYLINK_OK; } @@ -533,7 +533,7 @@ JAYLINK_PRIV int transport_tcp_write(struct jaylink_device_handle *devh, length -= tmp; buffer += tmp; - log_dbgio(ctx, "Buffer filled up with %zu bytes.", tmp); + log_dbgio(ctx, "Buffer filled up with %zu bytes", tmp); ret = _send(devh, devh->buffer, devh->write_pos + tmp); @@ -558,7 +558,7 @@ JAYLINK_PRIV int transport_tcp_read(struct jaylink_device_handle *devh, if (length > devh->read_length) { log_err(ctx, "Requested to read %zu bytes but only %zu bytes " - "are expected for the read operation.", length, + "are expected for the read operation", length, devh->read_length); return JAYLINK_ERR_ARG; } @@ -570,7 +570,7 @@ JAYLINK_PRIV int transport_tcp_read(struct jaylink_device_handle *devh, devh->bytes_available -= length; devh->read_pos += length; - log_dbgio(ctx, "Read %zu bytes from buffer.", length); + log_dbgio(ctx, "Read %zu bytes from buffer", length); return JAYLINK_OK; } @@ -582,7 +582,7 @@ JAYLINK_PRIV int transport_tcp_read(struct jaylink_device_handle *devh, length -= devh->bytes_available; devh->read_length -= devh->bytes_available; - log_dbgio(ctx, "Read %zu bytes from buffer to flush it.", + log_dbgio(ctx, "Read %zu bytes from buffer to flush it", devh->bytes_available); devh->bytes_available = 0; diff --git a/libjaylink/transport_usb.c b/libjaylink/transport_usb.c index ce84b1c..382702d 100644 --- a/libjaylink/transport_usb.c +++ b/libjaylink/transport_usb.c @@ -65,7 +65,7 @@ static int initialize_handle(struct jaylink_device_handle *devh) ret = libusb_get_active_config_descriptor(devh->dev->usb_dev, &config); if (ret != LIBUSB_SUCCESS) { - log_err(ctx, "Failed to get configuration descriptor: %s.", + log_err(ctx, "Failed to get configuration descriptor: %s", libusb_error_name(ret)); return JAYLINK_ERR; } @@ -91,7 +91,7 @@ static int initialize_handle(struct jaylink_device_handle *devh) } if (!found_interface) { - log_err(ctx, "No suitable interface found."); + log_err(ctx, "No suitable interface found"); libusb_free_config_descriptor(config); return JAYLINK_ERR; } @@ -114,16 +114,16 @@ static int initialize_handle(struct jaylink_device_handle *devh) libusb_free_config_descriptor(config); if (!found_endpoint_in) { - log_err(ctx, "Interface IN endpoint not found."); + log_err(ctx, "Interface IN endpoint not found"); return JAYLINK_ERR; } if (!found_endpoint_out) { - log_err(ctx, "Interface OUT endpoint not found."); + log_err(ctx, "Interface OUT endpoint not found"); return JAYLINK_ERR; } - log_dbg(ctx, "Using endpoint %02x (IN) and %02x (OUT).", + log_dbg(ctx, "Using endpoint %02x (IN) and %02x (OUT)", devh->endpoint_in, devh->endpoint_out); /* Buffer size must be a multiple of CHUNK_SIZE bytes. */ @@ -131,7 +131,7 @@ static int initialize_handle(struct jaylink_device_handle *devh) devh->buffer = malloc(devh->buffer_size); if (!devh->buffer) { - log_err(ctx, "Transport buffer malloc failed."); + log_err(ctx, "Transport buffer malloc failed"); return JAYLINK_ERR_MALLOC; } @@ -160,21 +160,21 @@ JAYLINK_PRIV int transport_usb_open(struct jaylink_device_handle *devh) dev = devh->dev; ctx = dev->ctx; - log_dbg(ctx, "Trying to open device (bus:address = %03u:%03u).", + log_dbg(ctx, "Trying to open device (bus:address = %03u:%03u)", libusb_get_bus_number(dev->usb_dev), libusb_get_device_address(dev->usb_dev)); ret = initialize_handle(devh); if (ret != JAYLINK_OK) { - log_err(ctx, "Initialize device handle failed."); + log_err(ctx, "Initialize device handle failed"); return ret; } ret = libusb_open(dev->usb_dev, &usb_devh); if (ret != LIBUSB_SUCCESS) { - log_err(ctx, "Failed to open device: %s.", + log_err(ctx, "Failed to open device: %s", libusb_error_name(ret)); cleanup_handle(devh); return JAYLINK_ERR; @@ -183,14 +183,14 @@ JAYLINK_PRIV int transport_usb_open(struct jaylink_device_handle *devh) ret = libusb_claim_interface(usb_devh, devh->interface_number); if (ret != LIBUSB_SUCCESS) { - log_err(ctx, "Failed to claim interface: %s.", + log_err(ctx, "Failed to claim interface: %s", libusb_error_name(ret)); cleanup_handle(devh); libusb_close(usb_devh); return JAYLINK_ERR; } - log_dbg(ctx, "Device opened successfully."); + log_dbg(ctx, "Device opened successfully"); devh->usb_devh = usb_devh; @@ -206,7 +206,7 @@ JAYLINK_PRIV int transport_usb_close(struct jaylink_device_handle *devh) dev = devh->dev; ctx = dev->ctx; - log_dbg(ctx, "Closing device (bus:address = %03u:%03u).", + log_dbg(ctx, "Closing device (bus:address = %03u:%03u)", libusb_get_bus_number(dev->usb_dev), libusb_get_device_address(dev->usb_dev)); @@ -216,12 +216,12 @@ JAYLINK_PRIV int transport_usb_close(struct jaylink_device_handle *devh) cleanup_handle(devh); if (ret != LIBUSB_SUCCESS) { - log_err(ctx, "Failed to release interface: %s.", + log_err(ctx, "Failed to release interface: %s", libusb_error_name(ret)); return JAYLINK_ERR; } - log_dbg(ctx, "Device closed successfully."); + log_dbg(ctx, "Device closed successfully"); return JAYLINK_OK; } @@ -238,14 +238,14 @@ JAYLINK_PRIV int transport_usb_start_write(struct jaylink_device_handle *devh, ctx = devh->dev->ctx; - log_dbgio(ctx, "Starting write operation (length = %zu bytes).", length); + log_dbgio(ctx, "Starting write operation (length = %zu bytes)", length); if (devh->write_pos > 0) log_warn(ctx, "Last write operation left %zu bytes in the " - "buffer.", devh->write_pos); + "buffer", devh->write_pos); if (devh->write_length > 0) - log_warn(ctx, "Last write operation was not performed."); + log_warn(ctx, "Last write operation was not performed"); devh->write_length = length; devh->write_pos = 0; @@ -263,15 +263,15 @@ JAYLINK_PRIV int transport_usb_start_read(struct jaylink_device_handle *devh, ctx = devh->dev->ctx; - log_dbgio(ctx, "Starting read operation (length = %zu bytes).", + log_dbgio(ctx, "Starting read operation (length = %zu bytes)", length); if (devh->bytes_available > 0) log_dbg(ctx, "Last read operation left %zu bytes in the " - "buffer.", devh->bytes_available); + "buffer", devh->bytes_available); if (devh->read_length > 0) - log_warn(ctx, "Last read operation left %zu bytes.", + log_warn(ctx, "Last read operation left %zu bytes", devh->read_length); devh->read_length = length; @@ -293,21 +293,21 @@ JAYLINK_PRIV int transport_usb_start_write_read( ctx = devh->dev->ctx; log_dbgio(ctx, "Starting write / read operation (length = " - "%zu / %zu bytes).", write_length, read_length); + "%zu / %zu bytes)", write_length, read_length); if (devh->write_pos > 0) log_warn(ctx, "Last write operation left %zu bytes in the " - "buffer.", devh->write_pos); + "buffer", devh->write_pos); if (devh->write_length > 0) - log_warn(ctx, "Last write operation was not performed."); + log_warn(ctx, "Last write operation was not performed"); if (devh->bytes_available > 0) log_warn(ctx, "Last read operation left %zu bytes in the " - "buffer.", devh->bytes_available); + "buffer", devh->bytes_available); if (devh->read_length > 0) - log_warn(ctx, "Last read operation left %zu bytes.", + log_warn(ctx, "Last read operation left %zu bytes", devh->read_length); devh->write_length = write_length; @@ -341,16 +341,16 @@ static int usb_recv(struct jaylink_device_handle *devh, uint8_t *buffer, if (ret == LIBUSB_ERROR_TIMEOUT) { log_warn(ctx, "Failed to receive data from " - "device: %s.", libusb_error_name(ret)); + "device: %s", libusb_error_name(ret)); tries--; continue; } else if (ret != LIBUSB_SUCCESS) { log_err(ctx, "Failed to receive data from " - "device: %s.", libusb_error_name(ret)); + "device: %s", libusb_error_name(ret)); return JAYLINK_ERR; } - log_dbgio(ctx, "Received %i bytes from device.", transferred); + log_dbgio(ctx, "Received %i bytes from device", transferred); } /* Ignore a possible timeout if at least one byte was received. */ @@ -359,7 +359,7 @@ static int usb_recv(struct jaylink_device_handle *devh, uint8_t *buffer, return JAYLINK_OK; } - log_err(ctx, "Receiving data from device timed out."); + log_err(ctx, "Receiving data from device timed out"); return JAYLINK_ERR_TIMEOUT; } @@ -382,7 +382,7 @@ static bool adjust_buffer(struct jaylink_device_handle *devh, size_t size) buffer = realloc(devh->buffer, size); if (!buffer) { - log_err(ctx, "Failed to adjust buffer size to %zu bytes.", + log_err(ctx, "Failed to adjust buffer size to %zu bytes", size); return false; } @@ -390,7 +390,7 @@ static bool adjust_buffer(struct jaylink_device_handle *devh, size_t size) devh->buffer = buffer; devh->buffer_size = size; - log_dbg(ctx, "Adjusted buffer size to %zu bytes.", size); + log_dbg(ctx, "Adjusted buffer size to %zu bytes", size); return true; } @@ -415,11 +415,11 @@ static int usb_send(struct jaylink_device_handle *devh, const uint8_t *buffer, if (ret == LIBUSB_SUCCESS) { tries = NUM_TIMEOUTS; } else if (ret == LIBUSB_ERROR_TIMEOUT) { - log_warn(ctx, "Failed to send data to device: %s.", + log_warn(ctx, "Failed to send data to device: %s", libusb_error_name(ret)); tries--; } else { - log_err(ctx, "Failed to send data to device: %s.", + log_err(ctx, "Failed to send data to device: %s", libusb_error_name(ret)); return JAYLINK_ERR; } @@ -427,13 +427,13 @@ static int usb_send(struct jaylink_device_handle *devh, const uint8_t *buffer, buffer += transferred; length -= transferred; - log_dbgio(ctx, "Sent %i bytes to device.", transferred); + log_dbgio(ctx, "Sent %i bytes to device", transferred); } if (!length) return JAYLINK_OK; - log_err(ctx, "Sending data to device timed out."); + log_err(ctx, "Sending data to device timed out"); return JAYLINK_ERR_TIMEOUT; } @@ -451,7 +451,7 @@ JAYLINK_PRIV int transport_usb_write(struct jaylink_device_handle *devh, if (length > devh->write_length) { log_err(ctx, "Requested to write %zu bytes but only %zu bytes " - "are expected for the write operation.", length, + "are expected for the write operation", length, devh->write_length); return JAYLINK_ERR_ARG; } @@ -471,7 +471,7 @@ JAYLINK_PRIV int transport_usb_write(struct jaylink_device_handle *devh, devh->write_length -= length; devh->write_pos += length; - log_dbgio(ctx, "Wrote %zu bytes into buffer.", length); + log_dbgio(ctx, "Wrote %zu bytes into buffer", length); return JAYLINK_OK; } @@ -506,7 +506,7 @@ JAYLINK_PRIV int transport_usb_write(struct jaylink_device_handle *devh, length -= tmp; buffer += tmp; - log_dbgio(ctx, "Buffer filled up with %zu bytes.", tmp); + log_dbgio(ctx, "Buffer filled up with %zu bytes", tmp); } /* Send buffered data to the device. */ @@ -535,7 +535,7 @@ JAYLINK_PRIV int transport_usb_read(struct jaylink_device_handle *devh, if (length > devh->read_length) { log_err(ctx, "Requested to read %zu bytes but only %zu bytes " - "are expected for the read operation.", length, + "are expected for the read operation", length, devh->read_length); return JAYLINK_ERR_ARG; } @@ -547,7 +547,7 @@ JAYLINK_PRIV int transport_usb_read(struct jaylink_device_handle *devh, devh->bytes_available -= length; devh->read_pos += length; - log_dbgio(ctx, "Read %zu bytes from buffer.", length); + log_dbgio(ctx, "Read %zu bytes from buffer", length); return JAYLINK_OK; } @@ -559,7 +559,7 @@ JAYLINK_PRIV int transport_usb_read(struct jaylink_device_handle *devh, length -= devh->bytes_available; devh->read_length -= devh->bytes_available; - log_dbgio(ctx, "Read %zu bytes from buffer to flush it.", + log_dbgio(ctx, "Read %zu bytes from buffer to flush it", devh->bytes_available); devh->bytes_available = 0; @@ -599,7 +599,7 @@ JAYLINK_PRIV int transport_usb_read(struct jaylink_device_handle *devh, length -= tmp; devh->read_length -= tmp; - log_dbgio(ctx, "Read %zu bytes from buffer.", tmp); + log_dbgio(ctx, "Read %zu bytes from buffer", tmp); } else { ret = usb_recv(devh, buffer, &bytes_received); @@ -610,7 +610,7 @@ JAYLINK_PRIV int transport_usb_read(struct jaylink_device_handle *devh, length -= bytes_received; devh->read_length -= bytes_received; - log_dbgio(ctx, "Read %zu bytes from device.", + log_dbgio(ctx, "Read %zu bytes from device", bytes_received); } } -- cgit v1.1