]> hackdaworld.org Git - my-code/arm.git/commitdiff
cleaning up ...
authorhackbard <hackbard@staubsauger.localdomain>
Wed, 8 Aug 2007 01:36:33 +0000 (03:36 +0200)
committerhackbard <hackbard@staubsauger.localdomain>
Wed, 8 Aug 2007 01:36:33 +0000 (03:36 +0200)
betty/lpcload.c

index 5cc15eddf34f1936081f4639903b47a184efbd35..80af804153dc5697da32ba6ae3f30a598cfcd45d 100644 (file)
@@ -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<ret;i++)
                        printf("%02x ",buf[i]);
+               printf("\n");
        }
 
 end: