From c7dd7ccc78d657c754519d4a214d53392fc77ba9 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 2 Nov 2012 14:18:56 +0400 Subject: [PATCH] system/setting_helpers.cpp: add static CFanControlNotifier::setSpeed, to call it direct --- src/system/setting_helpers.cpp | 22 ++++++++++++---------- src/system/setting_helpers.h | 1 + 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index b9c3b0990..eeb013c9f 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -494,24 +494,26 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK return ret; } -bool CFanControlNotifier::changeNotify(const neutrino_locale_t, void * data) +void CFanControlNotifier::setSpeed(unsigned int speed) { - int cfd, ret; - //unsigned char speed = (unsigned char) g_settings.fan_speed; - unsigned int speed = * (int *) data; + int cfd; printf("FAN Speed %d\n", speed); cfd = open("/dev/cs_control", O_RDONLY); if(cfd < 0) { perror("Cannot open /dev/cs_control"); - return false; + return; } - ret = ioctl(cfd, IOC_CONTROL_PWM_SPEED, speed); - close(cfd); - if(ret < 0) { + if (ioctl(cfd, IOC_CONTROL_PWM_SPEED, speed) < 0) perror("IOC_CONTROL_PWM_SPEED"); - return false; - } + + close(cfd); +} + +bool CFanControlNotifier::changeNotify(const neutrino_locale_t, void * data) +{ + unsigned int speed = * (int *) data; + setSpeed(speed); return false; } diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index ab3b9b1bd..88207dc36 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -155,6 +155,7 @@ class CFanControlNotifier : public CChangeObserver { public: bool changeNotify(const neutrino_locale_t, void * data); + static void setSpeed(unsigned int speed); }; class CCpuFreqNotifier : public CChangeObserver