505 if (Config.devices) { |
505 if (Config.devices) { |
506 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICES")) < 0) { |
506 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICES")) < 0) { |
507 syslog(LOG_WARNING, "wrconfig: error at xmlTextWriterStartElement"); |
507 syslog(LOG_WARNING, "wrconfig: error at xmlTextWriterStartElement"); |
508 return 1; |
508 return 1; |
509 } |
509 } |
|
510 #ifdef HAVE_WIRINGPI_H |
|
511 piLock(LOCK_DEVICES); |
|
512 #endif |
510 for (device = Config.devices; device; device = device->next) { |
513 for (device = Config.devices; device; device = device->next) { |
511 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICE")) < 0) { |
514 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICE")) < 0) { |
512 syslog(LOG_WARNING, "wrconfig: error at xmlTextWriterStartElement"); |
515 syslog(LOG_WARNING, "wrconfig: error at xmlTextWriterStartElement"); |
513 return 1; |
516 return 1; |
514 } |
517 } |
571 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
574 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
572 syslog(LOG_WARNING, "wrconfig: error at xmlTextWriterEndElement"); |
575 syslog(LOG_WARNING, "wrconfig: error at xmlTextWriterEndElement"); |
573 return 1; |
576 return 1; |
574 } |
577 } |
575 } |
578 } |
|
579 #ifdef HAVE_WIRINGPI_H |
|
580 piUnlock(LOCK_DEVICES); |
|
581 #endif |
576 |
582 |
577 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
583 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
578 syslog(LOG_WARNING, "wrconfig: error at xmlTextWriterEndElement"); |
584 syslog(LOG_WARNING, "wrconfig: error at xmlTextWriterEndElement"); |
579 return 1; |
585 return 1; |
580 } |
586 } |