13 int main(int argc, char *argv[])
15 struct plotter_options options;
16 struct plotter_config cfg;
17 int fd, baud, ret = 0, out_fd = 0;
19 bzero(&cfg, sizeof(cfg));
21 if (read_args(argc, argv, &options))
24 if (options.config_file_path)
25 populate_config_data_from_file(options.config_file_path, &cfg);
27 baud = options.baud_rate;
28 fd = open_at_baud(options.device_path, &baud);
32 if (baud != options.baud_rate) {
33 pr_err("Failed to set baudrate to %d, only got %d\n",
34 options.baud_rate, baud);
39 if (options.output_path) {
40 pr_debug("Opening %s for writing the log file\n",
43 out_fd = open(options.output_path,
44 O_CREAT | O_APPEND | O_WRONLY, 0664);
46 pr_err("Failed to open file %s for writing: %m\n",
54 init_data_parser(fd, out_fd);