N'étant pas satisfait du fonctionnement de fancontrol, j'ai codé mon rhéobus (30 €+ de hardware économisé).
les sources sont ici
Utiliser pwmconfig (en root) pour détecter les contrôleurs des ventilos.
Avec les cartes mères asus, il faut positionner l'option q-fan dans le bios.
config.h (exemple)
Code : Tout sélectionner
/*------------------------------------------------------*/
/* rheobus : contrôle de la vitesse des ventilateurs */
/*------------------------------------------------------*/
#define HOSTNAME "asus4570"
#define PWMPATH "/sys/class/hwmon/hwmon1/"
#define NIVEAUX 5
typedef struct {
char *device;
char *enable;
char *input;
unsigned char pwm[NIVEAUX];
int speed[NIVEAUX]; /* pour usage */
} Fan;
static Fan fans[] = {
/*[1] = {"pwm1", "pwm1_enable", "fan1_input", {1, 100, 140, 200, 255}, {820,1130,1300,1400,1500}},*/
[2] = {"pwm2", "pwm2_enable", "fan2_input", {0, 160, 172, 192, 255}, {920,1050,1200,1450,1700}},
};
// vim: ts=4 sw=4
Code : Tout sélectionner
/*---------------------------------------------------------*/
/* rheobus n : contrôle de la vitesse des ventilateurs */
/* règle tous les ventilateurs au niveau n. */
/* La vitesse de chaque ventilateur n'est */
/* pas forcément identique pour un niveau. */
/* */
/* rheobus n v : règle la vitesse du ventilateur v au */
/* niveau n. */
/*---------------------------------------------------------*/
#define PRGNAME "rheobus"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "config.h" /* settings */
#define NBFAN sizeof(fans) / sizeof(fans[0])
static FILE *open_file(char *fname, char *mode);
static unsigned int read_uint(char *fname);
static void usage(void);
/*--------------------------------------*/
/* ouvre un fichier dans pwmpath */
/*--------------------------------------*/
FILE *open_file(char *fname, char *mode)
{
static char path[60];
sprintf(path, PWMPATH "%s", fname);
return(fopen(path, mode));
}
/*--------------------------------------*/
/* extrait l'entier d'un fichier */
/*--------------------------------------*/
unsigned int read_uint(char *fname)
{
static FILE *f;
static unsigned int i;
if ( (f = open_file(fname, "rb")) == NULL )
return(0);
fscanf(f, "%u", &i);
fclose(f);
return(i);
}
void usage(void) {
int j;
fprintf(stderr,
"\n\trheobus multi-voies: contrôle de la vitesse des ventilateurs"
"\n\t\tconfiguration %s\n"
"\n\tUsage: %s niveau [ventilateur {0..9}]\n",
HOSTNAME, PRGNAME);
for(j=0;j<NBFAN;j++) {
if ( !fans[j].device )
continue;
fprintf(stderr,
"\n\tfan%i,\n\tpwm, rpm : %3u, %4u\n",
j, read_uint(fans[j].device), read_uint(fans[j].input));
fprintf(stderr,
"\n\tniveau: %6i, %4i, %4i, %4i, %4i", 1, 2, 3, 4, 5);
fprintf(stderr,
"\n\tpwm:%10i, %4i, %4i, %4i, %4i",
fans[j].pwm[0], fans[j].pwm[1], fans[j].pwm[2], fans[j].pwm[3], fans[j].pwm[4]);
fprintf(stderr,
"\n\ttours/mn: %4i, %4i, %4i, %4i, %4i\n\n",
fans[j].speed[0], fans[j].speed[1], fans[j].speed[2], fans[j].speed[3], fans[j].speed[4]);
}
exit(1);
}
int main(int argc, char *argv[]) {
static unsigned char c, niveau;
static int i, ub=NBFAN;
static FILE *f;
if ( argc > 3 || argc < 2 || strlen(argv[1]) != 1 )
usage();
else if ( argc > 2 && strlen(argv[2]) != 1 )
usage();
niveau = argv[1][0] - '0';
if ( niveau > NIVEAUX || niveau < 1 )
usage();
if ( argc > 2 ) {
c = argv[2][0] - '0';
if ( fans[c].device ) {
i = c;
ub = i + 1;
}
else {
fprintf(stderr, "\n\tventilateur %s inexistant.\n\n", argv[2]);
usage();
}
}
for(;i<ub;i++) {
if ( !fans[i].device )
continue;
if ( (f = open_file(fans[i].enable, "w")) == NULL )
usage();
fprintf(f, "1");
fclose(f);
if ( (f = open_file(fans[i].device, "w")) == NULL )
usage();
c = argv[1][0] - '0';
fprintf(f, "%i", fans[i].pwm[niveau-1]);
fclose(f);
}
}
// vim: ts=4 sw=4
Code : Tout sélectionner
#
CC = gcc
OPTIONS = -std=c99 -Wall -o
CFLAGS =
all: rheobus
rheobus: rheobus.c
@$(CC) $(OPTIONS) $@ $< $(CFLAGS)
install:
cp rheobus /usr/local/bin
chmod +s /usr/local/bin/rheobus
clean:
rm -f *.o
# vim:sw=4 ts=4