1 /* conky support for information from sony_laptop kernel module
2 * information from sony_laptop kernel module
3 * /sys/devices/platform/sony-laptop
4 * I mimicked the methods from ibm.c
5 * Yeon-Hyeong Yang <lbird94@gmail.com> */
16 #define SONY_LAPTOP_DIR "/sys/devices/platform/sony-laptop"
18 /* fanspeed in SONY_LAPTOP_DIR contains an integer value for fanspeed (0~255).
19 * I don't know the exact measurement unit, though. I may assume that 0 for
20 * 'fan stopped' and 255 for 'maximum fan speed'. */
21 void get_sony_fanspeed(char *p_client_buffer, size_t client_buffer_size)
24 unsigned int speed = 0;
27 if (!p_client_buffer || client_buffer_size <= 0) {
31 snprintf(fan, 127, "%s/fanspeed", SONY_LAPTOP_DIR);
38 if (fgets(line, 255, fp) == NULL) {
41 if (sscanf(line, "%u", &speed)) {
46 CRIT_ERR("can't open '%s': %s\nEnable sony support or remove "
47 "sony* from your "PACKAGE_NAME" config file.",
48 fan, strerror(errno));
52 snprintf(p_client_buffer, client_buffer_size, "%d", speed);