annotate rvinterf/lowlevel/rviflcd.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
children 16ed75e266f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
908
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * This rvinterf module implements the piping of LCD output to fc-lcdemu
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 */
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <sys/types.h>
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <stdio.h>
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <string.h>
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <strings.h>
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <stdlib.h>
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 #include <unistd.h>
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 extern u_char rxpkt[];
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 extern size_t rxpkt_len;
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 char *extlcd_program;
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 FILE *extlcd_pout;
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 void
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 open_extlcd_pipe()
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 {
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 extlcd_pout = popen(extlcd_program, "w");
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 if (!extlcd_pout) {
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 perror(extlcd_program);
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 exit(1);
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 }
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 }
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 void
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 output_to_extlcd()
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 {
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 int i;
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 fprintf(extlcd_pout, "%u %u ", rxpkt[1], rxpkt[2]);
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 for (i = 3; i < rxpkt_len; i += 2)
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 fprintf(extlcd_pout, "%02X%02X", rxpkt[i+1], rxpkt[i]);
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 fputc('\n', extlcd_pout);
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 fflush(extlcd_pout);
ed5dcc53e0b3 rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 }