1 /* vim: set sw=8 ts=8 si et: */
3 * Linux software to communicate with the DDCP
4 * Written by Guido Socher
13 int main(int argc, char *argv[])
21 printf("USAGE: ddcp-script-getval /dev/ttyUSB0\n");
22 printf("or ddcp-script-getval /dev/ttyUSB1\n");
27 /* Set up io port correctly, and open it... */
28 fd = open(device, O_RDWR );
30 fprintf(stderr, "ERROR: open for %s failed.\n",device);
33 write(fd,"\r",1); // send empty line
34 usleep(100000); // commands are polled in the avr and it can take 100ms
35 write(fd,"\r",1); // send empty line
36 usleep(100000); // commands are polled in the avr and it can take 100ms
38 while ((c_cnt=read(fd,&c,1))){
39 //printf(":0x%x:\n",c); // debug
40 if (c=='#') { // find begining of prompt
43 if (state<1) continue;
53 usleep(100000); // commands are polled in the avr and it can take 100ms