diff -Nru macfanctld-0.6~mactel1ubuntu2/debian/changelog macfanctld-0.6~mactel1ubuntu3/debian/changelog --- macfanctld-0.6~mactel1ubuntu2/debian/changelog 2012-04-21 09:17:04.000000000 +0000 +++ macfanctld-0.6~mactel1ubuntu3/debian/changelog 2012-04-21 09:37:49.000000000 +0000 @@ -1,3 +1,9 @@ +macfanctld (0.6~mactel1ubuntu3) oneiric; urgency=low + + * Corrected wrong files uploaded to PPA. + + -- Mikael Strom Sat, 21 Apr 2012 17:37:02 +0800 + macfanctld (0.6~mactel1ubuntu2) oneiric; urgency=low * Decreased CPU usage by caching sensor file names and replacing diff -Nru macfanctld-0.6~mactel1ubuntu2/debian/patches/debian-changes-0.6~mactel1ubuntu2 macfanctld-0.6~mactel1ubuntu3/debian/patches/debian-changes-0.6~mactel1ubuntu2 --- macfanctld-0.6~mactel1ubuntu2/debian/patches/debian-changes-0.6~mactel1ubuntu2 2012-04-21 09:17:27.000000000 +0000 +++ macfanctld-0.6~mactel1ubuntu3/debian/patches/debian-changes-0.6~mactel1ubuntu2 2012-04-21 09:30:56.000000000 +0000 @@ -26,14 +26,216 @@ --- macfanctld-0.6~mactel1ubuntu2.orig/control.c +++ macfanctld-0.6~mactel1ubuntu2/control.c -@@ -141,6 +141,10 @@ void find_applesmc() - +@@ -63,6 +63,7 @@ struct sensor + int id; + int excluded; + char name[SENSKEY_MAXLEN]; ++ char fname[PATH_MAX]; + float value; + }; + +@@ -106,7 +107,7 @@ void find_applesmc() + if(fd_dir != NULL) + { + struct dirent *dir_entry; +- ++ + while((dir_entry = readdir(fd_dir)) != NULL && base_path[0] == 0) + { + if(dir_entry->d_name[0] != '.') +@@ -115,7 +116,7 @@ void find_applesmc() + int fd_name; + + sprintf(name_path, "%s/%s/device/name", HWMON_DIR, dir_entry->d_name); +- ++ + fd_name = open(name_path, O_RDONLY); + + if(fd_name > -1) +@@ -123,7 +124,7 @@ void find_applesmc() + char name[sizeof(APPLESMC_ID)]; + + ret = read(fd_name, name, sizeof(APPLESMC_ID) - 1); +- ++ + close(fd_name); + + if(ret == sizeof(APPLESMC_ID) - 1) +@@ -132,13 +133,13 @@ void find_applesmc() + { + char *dev_path; + char *last_slash = strrchr(name_path, '/'); +- ++ + if(last_slash != NULL) + { + *last_slash = 0; + + dev_path = realpath(name_path, NULL); +- ++ if(dev_path != NULL) { -+ -+ char fname[PATH_MAX]; -+ sprintf(fname, "%s/temp%d_input", base_path, sensors[i].id); -+ strncpy(base_path, dev_path, sizeof(base_path) - 1); - base_path[sizeof(base_path) - 1] = 0; - free(dev_path); +@@ -153,15 +154,15 @@ void find_applesmc() + } + closedir(fd_dir); + } +- ++ + // create paths to fan and sensor +- ++ + if(base_path[0] == 0) + { + printf("Error: Can't find a applesmc device\n"); + exit(-1); + } +- ++ + sprintf(fan1_min, "%s/fan1_min", base_path); + sprintf(fan2_min, "%s/fan2_min", base_path); + sprintf(fan1_man, "%s/fan1_manual", base_path); +@@ -170,12 +171,6 @@ void find_applesmc() + printf("Found applesmc at %s\n", base_path); + } + +-//#define base_path "/sys/devices/platform/applesmc.768" +-//#define fan1_min "/sys/devices/platform/applesmc.768/fan1_min" +-//#define fan2_min "/sys/devices/platform/applesmc.768/fan2_min" +-//#define fan1_man "/sys/devices/platform/applesmc.768/fan1_manual" +-//#define fan2_man "/sys/devices/platform/applesmc.768/fan2_manual" +- + //------------------------------------------------------------------------------ + + void read_sensors() +@@ -187,28 +182,25 @@ void read_sensors() + { + // read temp value + +- char fname[PATH_MAX]; +- sprintf(fname, "%s/temp%d_input", base_path, sensors[i].id); +- +- FILE *fp = fopen(fname, "r"); +- if(fp == NULL) ++ int fd = open(sensors[i].fname, O_RDONLY); ++ if(fd < 0) + { +- printf("Error: Can't open %s\n", fname); ++ printf("Error: Can't open %s\n", sensors[i].fname); + fflush(stdout); + } + else + { + char val_buf[16]; +- int n = fread(val_buf, 1, sizeof(val_buf), fp); ++ int n = read(fd, val_buf, sizeof(val_buf)); + if(n < 1) + { +- printf("Error: Can't read %s\n", fname); ++ printf("Error: Can't read %s\n", sensors[i].fname); + } + else + { + sensors[i].value = (float)atoi(val_buf) / 1000.0; + } +- fclose(fp); ++ close(fd); + } + } + } +@@ -286,66 +278,64 @@ void calc_fan() + + void set_fan() + { +- FILE *fp; +- + char buf[16]; + + // update fan 1 + +- fp = fopen(fan1_min, "w"); +- if(fp == NULL) ++ int fd = open(fan1_min, O_WRONLY); ++ if(fd < 0) + { + printf("Error: Can't open %s\n", fan1_min); + } + else + { + sprintf(buf, "%d", fan_speed); +- fwrite(buf, 1, strlen(buf), fp); +- fclose(fp); ++ write(fd, buf, strlen(buf)); ++ close(fd); + } + + // set fan 1 manual to zero + +- fp = fopen(fan1_man, "w"); +- if(fp == NULL) ++ fd = open(fan1_man, O_WRONLY); ++ if(fd < 0) + { + printf("Error: Can't open %s\n", fan1_man); + } + else + { + strcpy(buf, "0"); +- fwrite(buf, 1, strlen(buf), fp); +- fclose(fp); ++ write(fd, buf, strlen(buf)); ++ close(fd); + } + + // update fan 2 + + if(fan_count > 1) + { +- fp = fopen(fan2_min, "w"); +- if(fp == NULL) ++ fd = open(fan2_min, O_WRONLY); ++ if(fd < 0) + { + printf("Error: Can't open %s\n", fan2_min); + } + else + { + sprintf(buf, "%d", fan_speed); +- fwrite(buf, 1, strlen(buf), fp); +- fclose(fp); ++ write(fd, buf, strlen(buf)); ++ close(fd); + } + + // set fan 2 manual to zero + +- fp = fopen(fan2_man, "w"); +- if(fp == NULL) ++ fd = open(fan2_man, O_WRONLY); ++ if(fd < 0) + { + printf("Error: Can't open %s\n", fan2_man); + } + else + { + strcpy(buf, "0"); +- fwrite(buf, 1, strlen(buf), fp); +- fclose(fp); ++ write(fd, buf, strlen(buf)); ++ close(fd); + } + } + +@@ -438,9 +428,10 @@ void scan_sensors() + { + char fname[512]; + +- // set id and check exclude list ++ // set id, check exclude list and save file name + sensors[i].id = i + 1; + sensors[i].excluded = 0; ++ sprintf(sensors[i].fname, "%s/temp%d_input", base_path, sensors[i].id); + + for(j = 0; j < MAX_EXCLUDE && exclude[j] != 0; ++j) + {