]> pilppa.com Git - lib1wire.git/commitdiff
fix the parsing of counter value
authorMika Laitio <lamikr@pilppa.org>
Sat, 30 Oct 2010 18:06:41 +0000 (21:06 +0300)
committerMika Laitio <lamikr@pilppa.org>
Sat, 30 Oct 2010 18:06:41 +0000 (21:06 +0300)
src/W1CounterDevice.cc

index d33956293e1b4faf4230ceb78ae899a5501da8a9..5e343bf879b8efcfc6c1b14dc5fec253437d6fed 100644 (file)
@@ -59,10 +59,10 @@ string W1CounterDevice::get_value() {
                while(getline(ifs, value_line)) {
                        length  = value_line.length();
                        if (length > 0) {
-                               pos     = value_line.find("c=");
+                               pos     = value_line.find("crc=YES c=");
                                if ((pos >= 0) &&
-                                   (pos + 2 < length)) {
-                                       value_line      = value_line.substr(pos + 2);
+                                   (pos + 10 < length)) {
+                                       value_line      = value_line.substr(pos + 10);
                                }
                                else {
                                        value_line      = "";