Changeset 5176
- Timestamp:
- 04/14/08 17:27:59 (7 months ago)
- Files:
-
- lm-sensors/branches/lm-sensors-3.0.0/CHANGES (modified) (1 diff)
- lm-sensors/branches/lm-sensors-3.0.0/doc/libsensors-API.txt (added)
- lm-sensors/branches/lm-sensors-3.0.0/lib/access.c (modified) (1 diff)
- lm-sensors/branches/lm-sensors-3.0.0/lib/data.c (modified) (2 diffs)
- lm-sensors/branches/lm-sensors-3.0.0/lib/sensors.h (modified) (2 diffs)
- lm-sensors/branches/lm-sensors-3.0.0/lib/sysfs.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/branches/lm-sensors-3.0.0/CHANGES
r5175 r5176 6 6 Parse the configuration file in C locale 7 7 Late compute statements override early ones 8 Support virtual hwmon devices (#2309) 8 9 sensors-detect: Add SMSC SCH5027D detection 9 10 Do not access I/O ports on PPC lm-sensors/branches/lm-sensors-3.0.0/lib/access.c
r5175 r5176 348 348 case SENSORS_BUS_TYPE_SPI: 349 349 return "SPI adapter"; 350 case SENSORS_BUS_TYPE_VIRTUAL: 351 return "Virtual device"; 350 352 } 351 353 lm-sensors/branches/lm-sensors-3.0.0/lib/data.c
r5163 r5176 110 110 else if (!strncmp(name, "spi", dash - name)) 111 111 res->bus.type = SENSORS_BUS_TYPE_SPI; 112 else if (!strncmp(name, "virtual", dash - name)) 113 res->bus.type = SENSORS_BUS_TYPE_VIRTUAL; 112 114 else 113 115 goto ERROR; … … 170 172 return snprintf(str, size, "%s-spi-%hd-%x", chip->prefix, 171 173 chip->bus.nr, chip->addr); 174 case SENSORS_BUS_TYPE_VIRTUAL: 175 return snprintf(str, size, "%s-virtual-%x", chip->prefix, 176 chip->addr); 172 177 } 173 178 lm-sensors/branches/lm-sensors-3.0.0/lib/sensors.h
r5163 r5176 32 32 API additions like new flags / enum values. The second digit is for tracking 33 33 larger additions like new methods. */ 34 #define SENSORS_API_VERSION 0x40 034 #define SENSORS_API_VERSION 0x401 35 35 36 36 #define SENSORS_CHIP_NAME_PREFIX_ANY NULL … … 42 42 #define SENSORS_BUS_TYPE_PCI 2 43 43 #define SENSORS_BUS_TYPE_SPI 3 44 #define SENSORS_BUS_TYPE_VIRTUAL 4 44 45 #define SENSORS_BUS_NR_ANY (-1) 45 46 #define SENSORS_BUS_NR_IGNORE (-2) lm-sensors/branches/lm-sensors-3.0.0/lib/sysfs.c
r5174 r5176 476 476 if (!entry.chip.path) 477 477 sensors_fatal_error(__func__, "Out of memory"); 478 479 if (dev_path == NULL) { 480 /* Virtual device */ 481 entry.chip.bus.type = SENSORS_BUS_TYPE_VIRTUAL; 482 entry.chip.bus.nr = 0; 483 /* For now we assume that virtual devices are unique */ 484 entry.chip.addr = 0; 485 goto done; 486 } 478 487 479 488 /* Find bus type */ … … 546 555 } 547 556 557 done: 548 558 if (sensors_read_dynamic_chip(&entry, hwmon_path) < 0) 549 559 goto exit_free; … … 594 604 snprintf(linkpath, NAME_MAX, "%s/device", path); 595 605 dev_len = readlink(linkpath, device, NAME_MAX - 1); 596 if (dev_len < 0) 597 return -SENSORS_ERR_KERNEL; 598 device[dev_len] = '\0'; 599 device_p = strrchr(device, '/') + 1; 600 601 /* The attributes we want might be those of the hwmon class device, 602 or those of the device itself. */ 603 err = sensors_read_one_sysfs_chip(linkpath, device_p, path); 604 if (err == 0) 605 err = sensors_read_one_sysfs_chip(linkpath, device_p, linkpath); 606 if (dev_len < 0) { 607 /* No device link? Treat as virtual */ 608 err = sensors_read_one_sysfs_chip(NULL, NULL, path); 609 } else { 610 device[dev_len] = '\0'; 611 device_p = strrchr(device, '/') + 1; 612 613 /* The attributes we want might be those of the hwmon class 614 device, or those of the device itself. */ 615 err = sensors_read_one_sysfs_chip(linkpath, device_p, path); 616 if (err == 0) 617 err = sensors_read_one_sysfs_chip(linkpath, device_p, 618 linkpath); 619 } 606 620 if (err < 0) 607 621 return err;
