thermferm/devices.c

changeset 587
b8580eedfcc7
parent 586
504463dad07d
child 588
322a29000fd7
equal deleted inserted replaced
586:504463dad07d 587:b8580eedfcc7
732 if ((rc = piHiPri(50))) 732 if ((rc = piHiPri(50)))
733 syslog(LOG_NOTICE, "my_devices_loop: piHiPri(50) rc=%d", rc); 733 syslog(LOG_NOTICE, "my_devices_loop: piHiPri(50) rc=%d", rc);
734 #endif 734 #endif
735 735
736 /* 736 /*
737 * Set the temperature sensors to 12 bits resolution.
738 */
739 for (device = Config.devices; device; device = device->next) {
740 if ((device->type == DEVTYPE_W1) &&
741 ((strncmp(device->address, (char *)"10", 2) == 0) ||
742 (strncmp(device->address, (char *)"22", 2) == 0) ||
743 (strncmp(device->address, (char *)"28", 2) == 0) ||
744 (strncmp(device->address, (char *)"3b", 2) == 0) ||
745 (strncmp(device->address, (char *)"42", 2) == 0))) {
746 addr = xstrcpy((char *)"/sys/bus/w1/devices/");
747 addr = xstrcat(addr, device->address);
748 addr = xstrcat(addr, (char *)"/w1_slave");
749 if ((fp = fopen(addr, "w"))) {
750 rc = fprintf(fp, "12\n0\n");
751 fclose(fp);
752 if (rc == 5) {
753 syslog(LOG_NOTICE, "written 12 bits setting to %s", addr);
754 } else {
755 syslog(LOG_NOTICE, "error rc=%d for %s", rc, addr);
756 }
757 }
758 free(addr);
759 addr = NULL;
760 }
761 }
762
763 /*
737 * Loop forever until the external shutdown variable is set. 764 * Loop forever until the external shutdown variable is set.
738 */ 765 */
739 for (;;) { 766 for (;;) {
740 767
741 /* 768 /*

mercurial