aboutsummaryrefslogtreecommitdiffstats
path: root/o3000_upgrade.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--o3000_upgrade.c32
1 files changed, 16 insertions, 16 deletions
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;
}