--- a/thermferm/rdconfig.c Sun Aug 10 16:56:22 2014 +0200 +++ b/thermferm/rdconfig.c Sun Aug 10 17:25:50 2014 +0200 @@ -532,6 +532,10 @@ syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); return 1; } + if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "OFFSET", "%d", device->offset)) < 0) { + syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); + return 1; + } if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRESENT", "%s", DEVPRESENT[device->present])) < 0) { syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); return 1; @@ -1036,7 +1040,7 @@ device->next = NULL; device->version = 1; device->uuid = device->address = device->description = device->comment = NULL; - device->type = device->direction = device->present = device->subdevice = device->inuse = 0; + device->type = device->direction = device->present = device->subdevice = device->inuse = device->offset = 0; device->gpiopin = -1; device->timestamp = (time_t)0; @@ -1080,6 +1084,12 @@ device->value = ival; xmlFree(key); } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET"))) { + key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + if (sscanf((const char *)key, "%d", &ival) == 1) + device->offset = ival; + xmlFree(key); + } if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) { key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); for (i = 0; i < 4; i++) {