aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_raspi.c
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2013-05-23 03:07:28 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2013-05-23 03:07:28 +0000
commit745168103cf981345f3ab62d884d70de14524eb4 (patch)
treef69b1cf5bf6afaa8fcd7118bdf03b8dc409137d9 /plugin_raspi.c
parentab5d1fd17f1892b25299b5dd7ae7de0c5121613e (diff)
downloadlcd4linux-745168103cf981345f3ab62d884d70de14524eb4.tar.gz
indentation
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1199 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_raspi.c')
-rw-r--r--plugin_raspi.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/plugin_raspi.c b/plugin_raspi.c
index 5932d08..6e5b021 100644
--- a/plugin_raspi.c
+++ b/plugin_raspi.c
@@ -74,19 +74,20 @@ char tmpstr[128];
/* Note: all local functions should be declared 'static' */
/* reading an positive integer value from path, -1 on error */
-static int readValue(char *path) {
+static int readValue(char *path)
+{
int value = -1;
FILE *fp;
fp = fopen(path, "r");
if (NULL != fp) {
- fgets(tmpstr, sizeof(tmpstr), fp);
- fclose(fp);
+ fgets(tmpstr, sizeof(tmpstr), fp);
+ fclose(fp);
if (1 != sscanf(tmpstr, "%i", &value)) {
- error("[raspi] error reading integer value from %s\n", path);
- }
+ error("[raspi] error reading integer value from %s\n", path);
+ }
} else {
- error("[raspi] error opening %s: %s\n", path, strerror(errno));
+ error("[raspi] error opening %s: %s\n", path, strerror(errno));
}
return value;
@@ -94,16 +95,17 @@ static int readValue(char *path) {
/* reads a string from path */
-static char* readStr(char *path) {
+static char *readStr(char *path)
+{
FILE *fp;
memset(tmpstr, 0, sizeof(tmpstr));
fp = fopen(path, "r");
if (NULL != fp) {
- fgets(tmpstr, sizeof(tmpstr), fp);
- fclose(fp);
+ fgets(tmpstr, sizeof(tmpstr), fp);
+ fclose(fp);
} else {
- error("[raspi] error reading text value from %s: %s\n", path, strerror(errno));
+ error("[raspi] error reading text value from %s: %s\n", path, strerror(errno));
}
return tmpstr;
@@ -150,29 +152,29 @@ int plugin_init_raspi(void)
char checkFile[128];
snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_TEMP_PATH, RASPI_TEMP_IDFILE);
- if (strncmp( readStr(checkFile), RASPI_TEMP_ID, strlen(RASPI_TEMP_ID) ) != 0) {
- error("Warning: no raspberry pi thermal sensor found: value of '%s' is '%s', should be '%s'",
- checkFile, readStr(checkFile), RASPI_TEMP_IDFILE);
+ if (strncmp(readStr(checkFile), RASPI_TEMP_ID, strlen(RASPI_TEMP_ID)) != 0) {
+ error("Warning: no raspberry pi thermal sensor found: value of '%s' is '%s', should be '%s'",
+ checkFile, readStr(checkFile), RASPI_TEMP_IDFILE);
}
snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_TEMP_PATH, RASPI_TEMP_VALUE);
if (0 == access(checkFile, R_OK)) {
- AddFunction("raspi::cputemp", 0, my_cputemp);
+ AddFunction("raspi::cputemp", 0, my_cputemp);
} else {
- error("Error: File '%s' not readable, no temperature sensor found", checkFile);
+ error("Error: File '%s' not readable, no temperature sensor found", checkFile);
}
snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_FREQ_PATH, RASPI_FREQ_IDFILE);
- if (strncmp( readStr(checkFile), RASPI_FREQ_ID, strlen(RASPI_FREQ_ID) ) != 0) {
- error("Warning: no raspberry pi frequence sensor found: value of '%s' is '%s', should be '%s'",
- checkFile, readStr(checkFile), RASPI_FREQ_IDFILE);
+ if (strncmp(readStr(checkFile), RASPI_FREQ_ID, strlen(RASPI_FREQ_ID)) != 0) {
+ error("Warning: no raspberry pi frequence sensor found: value of '%s' is '%s', should be '%s'",
+ checkFile, readStr(checkFile), RASPI_FREQ_IDFILE);
}
snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_FREQ_PATH, RASPI_FREQ_VALUE);
if (0 == access(checkFile, R_OK)) {
- AddFunction("raspi::cpufreq", 0, my_cpufreq);
+ AddFunction("raspi::cpufreq", 0, my_cpufreq);
} else {
- error("Error: File '%s' not readable, no frequency sensor found", checkFile);
+ error("Error: File '%s' not readable, no frequency sensor found", checkFile);
}
return 0;