diff options
author | reillyg <reillyg@chromium.org> | 2015-02-23 17:28:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-24 01:29:27 +0000 |
commit | b9da284b42d4a3b9498d64f1c61452c5f5ae4ff2 (patch) | |
tree | 02220b4e22f2bbc7e5ee1db5797719f03133f72f /device/hid/hid_service_linux.cc | |
parent | 202524aacb06c948a3f4a34f4418f32b550c79b5 (diff) | |
download | chromium_src-b9da284b42d4a3b9498d64f1c61452c5f5ae4ff2.zip chromium_src-b9da284b42d4a3b9498d64f1c61452c5f5ae4ff2.tar.gz chromium_src-b9da284b42d4a3b9498d64f1c61452c5f5ae4ff2.tar.bz2 |
Log device/hid messages to chrome://device-log.
Log events and debugging information related to HID devices through the
device event log component so that these errors are visible at
chrome://device-log. A DEVICE_PLOG macro has been added which includes
the last reported system error in the log message.
BUG=448901
Review URL: https://codereview.chromium.org/947663002
Cr-Commit-Position: refs/heads/master@{#317722}
Diffstat (limited to 'device/hid/hid_service_linux.cc')
-rw-r--r-- | device/hid/hid_service_linux.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/device/hid/hid_service_linux.cc b/device/hid/hid_service_linux.cc index 6174d41..500f7b8 100644 --- a/device/hid/hid_service_linux.cc +++ b/device/hid/hid_service_linux.cc @@ -13,12 +13,12 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/location.h" -#include "base/logging.h" #include "base/scoped_observer.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/thread_task_runner_handle.h" #include "base/threading/thread_restrictions.h" +#include "components/device_event_log/device_event_log.h" #include "device/hid/device_monitor_linux.h" #include "device/hid/hid_connection_linux.h" #include "device/hid/hid_device_info_linux.h" @@ -282,29 +282,30 @@ void HidServiceLinux::OpenDevice(scoped_ptr<ConnectParams> params) { base::File::Error file_error = device_file.error_details(); if (file_error == base::File::FILE_ERROR_ACCESS_DENIED) { - VLOG(1) << "Access denied opening device read-write, trying read-only."; + HID_LOG(EVENT) + << "Access denied opening device read-write, trying read-only."; flags = base::File::FLAG_OPEN | base::File::FLAG_READ; device_file.Initialize(device_path, flags); } } if (!device_file.IsValid()) { - LOG(ERROR) << "Failed to open '" << params->device_info->device_node() - << "': " - << base::File::ErrorToString(device_file.error_details()); + HID_LOG(EVENT) << "Failed to open '" << params->device_info->device_node() + << "': " + << base::File::ErrorToString(device_file.error_details()); task_runner->PostTask(FROM_HERE, base::Bind(params->callback, nullptr)); return; } int result = fcntl(device_file.GetPlatformFile(), F_GETFL); if (result == -1) { - PLOG(ERROR) << "Failed to get flags from the device file descriptor"; + HID_PLOG(ERROR) << "Failed to get flags from the device file descriptor"; task_runner->PostTask(FROM_HERE, base::Bind(params->callback, nullptr)); return; } result = fcntl(device_file.GetPlatformFile(), F_SETFL, result | O_NONBLOCK); if (result == -1) { - PLOG(ERROR) << "Failed to set the non-blocking flag on the device fd"; + HID_PLOG(ERROR) << "Failed to set the non-blocking flag on the device fd"; task_runner->PostTask(FROM_HERE, base::Bind(params->callback, nullptr)); return; } |