60 int main(
int argc,
char **argv)
65 CmdLine cmd_line(
"This is used to write a new serial id string to the ftdi device.",
' ',
"0.1");
67 "o",
"old",
"Identify the device via the old serial id (if there are multiple devices attached) ['unspecified'].",
false,
68 "unspecified",
"string");
71 cmd_line.
add(old_arg);
72 cmd_line.
add(new_arg);
73 cmd_line.
parse(argc, argv);
74 bool using_old_id =
false;
76 if (old_arg.
getValue() !=
"unspecified")
87 std::cout <<
"Input Information" << std::endl;
90 std::cout <<
" Old id: unused (first device found.)" << std::endl;
94 std::cout <<
" Old id: " << old_id << std::endl;
96 std::cout <<
" New id: " << new_id << std::endl;
104 ret_val = writer.
write(new_id);
106 std::cerr <<
"Something went wrong." << std::endl;
111 ret_val = scanner.
reset();
112 if (ret_val<0 && ret_val !=-19) {
113 std::cerr <<
"Something went wrong." << std::endl;
117 std::cout <<
"ret_val: " << ret_val << std::endl;
int write(const std::string &new_id_)
Provides common modulde for wrting serial number and other data into the eeprom of ftdi chip...
void parse(int argc, char **argv)
int main(int argc, char **argv)
Scan the usb devices, and retrieve its serial id and else descriptions, especially for ftdi devices...