15 #include "../include/kobuki_ftdi/scanner.hpp"
16 #include "../include/kobuki_ftdi/writer.hpp"
18 int main(
int argc,
char** argv)
29 ret_val = scanner.
scan();
32 std::cerr <<
"not found!!!" << std::endl;
35 unsigned int no_devices = (unsigned)ret_val;
41 for (
unsigned int i=0; i<no_devices; i++) {
43 std::string serial_id;
46 std::cout << ret_val <<
": ";
47 std::cout <<
"failed to get serial_id. did you run with sudo?" << std::endl;
51 std::cout << ret_val <<
": ";
52 std::cout <<
"Something went wrong." << std::endl;
57 if( serial_id.substr(0,6) == std::string(
"kobuki") )
59 std::cout <<
"Already flashed as [" << serial_id <<
"]." << std::endl;
64 std::string new_id =
"kobuki_" + serial_id;
66 ret_val = writer.
write( serial_id, new_id.substr(0,20),
"Yujin Robot",
"iClebo Kobuki" );
68 std::cout << ret_val <<
": ";
69 std::cout <<
"Something went wrong." << std::endl;
79 ret_val = scanner.
reset();
80 if (ret_val < 0 && ret_val != -19) {
81 std::cout << ret_val <<
": ";
82 std::cout <<
"Something went wrong." << std::endl;