]> cvs.zerfleddert.de Git - hmcfgusb/blobdiff - hmland.c
print lan-communication in verbose-mode
[hmcfgusb] / hmland.c
index aa5f27737045bf22f1ac1ba60142dae6a501e112..3dae5459b0dc06c7c335d8f93991fd3c303133bf 100644 (file)
--- a/hmland.c
+++ b/hmland.c
@@ -239,8 +239,13 @@ static int hmlan_format_out(uint8_t *buf, int buf_len, void *data)
                        hexdump(buf, buf_len, "Unknown> ");
                        break;
        }
-       if (debug)
-               fprintf(stderr, "LAN < %s\n", out);
+       if (verbose) {
+               int i;
+
+               printf("LAN < ");
+               for (i = 0; i < outpos-out; i++)
+                       printf("%c", out[i]);
+       }
 
        w = write(fd, out, outpos-out);
        if (w <= 0) {
@@ -270,9 +275,6 @@ static int hmlan_parse_in(int fd, void *data)
 
                inpos = buf;
 
-               if (debug)
-                       fprintf(stderr, "\nLAN > %s", buf);
-
                while (inpos < inend) {
                        uint8_t *instart = inpos;
 
@@ -295,6 +297,13 @@ static int hmlan_parse_in(int fd, void *data)
                        if (last == 0)
                                continue;
 
+                       if (verbose) {
+                               printf("LAN > ");
+                               for (i = 0; i < last; i++)
+                                       printf("%c", instart[i]);
+                               printf("\n");
+                       }
+
                        memset(out, 0, sizeof(out));
                        *outpos++ = *inpos++;
 
@@ -307,6 +316,11 @@ static int hmlan_parse_in(int fd, void *data)
                                        parse_part_in(&inpos, (last-(inpos-instart)), &outpos, (sizeof(out)-(outpos-out)), 0);
                                        parse_part_in(&inpos, (last-(inpos-instart)), &outpos, (sizeof(out)-(outpos-out)), FLAG_LENGTH_BYTE);
                                        break;
+                               case 'Y':
+                                       parse_part_in(&inpos, (last-(inpos-instart)), &outpos, (sizeof(out)-(outpos-out)), 0);
+                                       parse_part_in(&inpos, (last-(inpos-instart)), &outpos, (sizeof(out)-(outpos-out)), 0);
+                                       parse_part_in(&inpos, (last-(inpos-instart)), &outpos, (sizeof(out)-(outpos-out)), FLAG_LENGTH_BYTE);
+                                       break;
                                default:
                                        parse_part_in(&inpos, (last-(inpos-instart)), &outpos, (sizeof(out)-(outpos-out)), FLAG_IGNORE_COMMAS);
                                        break;
Impressum, Datenschutz