https://bitcointalk.org/index.php?topic=8384.0
I have included the code here for the impatient.
#include <iostream>
#include <cstdlib>
#include <adl_sdk.h>
using namespace std;
extern "C"
{
int ADL_Main_Control_Create (ADL_MAIN_MALLOC_CALLBACK, int);
int ADL_Adapter_NumberOfAdapters_Get(int *);
int ADL_Overdrive5_PowerControl_Set(int, int);
int ADL_Overdrive5_PowerControl_Get(int, int *, int *);
}
void* __stdcall Alloc ( int iSize )
{
void* lpBuffer = malloc ( iSize );
return lpBuffer;
}
void __stdcall ADL_Main_Memory_Free ( void** lpBuffer )
{
if ( NULL != *lpBuffer )
{
free ( *lpBuffer );
*lpBuffer = NULL;
}
}
int main()
{
int adapters, a=99, b=99;
if(ADL_Main_Control_Create (Alloc, 1) != ADL_OK)
{
cout << "ADL initialization error!" << endl;
return -1;
}
if(ADL_Adapter_NumberOfAdapters_Get(&adapters) != ADL_OK)
{
cout << "Cannot get the number of adapters!" << endl;
return -1;
}
cout << "Found " << adapters << " adapters" << endl;
for(int i=0; i<adapters; i++)
{
if(ADL_Overdrive5_PowerControl_Set(i, 10) != ADL_OK)
{
cout << "Failed to set " << i << " power control" << endl;
return -1;
} else { cout << "Value set for " << i << endl; }
if(ADL_Overdrive5_PowerControl_Get(i, &a, &b) != ADL_OK)
{
cout << "Failed to get " << i << " power control" << endl;
return -1;
}
cout << "result: " << a << "%, b: " << b << endl;
}
return 0;
}
The key line here is if(ADL_Overdrive5_PowerControl_Set(i, 10) != ADL_OK), and you can change the 10 to any integer up to 20. In my case 5 didn't quite work, so I had to use 10. Then to compile it you use g++, and run it using the 2nd line.
# g++ -DLINUX -o powercontrol powercontrol.cpp -latiadlxx
# ./powercontrol
Found 12 adapters
Value set for 0
result: 10%, b: 0
Value set for 1
result: 10%, b: 0
Value set for 2
result: 10%, b: 0
Value set for 3
result: 10%, b: 0
Value set for 4
result: 10%, b: 0
Value set for 5
result: 10%, b: 0
Value set for 6
result: 10%, b: 0
Value set for 7
result: 10%, b: 0
Value set for 8
result: 10%, b: 0
Value set for 9
result: 10%, b: 0
Value set for 10
result: 10%, b: 0
Value set for 11
result: 10%, b: 0
No comments:
Post a Comment