summaryrefslogtreecommitdiffstats
path: root/device/hid/hid_connection_linux.cc
diff options
context:
space:
mode:
authorreillyg@chromium.org <reillyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-21 02:20:42 +0000
committerreillyg@chromium.org <reillyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-21 02:20:42 +0000
commit0d3277b8cf6d9a668c8cf9a69c40c152b71de66d (patch)
tree12687e29a118f9a5a00a29394360d075d22e9364 /device/hid/hid_connection_linux.cc
parent4372da55869735dea64134c87c3793050b38a623 (diff)
downloadchromium_src-0d3277b8cf6d9a668c8cf9a69c40c152b71de66d.zip
chromium_src-0d3277b8cf6d9a668c8cf9a69c40c152b71de66d.tar.gz
chromium_src-0d3277b8cf6d9a668c8cf9a69c40c152b71de66d.tar.bz2
Log errors in Linux HID from read, write and ioctl calls.
Log human readable descriptions of the errors generated by system calls executed on Linux against HID devices. BUG= Review URL: https://codereview.chromium.org/348733002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/hid/hid_connection_linux.cc')
-rw-r--r--device/hid/hid_connection_linux.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/device/hid/hid_connection_linux.cc b/device/hid/hid_connection_linux.cc
index 425d88f..331e3f3 100644
--- a/device/hid/hid_connection_linux.cc
+++ b/device/hid/hid_connection_linux.cc
@@ -72,7 +72,7 @@ HidConnectionLinux::HidConnectionLinux(HidDeviceInfo device_info,
if (fcntl(device_file.GetPlatformFile(), F_SETFL,
fcntl(device_file.GetPlatformFile(), F_GETFL) | O_NONBLOCK)) {
- PLOG(ERROR) << "Failed to set non-blocking flag to device file.";
+ PLOG(ERROR) << "Failed to set non-blocking flag to device file";
return;
}
device_file_ = device_file.Pass();
@@ -103,6 +103,7 @@ void HidConnectionLinux::OnFileCanReadWithoutBlocking(int fd) {
if (errno == EAGAIN) {
return;
}
+ VPLOG(1) << "Read failed";
Disconnect();
return;
}
@@ -147,6 +148,7 @@ void HidConnectionLinux::Write(uint8_t report_id,
int bytes_written = HANDLE_EINTR(
write(device_file_.GetPlatformFile(), buffer->data(), buffer->size()));
if (bytes_written < 0) {
+ VPLOG(1) << "Write failed";
Disconnect();
callback.Run(false, 0);
} else {
@@ -170,10 +172,12 @@ void HidConnectionLinux::GetFeatureReport(
int result = ioctl(device_file_.GetPlatformFile(),
HIDIOCGFEATURE(buffer->size()),
buffer->data());
- if (result < 0)
+ if (result < 0) {
+ VPLOG(1) << "Failed to get feature report";
callback.Run(false, 0);
- else
+ } else {
callback.Run(true, result);
+ }
}
void HidConnectionLinux::SendFeatureReport(
@@ -186,10 +190,12 @@ void HidConnectionLinux::SendFeatureReport(
int result = ioctl(device_file_.GetPlatformFile(),
HIDIOCSFEATURE(buffer->size()),
buffer->data());
- if (result < 0)
+ if (result < 0) {
+ VPLOG(1) << "Failed to send feature report";
callback.Run(false, 0);
- else
+ } else {
callback.Run(true, result);
+ }
}
void HidConnectionLinux::ProcessReadQueue() {