Allow hfa fanspeed to be set via command line.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
diff --git a/cgminer.c b/cgminer.c
index 3df3b53..f45d469 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1228,6 +1228,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--hfa-hash-clock",
set_int_0_to_9999, opt_show_intval, &opt_hfa_hash_clock,
"Set hashfast clock speed"),
+ OPT_WITH_ARG("--hfa-fan",
+ set_hfa_fan, NULL, NULL,
+ "Set fanspeed percentage for hashfast, single value or range (default: 10-85)"),
OPT_WITH_ARG("--hfa-ntime-roll",
opt_set_intval, NULL, &opt_hfa_ntime_roll,
opt_hidden),
diff --git a/driver-hashfast.c b/driver-hashfast.c
index 3050067..afd8f65 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -36,6 +36,26 @@ int opt_hfa_fan_min = HFA_FAN_MIN;
#define DI8 0x07
static bool hfa_crc8_set;
+
+char *set_hfa_fan(char *arg)
+{
+ int val1, val2, ret;
+
+ ret = sscanf(arg, "%d-%d", &val1, &val2);
+ if (ret < 1)
+ return "No values passed to hfa-fan";
+ if (ret == 1)
+ val2 = val1;
+
+ if (val1 < 0 || val1 > 100 || val2 < 0 || val2 > 100 || val2 < val1)
+ return "Invalid value passed to hfa-fan";
+
+ opt_hfa_fan_min = val1;
+ opt_hfa_fan_max = val2;
+
+ return NULL;
+}
+
static unsigned char crc8_table[256]; /* CRC-8 table */
static void hfa_init_crc8(void)
diff --git a/driver-hashfast.h b/driver-hashfast.h
index 4aaf5ba..c2fa608 100644
--- a/driver-hashfast.h
+++ b/driver-hashfast.h
@@ -26,6 +26,8 @@ int opt_hfa_fan_default;
int opt_hfa_fan_max;
int opt_hfa_fan_min;
+char *set_hfa_fan(char *arg);
+
#define HASHFAST_MINER_THREADS 1
#define HFA_CLOCK_DEFAULT 550
#define HFA_CLOCK_MIN 125