From: hackbard Date: Wed, 8 Aug 2007 01:36:33 +0000 (+0200) Subject: cleaning up ... X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fe785e6bc1cf36626f4a3db7877b5f7df76ed61;p=my-code%2Farm.git cleaning up ... --- diff --git a/betty/lpcload.c b/betty/lpcload.c index 5cc15ed..80af804 100644 --- a/betty/lpcload.c +++ b/betty/lpcload.c @@ -120,7 +120,7 @@ int open_serial_device(t_lpc *lpc) { // 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; @@ -567,25 +567,29 @@ int main(int argc,char **argv) { /* 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