comparison rvinterf/lowlevel/rvifmain.c @ 908:ed5dcc53e0b3

rvinterf: hook for fc-lcdemu implemented
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 07 Sep 2015 10:55:01 +0000
parents 4423039aeb4b
children 16ed75e266f2
comparison
equal deleted inserted replaced
907:7a189b7bbd67 908:ed5dcc53e0b3
15 #include "../include/localsock.h" 15 #include "../include/localsock.h"
16 #include "client.h" 16 #include "client.h"
17 17
18 extern int target_fd, listener; 18 extern int target_fd, listener;
19 extern char *baudrate_name; 19 extern char *baudrate_name;
20 extern char *extlcd_program;
20 21
21 extern u_char rxpkt[]; 22 extern u_char rxpkt[];
22 extern size_t rxpkt_len; 23 extern size_t rxpkt_len;
23 24
24 struct client *client_head; 25 struct client *client_head;
41 extern int optind; 42 extern int optind;
42 int c; 43 int c;
43 fd_set fds; 44 fd_set fds;
44 struct client *cli, **clip; 45 struct client *cli, **clip;
45 46
46 while ((c = getopt(argc, argv, "bB:d:l:ns:S:w:")) != EOF) 47 while ((c = getopt(argc, argv, "bB:d:l:ns:S:w:X:")) != EOF)
47 switch (c) { 48 switch (c) {
48 case 'b': 49 case 'b':
49 background++; 50 background++;
50 /* FALL THRU */ 51 /* FALL THRU */
51 case 'n': 52 case 'n':
67 socketpair_fd = atoi(optarg); 68 socketpair_fd = atoi(optarg);
68 continue; 69 continue;
69 case 'w': 70 case 'w':
70 wakeup_after_sec = strtoul(optarg, 0, 0); 71 wakeup_after_sec = strtoul(optarg, 0, 0);
71 continue; 72 continue;
73 case 'X':
74 extlcd_program = optarg;
75 continue;
72 case '?': 76 case '?':
73 default: 77 default:
74 usage: fprintf(stderr, 78 usage: fprintf(stderr,
75 "usage: %s [options] ttyport\n", argv[0]); 79 "usage: %s [options] ttyport\n", argv[0]);
76 exit(1); 80 exit(1);
79 if (argc - optind != 1) 83 if (argc - optind != 1)
80 goto usage; 84 goto usage;
81 open_target_serial(argv[optind]); 85 open_target_serial(argv[optind]);
82 } 86 }
83 max_fd = target_fd; 87 max_fd = target_fd;
88 if (extlcd_program)
89 open_extlcd_pipe();
84 90
85 set_serial_nonblock(0); 91 set_serial_nonblock(0);
86 setlinebuf(stdout); 92 setlinebuf(stdout);
87 if (logfname) { 93 if (logfname) {
88 logF = fopen(logfname, "w"); 94 logF = fopen(logfname, "w");
180 forward_nonrvt_pkt(); 186 forward_nonrvt_pkt();
181 return; 187 return;
182 case RVT_EXTUI_HEADER: 188 case RVT_EXTUI_HEADER:
183 if (rxpkt_len < 5 || !(rxpkt_len & 1)) 189 if (rxpkt_len < 5 || !(rxpkt_len & 1))
184 goto unknown; 190 goto unknown;
185 if (!no_output || logF) 191 if (extlcd_program)
192 output_to_extlcd();
193 else
186 report_extui_packet(); 194 report_extui_packet();
187 if (client_head)
188 forward_nonrvt_pkt();
189 return; 195 return;
190 case '*': 196 case '*':
191 print_fc_lld_msg(); 197 print_fc_lld_msg();
192 return; 198 return;
193 default: 199 default: