1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

Stop rawhid (Windows) from logging a debug message because it can't open

all my input devices for writing. And also swap logging statements, so
that we do qDebug after GetLastError, since qDebug seems to wipe the
last error code.


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1497 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
cranphin 2010-09-01 18:49:18 +00:00 committed by cranphin
parent 86820456b3
commit 65c832da35

View File

@ -133,14 +133,23 @@ int pjrc_rawhid::open(int max, int vid, int pid, int usage_page, int usage)
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
if( GetLastError() != ERROR_SUCCESS )
if( h == INVALID_HANDLE_VALUE )
{
qDebug("Problem openning handle");
print_win32_err();
// I get ERROR_ACCESS_DENIED with most/all my input devices (mice/trackballs/tablet).
// Let's not log it :)
if(GetLastError() == ERROR_ACCESS_DENIED) {
free(details);
continue;
}
// qDebug wipes the GetLastError() it seems, so do that after print_win32_err().
print_win32_err();
qDebug() << "Problem opening handle, path: " << QString().fromWCharArray(details->DevicePath);
free(details);
continue;
}
free(details);
if (h == INVALID_HANDLE_VALUE) continue;
attrib.Size = sizeof(HIDD_ATTRIBUTES);
ret = HidD_GetAttributes(h, &attrib);
//printf("vid: %4x\n", attrib.VendorID);