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 com-port-device\n");
22 printf("Example, linux: ddcp-script-getval /dev/ttyUSB0\n");
23 printf("Example, mac: ddcp-script-getval /dev/tty.usbserial-*\n");
28 /* Set up io port correctly, and open it... */
29 fd = open(device, O_RDWR );
31 fprintf(stderr, "ERROR: open for %s failed.\n",device);
34 write(fd,"\r",1); // send empty line
35 usleep(100000); // commands are polled in the avr and it can take 100ms
36 write(fd,"\r",1); // send empty line
37 usleep(100000); // commands are polled in the avr and it can take 100ms
39 while ((c_cnt=read(fd,&c,1))){
40 //printf(":0x%x:\n",c); // debug
41 if (c=='#') { // find begining of prompt
44 if (state<1) continue;
54 usleep(100000); // commands are polled in the avr and it can take 100ms