179 pthread_mutex_lock(&mutexes[LOCK_ONE_WIRE]); |
179 pthread_mutex_lock(&mutexes[LOCK_ONE_WIRE]); |
180 dev_w1->present = DEVPRESENT_YES; |
180 dev_w1->present = DEVPRESENT_YES; |
181 dev_w1->timestamp = time(NULL); |
181 dev_w1->timestamp = time(NULL); |
182 pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]); |
182 pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]); |
183 changed = true; |
183 changed = true; |
184 for (device = Config.devices; device; device = device->next) { |
184 device_present(dev_w1->address, DEVPRESENT_YES); |
185 if (strcmp(dev_w1->address, device->address) == 0) { |
|
186 // pthread_mutex_lock(&mutexes[LOCK_DEVICES]); |
|
187 device->present = DEVPRESENT_YES; |
|
188 // pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); |
|
189 } |
|
190 } |
|
191 } |
185 } |
192 break; |
186 break; |
193 } |
187 } |
194 } |
188 } |
195 if (found == FALSE) { |
189 if (found == FALSE) { |
246 pthread_mutex_lock(&mutexes[LOCK_ONE_WIRE]); |
240 pthread_mutex_lock(&mutexes[LOCK_ONE_WIRE]); |
247 dev_w1->present = DEVPRESENT_NO; |
241 dev_w1->present = DEVPRESENT_NO; |
248 dev_w1->timestamp = time(NULL); |
242 dev_w1->timestamp = time(NULL); |
249 pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]); |
243 pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]); |
250 changed = true; |
244 changed = true; |
251 for (device = Config.devices; device; device = device->next) { |
245 device_present(dev_w1->address, DEVPRESENT_NO); |
252 if (strcmp(dev_w1->address, device->address) == 0) { |
|
253 // pthread_mutex_lock(&mutexes[LOCK_DEVICES]); |
|
254 device->present = DEVPRESENT_NO; |
|
255 syslog(LOG_NOTICE, "One-wire device %s marked device %s not present", dev_w1->address, device->address); |
|
256 // pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); |
|
257 } |
|
258 } |
|
259 } |
246 } |
260 free(devfile); |
247 free(devfile); |
261 devfile = NULL; |
248 devfile = NULL; |
262 } |
249 } |
263 |
250 |