Bonjour,
J'ai un rhéobus LIS 2 (non, continez à lire, je ne me suis pas trompé de catégorie !) qui peut piloter des ventilateurs en fonction de certaines températures.
Le logiciel de pilotage récupère les températures lues à partir de MBM5, du moins les 8 premières.
De base MBM5 ne sait pas lire les températures d'une GeForce 6600GT.
J'ai récupéré sur le net un plugin pour MBM5 qui le permet. Il fonctionne bien.
Hélas ! Ce plugin met les valeurs dans les variable Sensor21 à Sensor26 de MBM5.
Comme mon ligiciel de Rhoébus ne peut récupérer que les sensor 1 à sensor 8, je suis marron.
Le gars qui a fait le plugin a très gentiment founi les sources, apparrement en Visual C++.
J'ai modifié le source pour décaler les températures sur les sensors 3 à 8. Mais il me faut maintenant recompiler le projet.
Je ne sais pas faire.
J'ai téléchargé MS Visual C++ toolkit 2003 (c'est du télécharge gratuit), mais c'est un compilateur en ligne de commande, je suis perdu.
Je vous demande donc soit :
- de m'expliquer comment compiler mon projet avec MS Visual C++ toolkit 2003 (ou un autre outil libre que vous connaissez et que je peux légalement télécharger
- de m'offrir gracieusement vos services pour recompiler ce projet.
Je précise que le projet zippé fait 8ko, donc je vous l'enverrai par mail aisément.
Merci d'avance de votre gentilessse,
LoDeNo
Pour information,
Voici les fichiers du projet :
28/10/2005 22:54 8 533 MBM5NVdriver.cpp
18/07/2005 02:04 984 MBM5NVdriver.sln
20/07/2005 18:55 4 432 MBM5NVdriver.vcproj
13/07/2005 16:57 141 MBM5Plugin.def
18/07/2005 02:04 299 stdafx.cpp
18/07/2005 02:04 380 stdafx.h
Voici le contenu de MBM5NVdriver.cpp :
#include "stdafx.h"
#include <windows.h>
#define READ_CLOCKS
#define TRY_SLI
typedef unsigned char boolean;
#define MBM5_API __declspec(dllexport)
#define MBM5PLUGIN_FUN __stdcall
void Shutdown();
void SetTemps();
void ZeroSensors();
HANDLE hModule;
static int start = 0;
#define NrTemperature 32
#define NrVoltage 16
#define NrFan 16
#define NrCPU 4
// enum Bus
#define BusType char
#define ISA 0
#define SMBus 1
#define VIA686Bus 2
#define DirectIO 3
// enum SMB
#define SMBType char
#define smtSMBIntel 0
#define smtSMBAMD 1
#define smtSMBALi 2
#define smtSMBNForce 3
#define smtSMBSIS 4
// enum Sensor Types
#define SensorType char
#define stUnknown 0
#define stTemperature 1
#define stVoltage 2
#define stFan 3
#define stMhz 4
#define stPercentage 5
#define SENSOR_TEMPERATURE 1
#define SENSOR_VOLTAGE 2
#define SENSOR_FAN 2
#pragma pack(1)
typedef struct {
int iType; // type of sensor
int Count; // number of sensor for that type
} SharedIndex;
typedef struct {
SensorType ssType; // type of sensor
unsigned char ssName[12]; // name of sensor
char sspadding1[3]; // padding of 3 byte
double ssCurrent; // current value
double ssLow; // lowest readout
double ssHigh; // highest readout
long ssCount; // total number of readout
char sspadding2[4]; // padding of 4 byte
char ssTotal[10]; // total amout of all readouts
char sspadding3[6]; // padding of 6 byte
double ssAlarm1; // temp & fan: high alarm; voltage: % off;
double ssAlarm2; // temp: low alarm
} SharedSensor;
typedef struct {
short siSMB_Base; // SMBus base address
BusType siSMB_Type; // SMBus/Isa bus used to access chip
SMBType siSMB_Code; // SMBus sub type, Intel, AMD or ALi
char siSMB_Addr; // Address of sensor chip on SMBus
unsigned char siSMB_Name[41]; // Nice name for SMBus
short siISA_Base; // ISA base address of sensor chip on ISA
int siChipType; // Chip nr, connects with Chipinfo.ini
char siVoltageSubType; // Subvoltage option selected
} SharedInfo;
typedef struct {
double sdVersion; // version number (example: 51090)
SharedIndex sdIndex[10]; // Sensor index
SharedSensor sdSensor[100]; // sensor info
SharedInfo sdInfo; // misc. info
unsigned char sdStart[41]; // start time
unsigned char sdCurrent[41]; // current time
unsigned char sdPath[256]; // MBM path
} SharedData;
void set_sensor(SharedSensor *sensor, double current, char *name) {
double total;
char buffer[10];
sensor->ssCurrent = current;
if (start == 0) {
total = current;
sensor->ssLow = current;
sensor->ssHigh = current;
sensor->ssCount = 1;
if (name != 0)
{
if (strncmp((const char*)sensor->ssName, "Sensor", 6) == 0)
strcpy((char *)sensor->ssName, name);
}
} else {
memcpy(buffer, sensor->ssTotal, 10);
_asm {
fld TBYTE PTR buffer;
fstp total;
}
total += current;
if (current < sensor->ssLow)
sensor->ssLow = current;
if (current > sensor->ssHigh)
sensor->ssHigh = current;
sensor->ssCount++;
}
_asm {
fld total;
fstp TBYTE PTR buffer;
}
memcpy(sensor->ssTotal, buffer, 10);
}
BOOL APIENTRY DllMain( HANDLE _hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
hModule = _hModule;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#if defined TRY_SLI
char* pluginName = "NV driver temperature monitoring v7.2a SLI";
#else
char* pluginName = "NV driver temperature monitoring v7.2a";
#endif
char* pluginMenu = "About";
#if defined READ_CLOCKS //(&&/|| TRY_SLI)
static const unsigned numTempSources = 6;
#elif defined TRY_SLI
static const unsigned numTempSources = 4;
#else
static const unsigned numTempSources = 2;
#endif
MBM5_API unsigned char MBM5PLUGIN_FUN PlugInType(void)
{
return 2;
}
MBM5_API char* MBM5PLUGIN_FUN PlugInName(void)
{
return strdup(pluginName);
}
MBM5_API boolean MBM5PLUGIN_FUN PlugInInit(char* P, int H)
{
start = 0;
return true;
}
MBM5_API boolean MBM5PLUGIN_FUN PlugInStart(void)
{
start = 0;
SetTemps();
return true;
}
MBM5_API boolean MBM5PLUGIN_FUN PlugInStop(void)
{
ZeroSensors();
start = 0;
return true;
}
MBM5_API void MBM5PLUGIN_FUN PlugInPulse(void)
{
SetTemps();
}
MBM5_API void MBM5PLUGIN_FUN PlugInPause(boolean P)
{
}
MBM5_API boolean MBM5PLUGIN_FUN PlugInClose(void)
{
Shutdown();
start = 0;
return true;
}
MBM5_API char* MBM5PLUGIN_FUN PlugInMenuName(void)
{
return strdup(pluginMenu);
}
MBM5_API void MBM5PLUGIN_FUN PlugInOption(unsigned char O)
{
MessageBox(NULL,
"Video card hardware monitor plugin for Motherboard Monitor 5\n"
"GPU access method: NVidia display driver\n",
"About", MB_OK);
}
void Shutdown()
{
}
void ZeroSensors()
{
if (numTempSources <= 0)
return;
SharedData *ptr;
HANDLE hSData;
hSData = OpenFileMapping(FILE_MAP_WRITE, FALSE, "$M$B$M$5$S$D$" );
if (hSData == 0)
return;
ptr = (SharedData *)MapViewOfFile(hSData, FILE_MAP_WRITE, 0, 0, 0);
if (ptr == 0){
CloseHandle(hSData);
return;
}
//////////////////////////////////////////////////////////////////////////////////
for (unsigned i = 0; i < numTempSources; i++)
{
set_sensor(&ptr->sdSensor[NrTemperature/*+NrVoltage+NrFan+NrCPU*/-i-7], 0, 0);
}
//////////////////////////////////////////////////////////////////////////////////
UnmapViewOfFile(ptr);
CloseHandle(hSData);
}
void SetTemps()
{
SharedData *ptrs;
HANDLE hSData;
hSData = OpenFileMapping(FILE_MAP_WRITE, FALSE, "$M$B$M$5$S$D$" );
if (hSData == 0)
return;
ptrs = (SharedData *)MapViewOfFile(hSData, FILE_MAP_WRITE, 0, 0, 0);
if (ptrs == 0){
CloseHandle(hSData);
return;
}
bool startTemps = false, startClocks = false;
HDC display = CreateDC("\\\\.\\DISPLAY1", NULL, NULL, NULL);
if (display != NULL)
{
static DWORD buffer[8*2*4] = {0};
// Temps /////////////////////////////////////////////////////////////////////////////////
#if defined TRY_SLI
DWORD inTemps[8] = {0,0,0x1b0,0,(DWORD)&buffer[0],0,0x48,0};
#else
DWORD inTemps[8] = {0,0,0x1b0,0,(DWORD)&buffer[0],0,0x24,0};
#endif
DWORD outTemps[8] = {0,0,0,0,0,0,0,0xffffffff};
if (ExtEscape(display, 0x7037, 0x20, (LPCSTR)&inTemps[0], 0x20, (LPSTR)&outTemps[0]) > 0)
{
set_sensor(&ptrs->sdSensor[NrTemperature-0-7], buffer[0], "GPU ambient" );
set_sensor(&ptrs->sdSensor[NrTemperature-1-7], buffer[1], "GPU core" );
#if defined TRY_SLI
set_sensor(&ptrs->sdSensor[NrTemperature-2-7], buffer[9], "GPU2 ambient" );
set_sensor(&ptrs->sdSensor[3], buffer[10], "GPU2 core" ); J'ai uniquement changé cette valeur qui était à "NrTemperature-2-7"
#endif
startTemps = true;
// Temps end /////////////////////////////////////////////////////////////////////////////
// Clocks /////////////////////////////////////////////////////////////////////////////////
#if defined READ_CLOCKS
//DWORD inClocks1[5] = {0,0,0xfd,0,0};
//DWORD inClocks1[5] = {0,0xDABBADDD,0xfd,0,0};
DWORD inClocks1[5] = {0,0xDABBADDD,0xfd,0,0};
DWORD outClocks1[5] = {0,0,0,0,0};
if (ExtEscape(display, 0x7032, 0x14, (LPCSTR)&inClocks1[0], 0x14, (LPSTR)&outClocks1[0]) > 0)
{
set_sensor(&ptrs->sdSensor[NrTemperature-4-7], outClocks1[3] * 1e-6, "Core clock" );
startClocks = true;
}
DWORD inClocks2[5] = {0,0xDABBADDD,0xfb,0,0};
DWORD outClocks2[5] = {0,0,0,0,0};
if (ExtEscape(display, 0x7032, 0x14, (LPCSTR)&inClocks2[0], 0x14, (LPSTR)&outClocks2[0]) > 0)
{
set_sensor(&ptrs->sdSensor[NrTemperature-5-7], outClocks2[3] * 1e-6, "Memory clock" );
startClocks &= true;
}
#endif
// Clocks end /////////////////////////////////////////////////////////////////////////////
}
DeleteDC(display);
}
if(startTemps && startClocks)
start = 1;
UnmapViewOfFile(ptrs);
CloseHandle(hSData);
}
Voici le contenu de stdafx.cpp :
// stdafx.cpp : source file that includes just the standard includes
// MBM5NVdriver.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
Voici le contenu de stdafx.h :
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
// TODO: reference additional headers your program requires here
Voici le contenu de MBM5plugin.def :
EXPORTS
PlugInClose
PlugInInit
PlugInMenuName
PlugInName
PlugInOption
PlugInPause
PlugInPulse
PlugInStart
PlugInStop
PlugInType
Les autres ne sont pas lisibles en texte.
Message édité par LoDeNo le 31-10-2005 à 20:12:37