// more control options -> timeout / flow control
term.c_cc[VMIN]=0;
- term.c_cc[VTIME]=10; // 1 second timeout
+ term.c_cc[VTIME]=40; // 4 second timeout
term.c_cc[VSTART]=0x11;
term.c_cc[VSTOP]=0x13;
/* go! */
printf("go ...\n");
- go(&lpc);
+ ret=go(&lpc);
+ /* tell the user that the error might be due to the jump */
printf("\n\n");
- printf("the above error might be due to the jump!\n");
- printf("\n\n");
-
- printf("sleeping for 5 seconds ...\n\n");
- sleep(5);
+ if(ret<0)
+ printf("the above error might be due to the jump!\n\n");
- printf("continue listening on the serial port. ctrl+c to quit!\n\n");
+ /* query user for serial port listening */
+ printf("continue listening on serial port? (ctrl+c to quit) [y|n]: ");
+ buf[0]=getchar();
+ printf("\n");
- /* testing */
+ if(buf[0]!='y')
+ goto end;
+ /* continue lsitening on serial port */
ret=1;
while(ret) {
ret=read(lpc.sfd,buf,BUFSIZE);
printf("\rread %d bytes: ",ret);
for(i=0;i<ret;i++)
printf("%02x ",buf[i]);
+ printf("\n");
}
end: