The online racing simulator
G27 LEDs mod [renamed]
(330 posts, started )
I tried it and hresult equals to "Something Else"
The actual HRESULT value I get is 0x80040205. Problem is the utter lack of documentation on the Logitech SDK, so I have no way of figuring out what the problem is. Some googling (which might not be relevant at all) showed it might have something to do with aquiring the device. If that's the case, I'm afraid were done
To bad I can't help with this as I don't own a G27 and I won't buy one as long as the G25 works *knockonwood*.
Well, maybe you can. I've attached the current source of my app, do you think you could compare it with your app? It's possible I've overlooked something. What intrigues me is that you get E_NOTIMPL error code whereas I get the mysterious and rather useless 0x80040205...

(I didn't attach the whole vcproj, because the Logitech SDK is rather big but just the "main" file)
Attached files
G27led_v2.txt - 6.2 KB - 529 views
Well the only difference is, that I don't try every possible controller just the controller with id 0 (the wheel in my case).

essential app code



void Activate()
{
if(g_pWheelHandler == NULL)
{
g_pWheelHandler = new bw::WheelHandler();
}
try
{
g_pWheelHandler->Init();
SetTimer(hWindow, 1, 5000, NULL);
hDebugWindow = CreateWindow(L"EDIT",ClassDebug,WS_DLGFRAME|ES_MULTILINE,CW_USEDEFAULT,CW_USEDEFAULT,300,300,hWindow,NULL,hInst, NULL);
SetWindowText(hDebugWindow,L"");
memset(strDebugBuf,0,1024);
ShowWindow(hDebugWindow,1);

}
catch(std::exception& ex)
{
MessageBox(hWindow, CA2CT(ex.what()), L"ERROR", MB_ICONSTOP);
}
}

WindowProc

LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch (uMsg)
{
/* .... */
case WM_TIMER :
{
if(rangeIdx == sizeof(ranges) / sizeof(ranges[0]))
{
rangeIdx = 0;
}
try {
g_pWheelHandler->SetRange(ranges[rangeIdx]);
}
catch(std::exception &ex)
{
MessageBox(hWindow, CA2CT(ex.what()), L"ERROR", MB_ICONSTOP);
}
rangeIdx++;
}
default: return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
return 0;
}

Again the vital part of wheel handler


WheelHandler::WheelHandler(void)
: m_pControllerInput(NULL),m_pWheel(NULL)
, m_iOldRange(0)
{
}

// get handle of LFS window
HWND WheelHandler::GetLFSWindow(void)
{
HWND hwnd = FindWindow(L"LFS", NULL);
if(hwnd == NULL)
{
throw std::exception("LFS window not found");
}
return hwnd;
}

// initialise wheel member
void WheelHandler::InitWheel(void)
{
HWND hLFSWindow = this->GetLFSWindow();
this->m_pControllerInput = new LogitechControllerInput::ControllerInput(hLFSWindow, TRUE);
this->m_pWheel = new LogitechSteeringWheel::Wheel(this->m_pControllerInput);
}

// initialise class
void WheelHandler::Init(void)
{
this->Close();
this->InitWheel();
this->m_iOldRange = this->GetRange();
}

// set the wheel range
void WheelHandler::SetRange(int _range)
{
if(_range < 40 || _range > 900)
{
throw std::exception("Argument out of Range");
}
LogitechSteeringWheel::ControllerPropertiesData propertiesData_;
ZeroMemory(&propertiesData_, sizeof(propertiesData_));
this->Update();
if (!this->m_pWheel->IsConnected(0))
{
throw std::exception("No wheel connected");
}
if(!this->m_pWheel->GetCurrentControllerProperties(0, propertiesData_))
{
// default properties
}
propertiesData_.wheelRange = _range;

this->m_pWheel->SetPreferredControllerProperties(propertiesData_);
this->Update();
HRESULT hRes = this->m_pWheel->PlayLeds(0, 2000.0, 1000.0, 2000.0);
switch(hRes)
{
case 0x80070005:
//MessageBox(NULL, NULL, L"E_ACCESSDENIED", NULL);
Debug(L"E_ACCESSDENIED");
break;
case 0x80004001:
//MessageBox(NULL, NULL, L"E_NOTIMPL", NULL);
Debug(L"E_NOTIMPL");
break;
default:
//MessageBox(NULL, NULL, L"Something else has happened", NULL);
Debug(L"Something else has happened");
}
}


Thanks a lot for the code, I'll look into in and see if I can make some use of it. BTW, did you have only one controller connected when you were testing the LEDs? If I enumerate through all available controllers with

for(int wheelIdx = 0; wheelIdx< LG_MAX_CONTROLLERS; wheelIdx++)

it goes through ALL available gaming devices, for example my Saitek joystick. The interesting part is that calling PlayLeds on the Saitek stick results in E_NOTIMPL, but calling in on my DFP gives me that weird error...
I have only one gaming device, and it's the g27 on ID1.
And I guess that if you try it, you get that "Something else" error, right?

BTW, if you have only one gaming device connected, how come it has ID 1? It really should have ID 0 in that case...
Quote from MadCatX :And I guess that if you try it, you get that "Something else" error, right?

BTW, if you have only one gaming device connected, how come it has ID 1? It really should have ID 0 in that case...

... I have the same issue with my G25... Running the Logitech test suite.. my G25 hooked up.. registers as ID #1..

It's bizzare as hell... Even if I disconnect my G35 and such.. same issue.
Quote from dawesdust_12 :... I have the same issue with my G25... Running the Logitech test suite.. my G25 hooked up.. registers as ID #1..

It's bizzare as hell... Even if I disconnect my G35 and such.. same issue.

Perhaps not, if you open the Profiler and go to Options>Global Profiler Settings, you'll see "Set selected device to ID 1" checkbox.
Anyway, this discovery made me thinking about how does my app actually go through the gaming devices. It's possible I'm sending commands to wrong or non-existent device...
Quote from MadCatX :Perhaps not, if you open the Profiler and go to Options>Global Profiler Settings, you'll see "Set selected device to ID 1" checkbox.
Anyway, this discovery made me thinking about how does my app actually go through the gaming devices. It's possible I'm sending commands to wrong or non-existent device...

I would of thought having something like the g15 would cause the ID problem. As im guessing they could be using a similar API?
How is the experimenting going? Will we get shifterlights in G27 soon?
any progress?
Not really, I've ditched the idea of using the Logitech SDK as it's a pain in the ass to work with. I'll see if I can figure out how to do this using just plain DirectInput. I might get on it again during xmas...
I think that if manualy we change the ID from the *.cpp we should get it working

I have tried using a lot of ways. Using other source codes from other games like rFactor where the G27 leds work properly. Now i'm trying with your source (thanks for it) but for now it says me that i need some libraries wich i'm downloading now
Quote from KassadGLA :Using other source codes from other games like rFactor where the G27 leds work properly

You mean there is a source code available for the rFactor plugin? I was looking for it but couldn't find it anywhere. I'd definitely like to take a look at it...
I have found some very similar to this but on rFactor, but i don't found it on my computer SHITTTTTTT :doh:

I'm trying to compile your source code, i have DirectX SDK library instaled but it still don't compile cause the header "atlstr.h" is missing

EDIT: I have run ur program with the "2" argument and it debug preproperly, the only thing that i have found wong is that it point to ID 0, and my g27 is on ID 1 (is the only logitech gamming device conected...)
EDIT: 2 juhmm my mouse and my keyboard is logitech too.. it dosn't make conflict when:

for(int wheelIdx = 0; wheelIdx< LG_MAX_CONTROLLERS; wheelIdx++)

starts scanning all Logitech controlers? I'm getting mad with this aplication lol
You probably have the Express Edition of MSVS, that's why you're missing the ATL headers.
Yes, the program goes through all Logitech controllers that are connected and attempts to send the PlayLeds command to them.

If you can find the source of the rF addon or at least point me to a place you found it, it will be really helpful.
this is abit of a bump.. BUT... wouldn't it be possible to create and digital rev counter insim then using the values from the digital recounter set the leds to trigger depending on the revs?
That's exactly what we were trying to do, the problem was the actual sending these data to the wheel.
Unfortunately the only addon which possibly had to overcome the same obstacle isn't opensource...
is there like a final version on the horizon or is this still very buggy.. also will i be able to run aonio and this at the same time?
Quote from Tur8o :is there like a final version on the horizon or is this still very buggy.. also will i be able to run aonio and this at the same time?

With og_relay you can use as many outgauge applications as you want
I'm currently exploring the possibility of using a modified dinput8.dll I found in the rF Leds plugin, so there still is some hope, but I can't give any promises when or if I'm gonna release something. The og_relay will be necessary to use G27Leds along with other OutGauge apps.
I've just had an idea that might get things in motion again. Having ditched the Logitech API completely I put together this little test. It's sole purpose is to test if I can finally send correct data to the wheel. If anyone is willing to test it, could you please

A) run the app without LFS running
B) if it works, launch LFS and see what happens

If I'm correct, you should see the LEDs gradually lighting up and going out...

You'll need VS 2008 redistributable to be installed to run this app...

EDIT: Files removed, read on to get the latest version

G27 LEDs mod [renamed]
(330 posts, started )
FGED GREDG RDFGDR GSFDG