290 ndev->type = DEVTYPE_W1; |
290 ndev->type = DEVTYPE_W1; |
291 ndev->direction = DEVDIR_UNDEF; |
291 ndev->direction = DEVDIR_UNDEF; |
292 if (strcmp(buf, (char *)"10") == 0) { |
292 if (strcmp(buf, (char *)"10") == 0) { |
293 ndev->direction = DEVDIR_IN_ANALOG; |
293 ndev->direction = DEVDIR_IN_ANALOG; |
294 ndev->description = xstrcpy((char *)"DS18S20 Digital thermometer"); |
294 ndev->description = xstrcpy((char *)"DS18S20 Digital thermometer"); |
|
295 } else if (strcmp(buf, (char *)"22") == 0) { |
|
296 ndev->direction = DEVDIR_IN_ANALOG; |
|
297 ndev->description = xstrcpy((char *)"DS1820 Digital thermometer"); |
295 } else if (strcmp(buf, (char *)"28") == 0) { |
298 } else if (strcmp(buf, (char *)"28") == 0) { |
296 ndev->direction = DEVDIR_IN_ANALOG; |
299 ndev->direction = DEVDIR_IN_ANALOG; |
297 ndev->description = xstrcpy((char *)"DS18B20 Digital thermometer"); |
300 ndev->description = xstrcpy((char *)"DS18B20 Digital thermometer"); |
298 } else if (strcmp(buf, (char *)"29") == 0) { |
301 } else if (strcmp(buf, (char *)"29") == 0) { |
299 ndev->description = xstrcpy((char *)"DS2408 8 Channel addressable switch/LCD"); |
302 ndev->description = xstrcpy((char *)"DS2408 8 Channel addressable switch/LCD"); |
300 } else if (strcmp(buf, (char *)"3a") == 0) { |
303 } else if (strcmp(buf, (char *)"3a") == 0) { |
301 ndev->description = xstrcpy((char *)"DS2413 Dual channel addressable switch"); |
304 ndev->description = xstrcpy((char *)"DS2413 Dual channel addressable switch"); |
|
305 } else if (strcmp(buf, (char *)"3b") == 0) { |
|
306 ndev->direction = DEVDIR_IN_ANALOG; |
|
307 ndev->description = xstrcpy((char *)"DS1825 Digital thermometer"); |
|
308 } else if (strcmp(buf, (char *)"42") == 0) { |
|
309 ndev->direction = DEVDIR_IN_ANALOG; |
|
310 ndev->description = xstrcpy((char *)"DS28EA00 Digital thermometer"); |
302 } else if (strcmp(buf, (char *)"w1") == 0) { |
311 } else if (strcmp(buf, (char *)"w1") == 0) { |
303 ndev->description = xstrcpy((char *)"Master System device"); |
312 ndev->description = xstrcpy((char *)"Master System device"); |
304 } else { |
313 } else { |
305 ndev->description = xstrcpy((char *)"Unknown device family "); |
314 ndev->description = xstrcpy((char *)"Unknown device family "); |
306 ndev->description = xstrcat(ndev->description, buf); |
315 ndev->description = xstrcat(ndev->description, buf); |
518 if (my_shutdown) |
527 if (my_shutdown) |
519 break; |
528 break; |
520 |
529 |
521 switch (device->type) { |
530 switch (device->type) { |
522 case DEVTYPE_W1: |
531 case DEVTYPE_W1: |
523 if (strncmp(device->address, (char *)"28", 2) == 0) { |
532 /* |
524 /* Read DS18B20 sensor */ |
533 * Only tested with DS18B20 but from the kernel source this |
|
534 * should work with all 1-wire thermometer sensors. |
|
535 */ |
|
536 if ((strncmp(device->address, (char *)"10", 2) == 0) || |
|
537 (strncmp(device->address, (char *)"22", 2) == 0) || |
|
538 (strncmp(device->address, (char *)"28", 2) == 0) || |
|
539 (strncmp(device->address, (char *)"3b", 2) == 0) || |
|
540 (strncmp(device->address, (char *)"42", 2) == 0)) { |
525 addr = xstrcpy((char *)"/sys/bus/w1/devices/"); |
541 addr = xstrcpy((char *)"/sys/bus/w1/devices/"); |
526 addr = xstrcat(addr, device->address); |
542 addr = xstrcat(addr, device->address); |
527 addr = xstrcat(addr, (char *)"/w1_slave"); |
543 addr = xstrcat(addr, (char *)"/w1_slave"); |
528 if ((fp = fopen(addr, "r"))) { |
544 if ((fp = fopen(addr, "r"))) { |
529 if (device->present != DEVPRESENT_YES) { |
545 if (device->present != DEVPRESENT_YES) { |