mi/util.c
// sets the acoustic level on modern hard drives.   This is used to run it
// at a lower speed/performance level, which in turn reduces noise. 
sets the acoustic level on modern hard drives.   This is used to run it
at a lower speed/performance level, which in turn reduces noise.
sets the acoustic level on modern hard drives . This is used to run it at a lower speed / performance level which in turn reduces noise .
int32_t ata_setacoustic(struct ATA *ata, int ata_chan, int ata_dev, uint32_t acoustic_val)
{
	int32_t rc = 0;
	static const int aac_user_offset = 127;
	acoustic_val += aac_user_offset; 
	if( (acoustic_val > ATA_AUTOACOUSTIC_MAXPERF) || (acoustic_val < 0) ) {
			printf("invalid acoustic value: must be %d-%d\n", 1, ATA_AUTOACOUSTIC_MAXPERF - aac_user_offset);
			rc = -1;
	}
	ata_setataparams(ata, acoustic_val, 0);
	ata_setfeature_param(ata, ATA_AUTOACOUSTIC_ENABLE);
	if(acoustic_val == 127)
		ata_setfeature_param(ata, ATA_AUTOACOUSTIC_DISABLE);
	if(!rc) {
		rc = ata_cmd( ata, ata_chan, ata_dev, ATA__SETFEATURES, 0 );
		if(rc)
			perror("Set AutoAcoustic failed");
		else {
			printf("Set AutoAcoustic value to %d\n", acoustic_val-aac_user_offset);
			if(acoustic_val == ATA_AUTOACOUSTIC_MAXPERF)
					printf("Acoustic value set to maximum performance (most acoustic impact)\n");
			else if(acoustic_val == ATA_AUTOACOUSTIC_MINPERF)
				printf("Acoustic value set to minimum performance (least acoustic impact)\n");
			else if(acoustic_val == 127)
				printf("Acoustic management disabled\n");
		}
	}
	return rc;
}
int32_t ata_setacoustic ( struct ATA * ata , int ata_chan , int ata_dev , uint32_t acoustic_val ) { int32_t rc = 0 ; static const int aac_user_offset = 127 ; acoustic_val += aac_user_offset ; if ( ( acoustic_val > ATA_AUTOACOUSTIC_MAXPERF ) || ( acoustic_val < 0 ) ) { printf ( " \n " , 1 , ATA_AUTOACOUSTIC_MAXPERF - aac_user_offset ) ; rc = -1 ; } ata_setataparams ( ata , acoustic_val , 0 ) ; ata_setfeature_param ( ata , ATA_AUTOACOUSTIC_ENABLE ) ; if ( acoustic_val == 127 ) ata_setfeature_param ( ata , ATA_AUTOACOUSTIC_DISABLE ) ; if ( ! rc ) { rc = ata_cmd ( ata , ata_chan , ata_dev , ATA__SETFEATURES , 0 ) ; if ( rc ) perror ( " " ) ; else { printf ( " \n " , acoustic_val - aac_user_offset ) ; if ( acoustic_val == ATA_AUTOACOUSTIC_MAXPERF ) printf ( " \n " ) ; else if ( acoustic_val == ATA_AUTOACOUSTIC_MINPERF ) printf ( " \n " ) ; else if ( acoustic_val == 127 ) printf ( " \n " ) ; } } return rc ; }
sets the acoustic level on modern hard drives.
sets the acoustic level on modern hard drives .
// scale it 0x80-0xFE, 128-254 // range check our acoustic level parameter // disable AAC if user specified 0, which is 127 once offset // send the drive a SET_FEATURES command  // with a FEATURE of ATA_AUTOACOUSTIC_ENABLE