1.1 --- a/graphlcd-base/glcddrivers/picctl.c Thu Feb 07 00:18:02 2008 +0000
1.2 +++ b/graphlcd-base/glcddrivers/picctl.c Thu Feb 07 00:45:43 2008 +0000
1.3 @@ -104,6 +104,8 @@
1.4
1.5 void cDriverPICCtl::SignalHandler(int signal)
1.6 {
1.7 + uint8_t i;
1.8 +
1.9 // read all available data
1.10 while (instance->port->ReadData(&buf[buf_pos]))
1.11 {
1.12 @@ -124,15 +126,15 @@
1.13
1.14 if ((buf[buf_pos] == CMD_ESCAPE_BYTE) && (!buf_flag_escape))
1.15 {
1.16 + // this byte was for masking only.. ignore it!
1.17 buf_flag_escape = true;
1.18 - buf_pos--; // should do!!! better would be something like next();
1.19 - // set flag...
1.20 - // next;
1.21 + continue;
1.22 }
1.23 - else
1.24 - {
1.25 - buf_flag_escape = false;
1.26 - }
1.27 + buf_flag_escape = false;
1.28 +
1.29 +/* printf("buf: ");
1.30 + for (i=1; i<=buf_pos; i++) { printf("0x%02x ",buf[i]);}
1.31 + printf("\n");*/
1.32
1.33 // we need to check for a valid packet...
1.34 if (buf_pos >=CMD_DATA_START)
1.35 @@ -140,13 +142,14 @@
1.36 // if we recieved a valid packet: start decoding
1.37 if (buf[CMD_HDR_LENGTH+1] == (buf_pos - CMD_DATA_START))
1.38 {
1.39 - instance->DecodeCmd(&buf[buf_cmd_start],(buf_pos-1));
1.40 + instance->DecodeCmd(&buf[buf_cmd_start],(buf_pos));
1.41 buf_pos = 0;
1.42 buf_cmd_start = 0;
1.43 }
1.44 }
1.45
1.46 buf_pos++;
1.47 + printf ("still captured in while-loop\n");
1.48
1.49 }
1.50 }
1.51 @@ -154,9 +157,16 @@
1.52
1.53 void cDriverPICCtl::DecodeCmd(uint8_t * cmd, uint8_t len)
1.54 {
1.55 + uint8_t i;
1.56 +
1.57 + printf("cmd(%2d): ",len);
1.58 + for (i=0; i<len; i++) { printf("0x%02x ",cmd[i]);}
1.59 + printf("\n");
1.60 +
1.61 switch (cmd[CMD_HDR_COMMAND])
1.62 {
1.63 - case CMD_SYS_ACK: instance->ack_flag = true;
1.64 + case CMD_SYS_ACK: ack_flag = true;
1.65 + printf ("ack_!\n");
1.66 break;
1.67
1.68 case CMD_SYS_IR: printf(" Incoming Key-Event 0x%02x (Source 0x%02x)\n",cmd[CMD_DATA_START+1],cmd[CMD_DATA_START]);
1.69 @@ -165,6 +175,7 @@
1.70 default: printf(" recieved Message 0x%x \n",cmd[CMD_HDR_COMMAND]);
1.71 }
1.72
1.73 +
1.74 }
1.75
1.76 int cDriverPICCtl::Init()
2.1 --- a/graphlcd-base/glcddrivers/port.c Thu Feb 07 00:18:02 2008 +0000
2.2 +++ b/graphlcd-base/glcddrivers/port.c Thu Feb 07 00:45:43 2008 +0000
2.3 @@ -291,7 +291,7 @@
2.4 struct termios options;
2.5 struct sigaction saio;
2.6
2.7 - fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY);
2.8 + fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);
2.9 if (fd == -1)
2.10 {
2.11 printf("error opening port\n");