mirror of
https://github.com/RPCS3/hidapi.git
synced 2025-02-17 01:09:19 +00:00
cleanup previous commit
This commit is contained in:
parent
fd64a9f36b
commit
edf1183114
@ -211,46 +211,18 @@ 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;
|
||||
|
||||
|
||||
if (enumerate) {
|
||||
handle = CreateFileA(path,
|
||||
0, /* desired access */
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, /*share mode*/
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,//FILE_ATTRIBUTE_NORMAL,
|
||||
0);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* First, try to open with sharing mode turned off. This will make it so
|
||||
that a HID device can only be opened once. This is to be consistent
|
||||
with the behavior on the other platforms. */
|
||||
handle = CreateFileA(path,
|
||||
desired_access,
|
||||
FILE_SHARE_READ, /*share mode*/
|
||||
share_mode,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,//FILE_ATTRIBUTE_NORMAL,
|
||||
0);
|
||||
|
||||
#if 0
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
/* Couldn't open the device. Some devices must be opened
|
||||
with sharing enabled (even though they are only opened once),
|
||||
so try it here. */
|
||||
handle = CreateFileA(path,
|
||||
desired_access,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, /*share mode*/
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,//FILE_ATTRIBUTE_NORMAL,
|
||||
0);
|
||||
}
|
||||
#endif
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user