1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Fix windows hid connection failure if board was already connected and gcs started. Was getting sharing violation error.

This commit is contained in:
sambas 2013-06-23 14:18:31 +03:00 committed by Alessio Morale
parent 9fce86b662
commit 023ee2b97e

View File

@ -219,9 +219,7 @@ static HANDLE open_device(const char *path, BOOL enumerate)
{
HANDLE handle;
DWORD desired_access = (enumerate)? 0: (GENERIC_WRITE | GENERIC_READ);
DWORD share_mode = (enumerate)?
FILE_SHARE_READ|FILE_SHARE_WRITE:
FILE_SHARE_READ;
DWORD share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE;
handle = CreateFileA(path,
desired_access,
@ -230,7 +228,7 @@ static HANDLE open_device(const char *path, BOOL enumerate)
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,/*FILE_ATTRIBUTE_NORMAL,*/
0);
DWORD error = GetLastError();
return handle;
}