summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrunstatus.sh2
-rw-r--r--statuses/fan.c27
-rw-r--r--statuses/fan.h7
-rw-r--r--sysstatus.c4
4 files changed, 37 insertions, 3 deletions
diff --git a/runstatus.sh b/runstatus.sh
index a7681f7..c279115 100755
--- a/runstatus.sh
+++ b/runstatus.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-MAXRESX=1680
+MAXRESX=1920
RES=$(xrandr --prop | sed "s/Screen 0:[^,]*, current \(.*\) x \(.*\),.*/\1,\2/g;te;d;:e")
RESX=${RES%%,*}
diff --git a/statuses/fan.c b/statuses/fan.c
new file mode 100644
index 0000000..2be5b28
--- /dev/null
+++ b/statuses/fan.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include "fan.h"
+
+void status_fan(char *title, char *sysfile)
+{
+ char stline[16];
+ int stfile;
+ ssize_t stlen;
+
+ stlen = fileRead(stline, sizeof(stline), sysfile);
+ if (stlen <= 0)
+ return;
+
+ // Read a valid value? Sometimes we get garbage from sysfs...
+ if (stlen > 5)
+ {
+ printf(" ^fg(red)%sERROR ", title);
+ return;
+ }
+
+ fputs(" ^fg(#CCCCCC)", stdout);
+ fputs(title, stdout);
+ fwrite(stline, 1, stlen - 1, stdout);
+ fputs(" rpm ", stdout);
+}
diff --git a/statuses/fan.h b/statuses/fan.h
new file mode 100644
index 0000000..dd5e494
--- /dev/null
+++ b/statuses/fan.h
@@ -0,0 +1,7 @@
+
+#ifndef __FAN_H__
+#define __FAN_H__
+
+void status_fan(char *title, char *sysfile);
+
+#endif
diff --git a/sysstatus.c b/sysstatus.c
index ce6086b..9433da1 100644
--- a/sysstatus.c
+++ b/sysstatus.c
@@ -33,9 +33,9 @@ void updatestatus()
//status_temp("GPU: ", "/sys/class/hwmon/hwmon0/device/temp4_input");
//status_temp("CPU: ", "/sys/class/hwmon/hwmon0/device/temp2_input");
- status_temp("CPU: ", "/sys/class/hwmon/hwmon1/device/temp1_input");
+ status_temp("CPU: ", "/sys/devices/platform/coretemp.0/temp1_input");
- status_fan("Fan: ", "/sys/class/hwmon/hwmon2/device/fan1_input");
+ status_fan("Fan: ", "/sys/devices/platform/thinkpad_hwmon/fan1_input");
status_volume_alsa("default", "Master", 0);