Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2204)

Unified Diff: device/hid/hid_connection_win.cc

Issue 240263003: HID : read-only device access fallback when read/write fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove un-necessary flag Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/hid/hid_connection_linux.cc ('k') | device/hid/hid_service_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_connection_win.cc
diff --git a/device/hid/hid_connection_win.cc b/device/hid/hid_connection_win.cc
index 44bd8471bc1ca95d803e39e9212ab0a015e44cb8..a967ef5fbd6d2fe3a6cae23dd6dc0871c999981c 100644
--- a/device/hid/hid_connection_win.cc
+++ b/device/hid/hid_connection_win.cc
@@ -103,6 +103,7 @@ void PendingHidTransfer::WillDestroyCurrentMessageLoop() {
HidConnectionWin::HidConnectionWin(const HidDeviceInfo& device_info)
: HidConnection(device_info) {
DCHECK(thread_checker_.CalledOnValidThread());
Ken Rockot(use gerrit already) 2014/04/21 20:33:25 nit: Remove extra vertical whitespace.
jracle (use Gerrit) 2014/04/23 07:38:09 sure, sorry. Thought DCHECK(...) was the only line
+
file_.Set(CreateFileA(device_info.device_id.c_str(),
GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -110,6 +111,17 @@ HidConnectionWin::HidConnectionWin(const HidDeviceInfo& device_info)
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL));
+
+ if (!file_.IsValid() &&
+ file_.error_details() == base::File::FILE_ERROR_ACCESS_DENIED) {
+ file_.Set(CreateFileA(device_info.device_id.c_str(),
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_OVERLAPPED,
+ NULL));
+ }
}
bool HidConnectionWin::available() const {
« no previous file with comments | « device/hid/hid_connection_linux.cc ('k') | device/hid/hid_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698