  
  	/* Send out the first stratum message STATIC */
  	applog(LOG_DEBUG, "Avalon2: Pool stratum message STATIC: %d, %d, %d, %d, %d",
-@@ -429,7 +505,7 @@ static int avalon2_stratum_pkgs(int fd, struct pool *pool, struct thr_info *thr)
- 	while (avalon2_send_pkg(fd, &pkg, thr) != AVA2_SEND_OK)
- 		;
- 
--	set_target(target, pool->swork.diff);
-+	set_target(target, pool->sdiff);
- 	memcpy(pkg.data, target, 32);
- 	if (opt_debug) {
- 		char *target_str;
-@@ -447,10 +523,9 @@ static int avalon2_stratum_pkgs(int fd, struct pool *pool, struct thr_info *thr)
+@@ -460,10 +523,9 @@ static int avalon2_stratum_pkgs(int fd, struct pool *pool, struct thr_info *thr)
  	memset(pkg.data, 0, AVA2_P_DATA_LEN);
  
  	job_id_len = strlen(pool->swork.job_id);

 			break;
 		case AVA2_P_STATUS:
 			memcpy(&tmp, ar->data, 4);
@@ -265,6 +338,8 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
 			memcpy(&(info->power_good[modular_id]), ar->data + 24, 4);
 
 			info->get_frequency[modular_id] = be32toh(info->get_frequency[modular_id]);

-	opt_avalon2_fan_max = AVA2_PWM_MAX - val2 * AVA2_PWM_MAX / 100;
+	opt_avalon2_fan_min = get_fan_pwm(val1);
+	opt_avalon2_fan_max = get_fan_pwm(val2);
 
 	return NULL;
 }
 
+char *set_avalon2_fixed_speed(enum avalon2_fan_fixed *f)
+{
+	*f = FAN_FIXED;
+	return NULL;
+}
+
 char *set_avalon2_freq(char *arg)
 {
 	int val1, val2, ret;
@@ -147,12 +158,24 @@ static int avalon2_init_pkg(struct avalon2_pkg *pkg, uint8_t type, uint8_t idx,
 
 static int job_idcmp(uint8_t *job_id, char *pool_job_id)
 {
