Add classes encapsulatinglegacy USB API
Added implementation for endpoints and overlapped I/O support for legacy API support.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,61 @@
|
||||
#include "adb_helper_routines.h"
|
||||
#include "adb_interface_enum.h"
|
||||
|
||||
bool GetSDKComplientParam(AdbOpenAccessType access_type,
|
||||
AdbOpenSharingMode sharing_mode,
|
||||
ULONG* desired_access,
|
||||
ULONG* desired_sharing) {
|
||||
if (NULL != desired_access) {
|
||||
switch (access_type) {
|
||||
case AdbOpenAccessTypeReadWrite:
|
||||
*desired_access = GENERIC_READ | GENERIC_WRITE;
|
||||
break;
|
||||
|
||||
case AdbOpenAccessTypeRead:
|
||||
*desired_access = GENERIC_READ;
|
||||
break;
|
||||
|
||||
case AdbOpenAccessTypeWrite:
|
||||
*desired_access = GENERIC_WRITE;
|
||||
break;
|
||||
|
||||
case AdbOpenAccessTypeQueryInfo:
|
||||
*desired_access = FILE_READ_ATTRIBUTES | FILE_READ_EA;
|
||||
break;
|
||||
|
||||
default:
|
||||
SetLastError(ERROR_INVALID_ACCESS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != desired_sharing) {
|
||||
switch (sharing_mode) {
|
||||
case AdbOpenSharingModeReadWrite:
|
||||
*desired_sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||
break;
|
||||
|
||||
case AdbOpenSharingModeRead:
|
||||
*desired_sharing = FILE_SHARE_READ;
|
||||
break;
|
||||
|
||||
case AdbOpenSharingModeWrite:
|
||||
*desired_sharing = FILE_SHARE_WRITE;
|
||||
break;
|
||||
|
||||
case AdbOpenSharingModeExclusive:
|
||||
*desired_sharing = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EnumerateDeviceInterfaces(HDEVINFO hardware_dev_info,
|
||||
GUID class_id,
|
||||
bool exclude_removed,
|
||||
|
||||
Reference in New Issue
Block a user