12 int main(int argc, char *argv[])
14 struct plotter_options options;
15 struct plotter_config cfg;
16 int fd, baud, ret = 0, out_fd = 0;
18 bzero(&cfg, sizeof(cfg));
20 if (read_args(argc, argv, &options))
23 if (options.config_file_path)
24 populate_config_data_from_file(options.config_file_path, &cfg);
26 baud = options.baud_rate;
27 fd = open_at_baud(options.device_path, &baud);
31 if (baud != options.baud_rate) {
32 pr_err("Failed to set baudrate to %d, only got %d\n",
33 options.baud_rate, baud);
38 if (options.output_path) {
39 pr_debug("Opening %s for writing the log file\n",
42 out_fd = open(options.output_path,
43 O_CREAT | O_APPEND | O_WRONLY, 0664);
45 pr_err("Failed to open file %s for writing: %m\n",
52 read_data(fd, out_fd);