thermferm/devices.c

changeset 340
5b49416eb116
parent 338
8e29d142d67d
child 341
cfc952a68d4a
equal deleted inserted replaced
339:16203280eea2 340:5b49416eb116
249 int devices_detect(void) 249 int devices_detect(void)
250 { 250 {
251 struct dirent *de; 251 struct dirent *de;
252 DIR *fd; 252 DIR *fd;
253 devices_list *device, *ndev; 253 devices_list *device, *ndev;
254 int found, subdevices, i, rc = 0; 254 int found, subdevices, ival, i, rc = 0;
255 char buf[40]; 255 char buf[40];
256 uuid_t uu; 256 uuid_t uu;
257 #ifdef HAVE_WIRINGPI_H 257 #ifdef HAVE_WIRINGPI_H
258 int pin; 258 int pin;
259 #endif 259 #endif
273 } 273 }
274 274
275 if (found == FALSE) { 275 if (found == FALSE) {
276 strncpy(buf, de->d_name, 2); 276 strncpy(buf, de->d_name, 2);
277 buf[2] = '\0'; 277 buf[2] = '\0';
278 sscanf(buf, "%02x", &ival);
279 syslog(LOG_NOTICE, "Scan 1-wire %02x %d", ival, ival);
278 subdevices = 1; 280 subdevices = 1;
279 if (strcmp(buf, (char *)"29") == 0) 281 if (strcmp(buf, (char *)"29") == 0)
280 subdevices = 8; 282 subdevices = 8;
281 if (strcmp(buf, (char *)"3a") == 0) 283 if (strcmp(buf, (char *)"3a") == 0)
282 subdevices = 2; 284 subdevices = 2;

mercurial