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

Side by Side Diff: device/hid/hid_service_linux.cc

Issue 339503007: Descriptive log for HID device open failure on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « device/hid/hid_connection_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <linux/hidraw.h> 5 #include <linux/hidraw.h>
6 #include <sys/ioctl.h> 6 #include <sys/ioctl.h>
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 str_property = udev_device_get_property_value(device, kHIDUnique); 107 str_property = udev_device_get_property_value(device, kHIDUnique);
108 if (str_property != NULL) 108 if (str_property != NULL)
109 device_info.serial_number = str_property; 109 device_info.serial_number = str_property;
110 110
111 str_property = udev_device_get_property_value(device, kHIDName); 111 str_property = udev_device_get_property_value(device, kHIDName);
112 if (str_property != NULL) 112 if (str_property != NULL)
113 device_info.product_name = str_property; 113 device_info.product_name = str_property;
114 114
115 std::string dev_node; 115 std::string dev_node;
116 if (!FindHidrawDevNode(device, &dev_node)) { 116 if (!FindHidrawDevNode(device, &dev_node)) {
117 LOG(ERROR) << "Cannot open HID device as hidraw device."; 117 LOG(ERROR) << "Cannot find device node for HID device.";
118 return; 118 return;
119 } 119 }
120 120
121 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; 121 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
122 122
123 base::File device_file(base::FilePath(dev_node), flags); 123 base::File device_file(base::FilePath(dev_node), flags);
124 if (!device_file.IsValid()) { 124 if (!device_file.IsValid()) {
125 LOG(ERROR) << device_file.error_details(); 125 LOG(ERROR) << "Cannot open '" << dev_node << "': "
126 << base::File::ErrorToString(device_file.error_details());
126 return; 127 return;
127 } 128 }
128 129
129 int desc_size = 0; 130 int desc_size = 0;
130 int res = ioctl(device_file.GetPlatformFile(), HIDIOCGRDESCSIZE, &desc_size); 131 int res = ioctl(device_file.GetPlatformFile(), HIDIOCGRDESCSIZE, &desc_size);
131 if (res < 0) { 132 if (res < 0) {
132 LOG(ERROR) << "HIDIOCGRDESCSIZE failed."; 133 LOG(ERROR) << "HIDIOCGRDESCSIZE failed.";
133 device_file.Close(); 134 device_file.Close();
134 return; 135 return;
135 } 136 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 *result = raw_path; 193 *result = raw_path;
193 return true; 194 return true;
194 } 195 }
195 } 196 }
196 } 197 }
197 198
198 return false; 199 return false;
199 } 200 }
200 201
201 } // namespace device 202 } // namespace device
OLDNEW
« no previous file with comments | « device/hid/hid_connection_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698