aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSophia Papagiannaki <papagiannaki@stettbacher.ch>2020-06-15 15:37:35 +0200
committerSophia Papagiannaki <papagiannaki@stettbacher.ch>2020-06-15 15:37:35 +0200
commit8da9dcf4f2387aa7f9c0aad28a87a04de98f3000 (patch)
tree9d0ea2f07f332a14a04e7c56668b8b8beb8a6616
parentVersion 2.1.0 (diff)
downloado3000-driver-8da9dcf4f2387aa7f9c0aad28a87a04de98f3000.tar.gz
o3000-driver-8da9dcf4f2387aa7f9c0aad28a87a04de98f3000.zip
Modified some debug/error messages.
-rw-r--r--o3000.c8
-rw-r--r--o3000_upgrade.c32
2 files changed, 20 insertions, 20 deletions
diff --git a/o3000.c b/o3000.c
index 1ea9f77..37c0ab7 100644
--- a/o3000.c
+++ b/o3000.c
@@ -882,7 +882,7 @@ static int check_sessions(void) {
}
}
if (i < MAX_NUM_SESSION) {
- printf("%s: Session %d is still open\n", __func__, i);
+ printf("%s: Session %d is still open.\n", __func__, i);
return O3000_ERROR_SESSION_STILL_OPEN;
}
return 0;
@@ -902,18 +902,18 @@ int __stdcall o3000_firmware_update(unsigned char *data, int data_len) {
// paranoia checks
if(data == NULL) {
ret = O3000_ERROR_NOT_VALID_ARGUMENT;
- printf("%s: Data pointer is NULL. error: %d\n", __func__, ret);
+ printf("%s: Data pointer is NULL. error code: %d.\n", __func__, ret);
return ret;
}
if(data_len <= 0) {
ret = O3000_ERROR_NOT_VALID_ARGUMENT;
- printf("%s: Length of data is negative. error: %d\n", __func__, ret);
+ printf("%s: Length of data is negative. error code: %d.\n", __func__, ret);
return ret;
}
// checking whether all connections are closed
if ((ret = check_sessions())) {
- printf("%s: Cannot proceed to firmware update: error %d\n", __func__, ret);
+ printf("%s: Cannot proceed to firmware update: error code: %d.\n", __func__, ret);
return ret;
}
diff --git a/o3000_upgrade.c b/o3000_upgrade.c
index b05cf0f..264afc1 100644
--- a/o3000_upgrade.c
+++ b/o3000_upgrade.c
@@ -96,7 +96,7 @@ volatile static bool data_out_xfer_done;
static void LIBUSB_CALL cb_xml_out_xfer_done(struct libusb_transfer *transfer)
{
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
- printf("%s: XML out transfer failed with status %d\n",__func__, transfer->status);
+ printf("Error: %s: XML out transfer failed with status %d.\n",__func__, transfer->status);
}
xml_out_xfer_done = true;
}
@@ -110,7 +110,7 @@ static void LIBUSB_CALL cb_xml_out_xfer_done(struct libusb_transfer *transfer)
static void LIBUSB_CALL cb_data_out_xfer_done(struct libusb_transfer *transfer)
{
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
- printf("%s: Data out transfer failed with status %d\n",__func__, transfer->status);
+ printf("Error: %s: Data out transfer failed with status %d.\n",__func__, transfer->status);
}
data_out_xfer_done = true;
}
@@ -159,7 +159,7 @@ static int send_xml(char *msg, int msg_len)
retval = libusb_submit_transfer(cam_usb.transfer_xml_out);
if(retval) {
- printf("error in %s",__func__);
+ printf("Error: %s: Failed to send XML packet.\n", __func__);
return -1;
}
return 0;
@@ -189,7 +189,7 @@ static int send_data(unsigned char *data_buf, int data_len)
retval = libusb_submit_transfer(cam_usb.transfer_data_out);
if(retval) {
- printf("error in %s",__func__);
+ printf("Error: %s: Failed to send binary data packet.\n", __func__);
return -1;
}
return 0;
@@ -214,7 +214,7 @@ static enum cam_mode_t usb_open(void)
int num_app_ids;
if (libusb_init(&cam_usb.ctx) < 0) {
- printf("Error: failed to initialise libusb\n");
+ printf("Error: %s: Failed to initialise libusb.\n", __func__);
return mode;
}
@@ -235,13 +235,13 @@ static enum cam_mode_t usb_open(void)
}
if(retries <= 0) {
- printf("Error: Could not find/open device after %d retries\nAre you root?\n",MAX_RETRIES);
+ printf("Error: %s: Could not find/open device after %d retries\nAre you root?\n", __func__, MAX_RETRIES);
libusb_exit(cam_usb.ctx);
return mode;
}
if((r = libusb_claim_interface(cam_usb.dev_handle, 0)) < 0) {
- printf("Error: usb_claim_interface error %d\n", r);
+ printf("Error: %s: usb_claim_interface error %d.\n", __func__, r);
libusb_close(cam_usb.dev_handle);
libusb_exit(cam_usb.ctx);
return mode;
@@ -251,7 +251,7 @@ static enum cam_mode_t usb_open(void)
r = libusb_get_device_descriptor (cam_usb.dev, &cam_usb.desc);
if(r) {
- printf("Error: libusb_get_device_descriptor error %d\n", r);
+ printf("Error: %s: libusb_get_device_descriptor error %d.\n", __func__, r);
}
// determine camera mode
@@ -281,11 +281,11 @@ static enum cam_mode_t usb_open(void)
}
if(mode == CM_UNKNOWN) {
- printf("Error: could not make sense out of product %s\n", buf);
+ printf("Error: %s: Could not make sense out of product %s.\n", __func__, buf);
}
} else {
- printf("Error: libusb_get_string_descriptor_ascii error %d\n", r);
+ printf("Error: %s: libusb_get_string_descriptor_ascii error %d.\n", __func__, r);
}
return mode;
@@ -411,7 +411,7 @@ static enum cam_mode_t wait_for_bootloader_mode() {
int i;
enum cam_mode_t cam_mode = CM_UNKNOWN;
- for (i = 0; i > MAX_RETRIES; i++){
+ for (i = 0; i < MAX_RETRIES; i++){
usb_close();
@@ -442,7 +442,7 @@ int firmware_update(unsigned char *data, int data_len) {
cam_mode = usb_open();
if(cam_mode == CM_UNKNOWN) {
- printf("Error: failed to initialise usb\n");
+ printf("Error: %s: Failed to initialise usb.\n", __func__);
return O3000_ERROR_USB_INIT_FAILURE;
}
@@ -476,20 +476,20 @@ int firmware_update(unsigned char *data, int data_len) {
* and then binary data.
*/
create_and_send_update_info(data, data_len);
-
+
cam_mode = send_update_data(data, data_len);
usb_close();
if(cam_mode == CM_APPLICATION) {
- printf("Camera upgrade successful\n");
+ printf("Camera upgrade successful.\n");
}
else if (cam_mode == CM_BOOTLOADER) {
- printf("Error: Camera is still in bootloader mode\n");
+ printf("Error: %s: Camera is still in bootloader mode.\n", __func__);
return O3000_ERROR_OTHER;
}
else if (cam_mode == CM_UNKNOWN) {
- printf("Error: failed to initialise usb\n");
+ printf("Error: %s: Failed to initialise usb.\n", __func__);
return O3000_ERROR_USB_INIT_FAILURE;
}