530 } |
530 } |
531 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VALUE", "%d", device->value)) < 0) { |
531 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VALUE", "%d", device->value)) < 0) { |
532 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
532 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
533 return 1; |
533 return 1; |
534 } |
534 } |
|
535 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "OFFSET", "%d", device->offset)) < 0) { |
|
536 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
537 return 1; |
|
538 } |
535 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRESENT", "%s", DEVPRESENT[device->present])) < 0) { |
539 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRESENT", "%s", DEVPRESENT[device->present])) < 0) { |
536 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
540 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
537 return 1; |
541 return 1; |
538 } |
542 } |
539 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "%s", device->address)) < 0) { |
543 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "%s", device->address)) < 0) { |
1034 |
1038 |
1035 device = (devices_list *)malloc(sizeof(devices_list)); |
1039 device = (devices_list *)malloc(sizeof(devices_list)); |
1036 device->next = NULL; |
1040 device->next = NULL; |
1037 device->version = 1; |
1041 device->version = 1; |
1038 device->uuid = device->address = device->description = device->comment = NULL; |
1042 device->uuid = device->address = device->description = device->comment = NULL; |
1039 device->type = device->direction = device->present = device->subdevice = device->inuse = 0; |
1043 device->type = device->direction = device->present = device->subdevice = device->inuse = device->offset = 0; |
1040 device->gpiopin = -1; |
1044 device->gpiopin = -1; |
1041 device->timestamp = (time_t)0; |
1045 device->timestamp = (time_t)0; |
1042 |
1046 |
1043 cur = cur->xmlChildrenNode; |
1047 cur = cur->xmlChildrenNode; |
1044 while (cur != NULL) { |
1048 while (cur != NULL) { |
1077 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VALUE"))) { |
1081 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VALUE"))) { |
1078 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1082 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1079 if (sscanf((const char *)key, "%d", &ival) == 1) |
1083 if (sscanf((const char *)key, "%d", &ival) == 1) |
1080 device->value = ival; |
1084 device->value = ival; |
1081 xmlFree(key); |
1085 xmlFree(key); |
|
1086 } |
|
1087 if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET"))) { |
|
1088 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1089 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
1090 device->offset = ival; |
|
1091 xmlFree(key); |
1082 } |
1092 } |
1083 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) { |
1093 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) { |
1084 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1094 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1085 for (i = 0; i < 4; i++) { |
1095 for (i = 0; i < 4; i++) { |
1086 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
1096 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |