FreeCalypso > hg > freecalypso-tools
comparison rvinterf/lowlevel/rvtdump.c @ 253:6f078c4a5506
rvinterf and friends converted to use libserial
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 21 Sep 2017 23:45:05 +0000 |
parents | 7168f63fc3b8 |
children |
comparison
equal
deleted
inserted
replaced
252:d27a89068280 | 253:6f078c4a5506 |
---|---|
10 #include <unistd.h> | 10 #include <unistd.h> |
11 #include <time.h> | 11 #include <time.h> |
12 #include "../include/pktmux.h" | 12 #include "../include/pktmux.h" |
13 | 13 |
14 extern int target_fd; | 14 extern int target_fd; |
15 extern char *baudrate_name; | |
16 | 15 |
17 extern u_char rxpkt[]; | 16 extern u_char rxpkt[]; |
18 extern size_t rxpkt_len; | 17 extern size_t rxpkt_len; |
19 | 18 |
20 char *logfname; | 19 char *logfname; |
21 FILE *logF; | 20 FILE *logF; |
22 time_t logtime; | 21 time_t logtime; |
23 int background; | 22 int background; |
24 int no_output; /* for output.c */ | 23 int no_output; /* for output.c */ |
24 | |
25 static char *baudrate = "115200"; | |
25 | 26 |
26 static char keepalive_msg[] = | 27 static char keepalive_msg[] = |
27 "Received keepalive query, unable to respond, please run rvinterf"; | 28 "Received keepalive query, unable to respond, please run rvinterf"; |
28 | 29 |
29 main(argc, argv) | 30 main(argc, argv) |
39 case 'b': | 40 case 'b': |
40 background++; | 41 background++; |
41 no_output++; /* for output.c */ | 42 no_output++; /* for output.c */ |
42 continue; | 43 continue; |
43 case 'B': | 44 case 'B': |
44 baudrate_name = optarg; | 45 baudrate = optarg; |
45 continue; | 46 continue; |
46 case 'd': | 47 case 'd': |
47 target_fd = atoi(optarg); | 48 target_fd = atoi(optarg); |
48 continue; | 49 continue; |
49 case 'l': | 50 case 'l': |
60 exit(1); | 61 exit(1); |
61 } | 62 } |
62 if (target_fd <= 0) { | 63 if (target_fd <= 0) { |
63 if (argc - optind != 1) | 64 if (argc - optind != 1) |
64 goto usage; | 65 goto usage; |
65 open_target_serial(argv[optind]); | 66 open_serial_port(argv[optind]); |
67 set_fixed_baudrate(baudrate); | |
66 } | 68 } |
67 | 69 |
68 set_serial_nonblock(0); | 70 set_serial_nonblock(0); |
69 setlinebuf(stdout); | 71 setlinebuf(stdout); |
70 if (logfname) { | 72 if (logfname) { |