From 68ce7ec0559e469f0f218fc3ab97bb5b1ea99fcf Mon Sep 17 00:00:00 2001 From: kieran-kohtz <89012045+kieran-kohtz@users.noreply.github.com> Date: Tue, 8 Mar 2022 16:15:14 +0000 Subject: [PATCH 01/10] Updated jenkins shared library version to v0.18.0 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8b6ed3e..08158ed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,4 @@ -@Library('xmos_jenkins_shared_library@v0.17.0') _ +@Library('xmos_jenkins_shared_library@v0.18.0') _ getApproval() pipeline { From c1c5e719cfa95026bece813593261b553cf8949f Mon Sep 17 00:00:00 2001 From: kieran-kohtz <89012045+kieran-kohtz@users.noreply.github.com> Date: Tue, 8 Mar 2022 16:15:15 +0000 Subject: [PATCH 02/10] Removed Brew Labels --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 08158ed..c3990a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ getApproval() pipeline { agent { - label 'x86_64&&brew&&macOS' + label 'x86_64&&macOS' } environment { REPO = 'lib_device_control' From 79963b69484ddf2b41573038771f86aa35defc00 Mon Sep 17 00:00:00 2001 From: kieran-kohtz <89012045+kieran-kohtz@users.noreply.github.com> Date: Tue, 8 Mar 2022 16:15:15 +0000 Subject: [PATCH 03/10] Removed Brewfile --- Brewfile | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 Brewfile diff --git a/Brewfile b/Brewfile deleted file mode 100644 index 2fd6d0b..0000000 --- a/Brewfile +++ /dev/null @@ -1,7 +0,0 @@ -tap 'homebrew/core' - -brew 'perl' -brew 'cpanm' - -brew 'python@2' -brew 'pipenv' From 68dcf0ce461565443c4b30281df2ab28f2e7df0c Mon Sep 17 00:00:00 2001 From: Huw Percival Date: Fri, 1 Jul 2022 16:22:59 +0100 Subject: [PATCH 04/10] updated usb access to use stderr for errors not hidden behind DBG --- lib_device_control/host/device_access_usb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_device_control/host/device_access_usb.c b/lib_device_control/host/device_access_usb.c index 3687b3f..12be190 100644 --- a/lib_device_control/host/device_access_usb.c +++ b/lib_device_control/host/device_access_usb.c @@ -34,11 +34,11 @@ static const int sync_timeout_ms = 500; void debug_libusb_error(int err_code) { #if defined _WIN32 - printf("libusb_control_transfer returned %s\n", usb_strerror()); + fprintf(stderr, "libusb_control_transfer returned %s\n", usb_strerror()); #elif defined __APPLE__ - printf("libusb_control_transfer returned %s\n", libusb_error_name(err_code)); + fprintf(stderr, "libusb_control_transfer returned %s\n", libusb_error_name(err_code)); #elif defined __linux - printf("libusb_control_transfer returned %d\n", err_code); + fprintf(stderr, "libusb_control_transfer returned %d\n", err_code); #endif } @@ -93,8 +93,8 @@ control_ret_t control_query_version(control_version_t *version) static bool payload_len_exceeds_control_packet_size(size_t payload_len) { if (payload_len > USB_TRANSACTION_MAX_BYTES) { - printf("control transfer of %zd bytes requested\n", payload_len); - printf("maximum control packet size is %d\n", USB_TRANSACTION_MAX_BYTES); + fprintf(stderr, "control transfer of %zd bytes requested\n", payload_len); + fprintf(stderr, "maximum control packet size is %d\n", USB_TRANSACTION_MAX_BYTES); return true; } else { From 6dc37f1e4638217f65c996a6d6312002254b107b Mon Sep 17 00:00:00 2001 From: Huw Percival Date: Tue, 12 Jul 2022 09:45:46 +0100 Subject: [PATCH 05/10] prefix all error messages with Error, change some from stdout. --- .../host/device_access_i2c_rpi.c | 11 ++++---- .../host/device_access_spi_rpi.c | 5 ++-- lib_device_control/host/device_access_usb.c | 25 ++++++++++--------- .../host/device_access_xscope.c | 17 +++++++------ 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/lib_device_control/host/device_access_i2c_rpi.c b/lib_device_control/host/device_access_i2c_rpi.c index 6008048..f355926 100644 --- a/lib_device_control/host/device_access_i2c_rpi.c +++ b/lib_device_control/host/device_access_i2c_rpi.c @@ -18,6 +18,7 @@ //#define DBG(x) x #define DBG(x) +#define PRINT_ERROR(...) fprintf(stderr, "Error : " __VA_ARGS__) /*Note there is an issue with RPI/Jessie where I2C repeated starts are not enabled by default. Try the following at the bash command line to enable them: @@ -38,13 +39,13 @@ control_ret_t control_init_i2c(unsigned char i2c_slave_address) address = i2c_slave_address; if ((fd = open(devName, O_RDWR)) < 0) { // Open port for reading and writing - fprintf(stderr, "Failed to open i2c port: "); + PRINT_ERROR("Failed to open i2c port: "); perror( "" ); return CONTROL_ERROR; } if (ioctl(fd, I2C_SLAVE, address) < 0) { // Set the port options and set the address of the device we wish to speak to - fprintf(stderr, "Unable to set i2c configuration at address 0x%x: ", address); + PRINT_ERROR("Unable to set i2c configuration at address 0x%x: ", address); perror( "" ); return CONTROL_ERROR; } @@ -74,7 +75,7 @@ control_write_command(control_resid_t resid, control_cmd_t cmd, int written = write(fd, buffer_to_send, len); if (written != len){ - fprintf(stderr, "Error writing to i2c. %d of %d bytes sent\n", written, len); + PRINT_ERROR("Error writing to i2c. %d of %d bytes sent\n", written, len); return CONTROL_ERROR; } @@ -90,7 +91,7 @@ control_read_command(control_resid_t resid, control_cmd_t cmd, unsigned char read_hdr[I2C_TRANSACTION_MAX_BYTES]; unsigned len = control_build_i2c_data(read_hdr, resid, cmd, payload, payload_len); if (len != 3){ - fprintf(stderr, "Error building read command section of read_device. len should be 3 but is %d\n", len); + PRINT_ERROR("Error building read command section of read_device. len should be 3 but is %d\n", len); return CONTROL_ERROR; } @@ -121,7 +122,7 @@ control_read_command(control_resid_t resid, control_cmd_t cmd, int errno = ioctl( fd, I2C_RDWR, &rdwr_data ); if ( errno < 0 ) { - fprintf(stderr, "rdwr ioctl error %d: ", errno ); + PRINT_ERROR("rdwr ioctl error %d: ", errno ); perror( "" ); return CONTROL_ERROR; } diff --git a/lib_device_control/host/device_access_spi_rpi.c b/lib_device_control/host/device_access_spi_rpi.c index 7517754..e7e729e 100644 --- a/lib_device_control/host/device_access_spi_rpi.c +++ b/lib_device_control/host/device_access_spi_rpi.c @@ -11,6 +11,7 @@ //#define DBG(x) x #define DBG(x) +#define PRINT_ERROR(...) fprintf(stderr, "Error : " __VA_ARGS__) static unsigned delay_milliseconds; @@ -27,7 +28,7 @@ control_init_spi_pi(spi_mode_t spi_mode, bcm2835SPIClockDivider clock_divider, u { if(!bcm2835_init() || !bcm2835_spi_begin()) { - fprintf(stderr, "bcm2835 initialisation failed. Possibly not running as root\n"); + PRINT_ERROR("bcm2835 initialisation failed. Possibly not running as root\n"); return CONTROL_ERROR; } @@ -86,4 +87,4 @@ control_cleanup_spi(void) return CONTROL_SUCCESS; } -#endif /* USE_SPI && RPI */ \ No newline at end of file +#endif /* USE_SPI && RPI */ diff --git a/lib_device_control/host/device_access_usb.c b/lib_device_control/host/device_access_usb.c index 12be190..b4d8e82 100644 --- a/lib_device_control/host/device_access_usb.c +++ b/lib_device_control/host/device_access_usb.c @@ -17,6 +17,7 @@ //#define DBG(x) x #define DBG(x) +#define PRINT_ERROR(...) fprintf(stderr, "Error : " __VA_ARGS__) static unsigned num_commands = 0; @@ -34,11 +35,11 @@ static const int sync_timeout_ms = 500; void debug_libusb_error(int err_code) { #if defined _WIN32 - fprintf(stderr, "libusb_control_transfer returned %s\n", usb_strerror()); + PRINT_ERROR("libusb_control_transfer returned %s\n", usb_strerror()); #elif defined __APPLE__ - fprintf(stderr, "libusb_control_transfer returned %s\n", libusb_error_name(err_code)); + PRINT_ERROR("libusb_control_transfer returned %s\n", libusb_error_name(err_code)); #elif defined __linux - fprintf(stderr, "libusb_control_transfer returned %d\n", err_code); + PRINT_ERROR("libusb_control_transfer returned %d\n", err_code); #endif } @@ -93,8 +94,8 @@ control_ret_t control_query_version(control_version_t *version) static bool payload_len_exceeds_control_packet_size(size_t payload_len) { if (payload_len > USB_TRANSACTION_MAX_BYTES) { - fprintf(stderr, "control transfer of %zd bytes requested\n", payload_len); - fprintf(stderr, "maximum control packet size is %d\n", USB_TRANSACTION_MAX_BYTES); + PRINT_ERROR("control transfer of %zd bytes requested\n", payload_len); + PRINT_ERROR("maximum control packet size is %d\n", USB_TRANSACTION_MAX_BYTES); return true; } else { @@ -186,7 +187,7 @@ static control_ret_t find_xmos_device(int vendor_id, int product_id) (dev->descriptor.idProduct == product_id)) { devh = usb_open(dev); if (!devh) { - fprintf(stderr, "failed to open device\n"); + PRINT_ERROR("failed to open device\n"); return CONTROL_ERROR; } break; @@ -195,7 +196,7 @@ static control_ret_t find_xmos_device(int vendor_id, int product_id) } if (!devh) { - fprintf(stderr, "could not find device\n"); + PRINT_ERROR("could not find device\n"); return CONTROL_ERROR; } @@ -213,14 +214,14 @@ control_ret_t control_init_usb(int vendor_id, int product_id, int interface_num) int r = usb_set_configuration(devh, 1); if (r < 0) { - fprintf(stderr, "Error setting config 1\n"); + PRINT_ERROR("Error setting config 1\n"); usb_close(devh); return CONTROL_ERROR; } r = usb_claim_interface(devh, interface_num); if (r < 0) { - fprintf(stderr, "Error claiming interface %d %d\n", interface_num, r); + PRINT_ERROR("Error claiming interface %d %d\n", interface_num, r); return CONTROL_ERROR; } @@ -240,7 +241,7 @@ control_ret_t control_init_usb(int vendor_id, int product_id, int interface_num) { int ret = libusb_init(NULL); if (ret < 0) { - fprintf(stderr, "failed to initialise libusb\n"); + PRINT_ERROR("failed to initialise libusb\n"); return CONTROL_ERROR; } @@ -258,12 +259,12 @@ control_ret_t control_init_usb(int vendor_id, int product_id, int interface_num) } if (dev == NULL) { - fprintf(stderr, "could not find device\n"); + PRINT_ERROR("could not find device\n"); return CONTROL_ERROR; } if (libusb_open(dev, &devh) < 0) { - fprintf(stderr, "failed to open device. Ensure adequate permissions\n"); + PRINT_ERROR("failed to open device. Ensure adequate permissions\n"); return CONTROL_ERROR; } diff --git a/lib_device_control/host/device_access_xscope.c b/lib_device_control/host/device_access_xscope.c index f15acfb..6462212 100644 --- a/lib_device_control/host/device_access_xscope.c +++ b/lib_device_control/host/device_access_xscope.c @@ -18,6 +18,7 @@ //#define DBG(x) x #define DBG(x) +#define PRINT_ERROR(...) fprintf(stderr, "Error : " __VA_ARGS__) #define UNUSED_PARAMETER(x) (void)(x) @@ -81,17 +82,17 @@ void record_callback(unsigned int id, unsigned long long timestamp, control_ret_t control_init_xscope(const char *host_str, const char *port_str) { if (xscope_ep_set_print_cb(xscope_print) != XSCOPE_EP_SUCCESS) { - fprintf(stderr, "xscope_ep_set_print_cb failed\n"); + PRINT_ERROR("xscope_ep_set_print_cb failed\n"); return CONTROL_ERROR; } if (xscope_ep_set_register_cb(register_callback) != XSCOPE_EP_SUCCESS) { - fprintf(stderr, "xscope_ep_set_register_cb failed\n"); + PRINT_ERROR("xscope_ep_set_register_cb failed\n"i; return CONTROL_ERROR; } if (xscope_ep_set_record_cb(record_callback) != XSCOPE_EP_SUCCESS) { - fprintf(stderr, "xscope_ep_set_record_cb failed\n"); + PRINT_ERROR("xscope_ep_set_record_cb failed\n"); return CONTROL_ERROR; } @@ -122,7 +123,7 @@ control_ret_t control_query_version(control_version_t *version) record_count = 0; if (xscope_ep_request_upload(len, (unsigned char*)b) != XSCOPE_EP_SUCCESS) { - printf("xscope_ep_request_upload failed\n"); + PRINT_ERROR("xscope_ep_request_upload failed\n"); return CONTROL_ERROR; } @@ -155,8 +156,8 @@ control_ret_t control_query_version(control_version_t *version) static bool upload_len_exceeds_xscope_limit(size_t len) { if (len > XSCOPE_UPLOAD_MAX_BYTES) { - printf("upload of %zd bytes requested\n", len); - printf("maximum upload size is %d\n", XSCOPE_UPLOAD_MAX_BYTES); + PRINT_ERROR("upload of %zd bytes requested\n", len); + PRINT_ERROR("maximum upload size is %d\n", XSCOPE_UPLOAD_MAX_BYTES); return true; } else { @@ -182,7 +183,7 @@ control_write_command(control_resid_t resid, control_cmd_t cmd, record_count = 0; if (xscope_ep_request_upload(len, (unsigned char*)b) != XSCOPE_EP_SUCCESS) { - printf("xscope_ep_request_upload failed\n"); + PRINT_ERROR("xscope_ep_request_upload failed\n"); return CONTROL_ERROR; } // wait for response on xSCOPE probe @@ -212,7 +213,7 @@ control_read_command(control_resid_t resid, control_cmd_t cmd, record_count = 0; if (xscope_ep_request_upload(len, (unsigned char*)b) != XSCOPE_EP_SUCCESS) { - printf("xscope_ep_request_upload failed\n"); + PRINT_ERROR("xscope_ep_request_upload failed\n"); return CONTROL_ERROR; } From d9226b6ae6ba38f2ebe72c668d289957aa3c815a Mon Sep 17 00:00:00 2001 From: Huw Percival Date: Tue, 12 Jul 2022 09:57:06 +0100 Subject: [PATCH 06/10] update version for changelog and build_info --- CHANGELOG.rst | 6 ++++++ lib_device_control/module_build_info | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 40d4b3b..c6fa8ac 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Device control library change log ================================= +4.2.1 +----- + + * FIXED: Some errors were being printed to stdout, now all use + stderr. Common format also adopted + 4.2.0 ----- diff --git a/lib_device_control/module_build_info b/lib_device_control/module_build_info index 596c6e9..d209fca 100644 --- a/lib_device_control/module_build_info +++ b/lib_device_control/module_build_info @@ -1,4 +1,4 @@ -VERSION = 4.2.0 +VERSION = 4.2.1 DEPENDENT_MODULES = lib_xassert(>=4.0.0) \ lib_logging(>=3.0.0) From 44ca5d1421eafae7dbd2e01e9d47d0af971ec084 Mon Sep 17 00:00:00 2001 From: Huw Percival Date: Tue, 12 Jul 2022 10:06:58 +0100 Subject: [PATCH 07/10] fix syntax error --- lib_device_control/host/device_access_xscope.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_device_control/host/device_access_xscope.c b/lib_device_control/host/device_access_xscope.c index 6462212..85152bd 100644 --- a/lib_device_control/host/device_access_xscope.c +++ b/lib_device_control/host/device_access_xscope.c @@ -87,7 +87,7 @@ control_ret_t control_init_xscope(const char *host_str, const char *port_str) } if (xscope_ep_set_register_cb(register_callback) != XSCOPE_EP_SUCCESS) { - PRINT_ERROR("xscope_ep_set_register_cb failed\n"i; + PRINT_ERROR("xscope_ep_set_register_cb failed\n"); return CONTROL_ERROR; } From 9a425b0e678883c195e944cca338cfd5fad3e4b5 Mon Sep 17 00:00:00 2001 From: Huw Percival Date: Tue, 12 Jul 2022 10:14:32 +0100 Subject: [PATCH 08/10] update copyright --- lib_device_control/host/device_access_i2c_rpi.c | 2 +- lib_device_control/host/device_access_spi_rpi.c | 2 +- lib_device_control/host/device_access_usb.c | 2 +- lib_device_control/host/device_access_xscope.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_device_control/host/device_access_i2c_rpi.c b/lib_device_control/host/device_access_i2c_rpi.c index f355926..08c11ff 100644 --- a/lib_device_control/host/device_access_i2c_rpi.c +++ b/lib_device_control/host/device_access_i2c_rpi.c @@ -1,4 +1,4 @@ -// Copyright 2016-2021 XMOS LIMITED. +// Copyright 2016-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #if USE_I2C && RPI diff --git a/lib_device_control/host/device_access_spi_rpi.c b/lib_device_control/host/device_access_spi_rpi.c index e7e729e..33e7e85 100644 --- a/lib_device_control/host/device_access_spi_rpi.c +++ b/lib_device_control/host/device_access_spi_rpi.c @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2017-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #if USE_SPI && RPI diff --git a/lib_device_control/host/device_access_usb.c b/lib_device_control/host/device_access_usb.c index b4d8e82..573639e 100644 --- a/lib_device_control/host/device_access_usb.c +++ b/lib_device_control/host/device_access_usb.c @@ -1,4 +1,4 @@ -// Copyright 2016-2021 XMOS LIMITED. +// Copyright 2016-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #if USE_USB #include diff --git a/lib_device_control/host/device_access_xscope.c b/lib_device_control/host/device_access_xscope.c index 85152bd..c6a9a4c 100644 --- a/lib_device_control/host/device_access_xscope.c +++ b/lib_device_control/host/device_access_xscope.c @@ -1,4 +1,4 @@ -// Copyright 2016-2021 XMOS LIMITED. +// Copyright 2016-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #if USE_XSCOPE From 1ddb6482d5f8eb2dea5de026b89ef0719f1fe8ec Mon Sep 17 00:00:00 2001 From: Huw Percival Date: Tue, 12 Jul 2022 15:31:47 +0100 Subject: [PATCH 09/10] Tidied up error sentences so they read well and have capital letters. --- .../host/device_access_i2c_rpi.c | 8 ++++---- .../host/device_access_spi_rpi.c | 2 +- lib_device_control/host/device_access_usb.c | 18 +++++++++--------- lib_device_control/host/device_access_xscope.c | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib_device_control/host/device_access_i2c_rpi.c b/lib_device_control/host/device_access_i2c_rpi.c index 08c11ff..bf62c5c 100644 --- a/lib_device_control/host/device_access_i2c_rpi.c +++ b/lib_device_control/host/device_access_i2c_rpi.c @@ -75,7 +75,7 @@ control_write_command(control_resid_t resid, control_cmd_t cmd, int written = write(fd, buffer_to_send, len); if (written != len){ - PRINT_ERROR("Error writing to i2c. %d of %d bytes sent\n", written, len); + PRINT_ERROR("Failed to write to i2c. %d of %d bytes sent\n", written, len); return CONTROL_ERROR; } @@ -91,7 +91,7 @@ control_read_command(control_resid_t resid, control_cmd_t cmd, unsigned char read_hdr[I2C_TRANSACTION_MAX_BYTES]; unsigned len = control_build_i2c_data(read_hdr, resid, cmd, payload, payload_len); if (len != 3){ - PRINT_ERROR("Error building read command section of read_device. len should be 3 but is %d\n", len); + PRINT_ERROR("Failed to read command section of read_device. len should be 3 but is %d\n", len); return CONTROL_ERROR; } @@ -122,8 +122,8 @@ control_read_command(control_resid_t resid, control_cmd_t cmd, int errno = ioctl( fd, I2C_RDWR, &rdwr_data ); if ( errno < 0 ) { - PRINT_ERROR("rdwr ioctl error %d: ", errno ); - perror( "" ); + PRINT_ERROR("Failed to transfer data, rdwr ioctl error number %d: ", errno ); + perror( "Error :" ); return CONTROL_ERROR; } diff --git a/lib_device_control/host/device_access_spi_rpi.c b/lib_device_control/host/device_access_spi_rpi.c index 33e7e85..ec35cb3 100644 --- a/lib_device_control/host/device_access_spi_rpi.c +++ b/lib_device_control/host/device_access_spi_rpi.c @@ -28,7 +28,7 @@ control_init_spi_pi(spi_mode_t spi_mode, bcm2835SPIClockDivider clock_divider, u { if(!bcm2835_init() || !bcm2835_spi_begin()) { - PRINT_ERROR("bcm2835 initialisation failed. Possibly not running as root\n"); + PRINT_ERROR("BCM2835 initialisation failed. Possibly not running as root\n"); return CONTROL_ERROR; } diff --git a/lib_device_control/host/device_access_usb.c b/lib_device_control/host/device_access_usb.c index 573639e..8f77cc7 100644 --- a/lib_device_control/host/device_access_usb.c +++ b/lib_device_control/host/device_access_usb.c @@ -94,8 +94,8 @@ control_ret_t control_query_version(control_version_t *version) static bool payload_len_exceeds_control_packet_size(size_t payload_len) { if (payload_len > USB_TRANSACTION_MAX_BYTES) { - PRINT_ERROR("control transfer of %zd bytes requested\n", payload_len); - PRINT_ERROR("maximum control packet size is %d\n", USB_TRANSACTION_MAX_BYTES); + PRINT_ERROR("Control transfer of %zd bytes requested\n", payload_len); + PRINT_ERROR("Maximum control packet size is %d\n", USB_TRANSACTION_MAX_BYTES); return true; } else { @@ -187,7 +187,7 @@ static control_ret_t find_xmos_device(int vendor_id, int product_id) (dev->descriptor.idProduct == product_id)) { devh = usb_open(dev); if (!devh) { - PRINT_ERROR("failed to open device\n"); + PRINT_ERROR("Failed to open device\n"); return CONTROL_ERROR; } break; @@ -196,7 +196,7 @@ static control_ret_t find_xmos_device(int vendor_id, int product_id) } if (!devh) { - PRINT_ERROR("could not find device\n"); + PRINT_ERROR("Could not find device\n"); return CONTROL_ERROR; } @@ -214,14 +214,14 @@ control_ret_t control_init_usb(int vendor_id, int product_id, int interface_num) int r = usb_set_configuration(devh, 1); if (r < 0) { - PRINT_ERROR("Error setting config 1\n"); + PRINT_ERROR("Failed to set config 1\n"); usb_close(devh); return CONTROL_ERROR; } r = usb_claim_interface(devh, interface_num); if (r < 0) { - PRINT_ERROR("Error claiming interface %d %d\n", interface_num, r); + PRINT_ERROR("Failed to claim interface %d %d\n", interface_num, r); return CONTROL_ERROR; } @@ -241,7 +241,7 @@ control_ret_t control_init_usb(int vendor_id, int product_id, int interface_num) { int ret = libusb_init(NULL); if (ret < 0) { - PRINT_ERROR("failed to initialise libusb\n"); + PRINT_ERROR("Failed to initialise libusb\n"); return CONTROL_ERROR; } @@ -259,12 +259,12 @@ control_ret_t control_init_usb(int vendor_id, int product_id, int interface_num) } if (dev == NULL) { - PRINT_ERROR("could not find device\n"); + PRINT_ERROR("Could not find device\n"); return CONTROL_ERROR; } if (libusb_open(dev, &devh) < 0) { - PRINT_ERROR("failed to open device. Ensure adequate permissions\n"); + PRINT_ERROR("Failed to open device. Ensure adequate permissions\n"); return CONTROL_ERROR; } diff --git a/lib_device_control/host/device_access_xscope.c b/lib_device_control/host/device_access_xscope.c index c6a9a4c..70855be 100644 --- a/lib_device_control/host/device_access_xscope.c +++ b/lib_device_control/host/device_access_xscope.c @@ -156,8 +156,8 @@ control_ret_t control_query_version(control_version_t *version) static bool upload_len_exceeds_xscope_limit(size_t len) { if (len > XSCOPE_UPLOAD_MAX_BYTES) { - PRINT_ERROR("upload of %zd bytes requested\n", len); - PRINT_ERROR("maximum upload size is %d\n", XSCOPE_UPLOAD_MAX_BYTES); + PRINT_ERROR("Upload of %zd bytes requested\n", len); + PRINT_ERROR("Maximum upload size is %d\n", XSCOPE_UPLOAD_MAX_BYTES); return true; } else { From 1c8256643148b81c79c939fec09568d0a33e0fb6 Mon Sep 17 00:00:00 2001 From: lucianom Date: Fri, 16 Sep 2022 11:23:34 +0100 Subject: [PATCH 10/10] Fix changelog --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c6fa8ac..85e1093 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,8 +4,8 @@ Device control library change log 4.2.1 ----- - * FIXED: Some errors were being printed to stdout, now all use - stderr. Common format also adopted + * FIXED: Some errors were being printed to stdout, now all use stderr. Common + format also adopted 4.2.0 -----