initial import
[patches.git] / ldr.patch
1 --- toolchain/ldrviewer/ldr.c~ 2006-10-17 15:14:17.000000000 -0400
2 +++ toolchain/ldrviewer/ldr.c 2006-10-17 15:27:20.000000000 -0400
3 @@ -353,15 +353,27 @@
4 printf("Trying to read autobaud ... ");
5 ret = read(fd, autobaud, 4);
6 if (ret != 4) {
7 + /*
8 printf(" read failed we got %d bytes\n", ret);
9 printf(" Data %02x %02x %02x %02x \n",
10 autobaud[0],
11 autobaud[1],
12 autobaud[2],
13 autobaud[3]);
14 - //if (autobaud[0]==0xBF)
15 -
16 - goto canned_failure;
17 + */
18 + if ((autobaud[0]==0xBF) && (ret > 1)) {
19 + ret += read(fd, &autobaud[ret], 4-ret);
20 + /*
21 + printf(" after 2nd read ret = %d\n", ret);
22 +
23 + printf(" Data %02x %02x %02x %02x \n",
24 + autobaud[0],
25 + autobaud[1],
26 + autobaud[2],
27 + autobaud[3]);
28 + */
29 + }
30 + if ( ret != 4 ) goto canned_failure;
31 }
32 printf("OK!\n");
33