Skip to content

Commit

Permalink
capitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
mmirbach committed Aug 22, 2021
1 parent b15e916 commit c5aadbd
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions tools/fw-update/rs-fw-update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ std::vector<uint8_t> read_firmware_data(bool is_set, const std::string& file_pat
{
if (!is_set)
{
throw rs2::error("firmware file must be selected");
throw rs2::error("Firmware file must be selected");
}

std::vector<uint8_t> fw_image = read_fw_file(file_path);

if (fw_image.size() == 0)
{
throw rs2::error("failed to read firmware file");
throw rs2::error("Failed to read firmware file");
}

return fw_image;
Expand All @@ -84,31 +84,31 @@ std::vector<uint8_t> read_firmware_data(bool is_set, const std::string& file_pat

void update(rs2::update_device fwu_dev, std::vector<uint8_t> fw_image)
{
std::cout << std::endl << "firmware update started"<< std::endl << std::endl;
std::cout << std::endl << "Firmware update started"<< std::endl << std::endl;

if (ISATTY(FILENO(stdout)))
{
fwu_dev.update(fw_image, [&](const float progress)
{
printf("\rfirmware update progress: %d[%%]", (int)(progress * 100));
printf("\rFirmware update progress: %d[%%]", (int)(progress * 100));
});
}
else
fwu_dev.update(fw_image, [&](const float progress){});

std::cout << std::endl << std::endl << "firmware update done" << std::endl;
std::cout << std::endl << std::endl << "Firmware update done" << std::endl;
}

void list_devices(rs2::context ctx)
{
auto devs = ctx.query_devices();
if (devs.size() == 0)
{
std::cout << std::endl << "there are no connected devices" << std::endl;
std::cout << std::endl << "There are no connected devices" << std::endl;
return;
}

std::cout << std::endl << "connected devices:" << std::endl;
std::cout << std::endl << "Connected devices:" << std::endl;


int counter = 0;
Expand Down Expand Up @@ -157,7 +157,7 @@ int main(int argc, char** argv) try
if (!list_devices_arg.isSet() && !recover_arg.isSet() && !unsigned_arg.isSet() &&
!backup_arg.isSet() && !file_arg.isSet() && !serial_number_arg.isSet())
{
std::cout << std::endl << "nothing to do, run again with -h for help" << std::endl;
std::cout << std::endl << "Nothing to do, run again with -h for help" << std::endl;
list_devices(ctx);
return EXIT_SUCCESS;
}
Expand All @@ -172,14 +172,14 @@ int main(int argc, char** argv) try

if (!file_arg.isSet() && !backup_arg.isSet())
{
std::cout << std::endl << "nothing to do, run again with -h for help" << std::endl;
std::cout << std::endl << "Nothing to do, run again with -h for help" << std::endl;
return EXIT_FAILURE;
}

if (serial_number_arg.isSet())
{
selected_serial_number = serial_number_arg.getValue();
std::cout << std::endl << "search for device with serial number: " << selected_serial_number << std::endl;
std::cout << std::endl << "Search for device with serial number: " << selected_serial_number << std::endl;
}

std::string update_serial_number;
Expand All @@ -189,7 +189,7 @@ int main(int argc, char** argv) try
{
std::vector<uint8_t> fw_image = read_firmware_data(file_arg.isSet(), file_arg.getValue());

std::cout << std::endl << "update to FW: " << file_arg.getValue() << std::endl;
std::cout << std::endl << "Update to FW: " << file_arg.getValue() << std::endl;
auto devs = ctx.query_devices(RS2_PRODUCT_LINE_DEPTH);
rs2::device recovery_device;

Expand Down Expand Up @@ -230,10 +230,10 @@ int main(int argc, char** argv) try
}
}
} );
std::cout << std::endl << "recovering device: " << std::endl;
std::cout << std::endl << "Recovering device: " << std::endl;
print_device_info( recovery_device );
update( recovery_device, fw_image );
std::cout << "waiting for new device..." << std::endl;
std::cout << "Waiting for new device..." << std::endl;
{
std::unique_lock< std::mutex > lk( mutex );
if( cv.wait_for( lk, std::chrono::seconds( 5 ) ) == std::cv_status::timeout )
Expand All @@ -242,12 +242,12 @@ int main(int argc, char** argv) try
return EXIT_FAILURE;
}
}
std::cout << std::endl << "recovery done" << std::endl;
std::cout << std::endl << "Recovery done" << std::endl;
return EXIT_SUCCESS;
}
catch (...)
{
std::cout << std::endl << "failed to recover device" << std::endl;
std::cout << std::endl << "Failed to recover device" << std::endl;
return EXIT_FAILURE;
}
}
Expand Down Expand Up @@ -276,19 +276,19 @@ int main(int argc, char** argv) try

if (!serial_number_arg.isSet() && devs.size() > 1)
{
std::cout << std::endl << "more than one device is connected, serial number must be selected" << std::endl << std::endl;
std::cout << std::endl << "More than one device is connected, serial number must be selected" << std::endl << std::endl;
return EXIT_FAILURE;
}

if ( devs.size() == 1 && devs[0].is<rs2::update_device>() )
{
std::cout << std::endl << "device is in recovery mode, use -r to recover" << std::endl << std::endl;
std::cout << std::endl << "Device is in recovery mode, use -r to recover" << std::endl << std::endl;
return EXIT_FAILURE;
}

if (devs.size() == 0)
{
std::cout << std::endl << "no devices were found" << std::endl << std::endl;
std::cout << std::endl << "No devices were found" << std::endl << std::endl;
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -317,13 +317,13 @@ int main(int argc, char** argv) try

if (backup_arg.isSet())
{
std::cout << std::endl << "backing-up device flash: " << std::endl;
std::cout << std::endl << "Backing-up device flash: " << std::endl;

std::vector< uint8_t > flash;
if( ISATTY( FILENO( stdout )))
{
flash = d.as< rs2::updatable >().create_flash_backup( [&]( const float progress ) {
printf( "\rflash backup progress: %d[%%]", (int)( progress * 100 ) );
printf( "\rFlash backup progress: %d[%%]", (int)( progress * 100 ) );
} );
}
else
Expand All @@ -339,24 +339,24 @@ int main(int argc, char** argv) try

std::vector<uint8_t> fw_image = read_firmware_data(file_arg.isSet(), file_arg.getValue());

std::cout << std::endl << "updating device: " << std::endl;
std::cout << std::endl << "Updating device: " << std::endl;
print_device_info(d);

if (unsigned_arg.isSet())
{
std::cout << std::endl << "firmware update started" << std::endl << std::endl;
std::cout << std::endl << "Firmware update started" << std::endl << std::endl;

if (ISATTY(FILENO(stdout)))
{
d.as<rs2::updatable>().update_unsigned(fw_image, [&](const float progress)
{
printf("\rfirmware update progress: %d[%%]", (int)(progress * 100));
printf("\rFirmware update progress: %d[%%]", (int)(progress * 100));
});
}
else
d.as<rs2::updatable>().update_unsigned(fw_image, [&](const float progress){});

std::cout << std::endl << std::endl << "firmware update done" << std::endl;
std::cout << std::endl << std::endl << "Firmware update done" << std::endl;
}
else
{
Expand All @@ -376,7 +376,7 @@ int main(int argc, char** argv) try
std::unique_lock<std::mutex> lk(mutex);
if (!cv.wait_for(lk, std::chrono::seconds(WAIT_FOR_DEVICE_TIMEOUT), [&] { return new_fw_update_device; }))
{
std::cout << std::endl << "failed to locate a device in FW update mode" << std::endl;
std::cout << std::endl << "Failed to locate a device in FW update mode" << std::endl;
return EXIT_FAILURE;
}

Expand All @@ -389,10 +389,10 @@ int main(int argc, char** argv) try
if (!device_found)
{
if(serial_number_arg.isSet())
std::cout << std::endl << "couldn't find the requested serial number" << std::endl;
std::cout << std::endl << "Couldn't find the requested serial number" << std::endl;
else if (devs.size() == 1)
{
std::cout << std::endl << "nothing to do, run again with -h for help" << std::endl;
std::cout << std::endl << "Nothing to do, run again with -h for help" << std::endl;
}
return EXIT_FAILURE;
}
Expand All @@ -410,7 +410,7 @@ int main(int argc, char** argv) try
continue;

auto fw = d.supports(RS2_CAMERA_INFO_FIRMWARE_VERSION) ? d.get_info(RS2_CAMERA_INFO_FIRMWARE_VERSION) : "unknown";
std::cout << std::endl << "device " << sn << " successfully updated to FW: " << fw << std::endl;
std::cout << std::endl << "Device " << sn << " successfully updated to FW: " << fw << std::endl;
}
}

Expand Down

0 comments on commit c5aadbd

Please sign in to comment.