| 40 | int keyspd = 20; |
| 41 | |
| 42 | int |
| 43 | frameGet(int fd, unsigned char *buf) |
| 44 | { |
| 45 | int i = 0; |
| 46 | memset(buf, 0, BUFSIZE); |
| 47 | unsigned char c; |
| 48 | |
| 49 | while (read(fd, &c, 1) > 0) |
| 50 | { |
| 51 | buf[i++] = c; |
| 52 | //printf("i=%d, c=0x%02x\n",i,c); |
| 53 | |
| 54 | if (c == 0xfd) |
| 55 | { |
| 56 | char mytime[256]; |
| 57 | date_strget(mytime, sizeof(mytime), 1); |
| 58 | printf("%s:", mytime); dumphex(buf, i); |
| 59 | #ifdef ECHO |
| 60 | // echo |
| 61 | n = write(fd, buf, i); |
| 62 | #endif |
| 63 | |
| 64 | return i; |
| 65 | } |
| 66 | |
| 67 | if (i > 2 && c == 0xfe) |
| 68 | { |
| 69 | printf("Turning power on due to 0xfe string\n"); |
| 70 | powerstat = 1; |
| 71 | int j; |
| 72 | |
| 73 | for (j = i; j < 175; ++j) |
| 74 | { |
| 75 | if (read(fd, &c, 1) < 0) { break; } |
| 76 | } |
| 77 | |
| 78 | i = 0; |
| 79 | continue; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | printf("Error %s\n", strerror(errno)); |
| 84 | |
| 85 | return 0; |
| 86 | } |
| 87 | |
| 88 | void frameParse(int fd, unsigned char *frame, int len) |
| 89 | { |
no test coverage detected