OLD | NEW |
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 "device/hid/hid_service_mac.h" | 5 #include "device/hid/hid_service_mac.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 #include <IOKit/hid/IOHIDDevice.h> | 8 #include <IOKit/hid/IOHIDDevice.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 base::ScopedCFTypeRef<IOHIDDeviceRef> hid_device( | 247 base::ScopedCFTypeRef<IOHIDDeviceRef> hid_device( |
248 IOHIDDeviceCreate(kCFAllocatorDefault, service)); | 248 IOHIDDeviceCreate(kCFAllocatorDefault, service)); |
249 if (!hid_device) { | 249 if (!hid_device) { |
250 HID_LOG(EVENT) << "Unable to create IOHIDDevice object for new device."; | 250 HID_LOG(EVENT) << "Unable to create IOHIDDevice object for new device."; |
251 return nullptr; | 251 return nullptr; |
252 } | 252 } |
253 | 253 |
254 std::vector<uint8> report_descriptor; | 254 std::vector<uint8> report_descriptor; |
255 if (!TryGetHidDataProperty(hid_device, CFSTR(kIOHIDReportDescriptorKey), | 255 if (!TryGetHidDataProperty(hid_device, CFSTR(kIOHIDReportDescriptorKey), |
256 &report_descriptor)) { | 256 &report_descriptor)) { |
257 HID_LOG(EVENT) << "Unable to get report descriptor for new device."; | 257 HID_LOG(DEBUG) << "Device report descriptor not available."; |
258 return nullptr; | |
259 } | 258 } |
260 | 259 |
261 return new HidDeviceInfo( | 260 return new HidDeviceInfo( |
262 entry_id, GetHidIntProperty(hid_device, CFSTR(kIOHIDVendorIDKey)), | 261 entry_id, GetHidIntProperty(hid_device, CFSTR(kIOHIDVendorIDKey)), |
263 GetHidIntProperty(hid_device, CFSTR(kIOHIDProductIDKey)), | 262 GetHidIntProperty(hid_device, CFSTR(kIOHIDProductIDKey)), |
264 GetHidStringProperty(hid_device, CFSTR(kIOHIDProductKey)), | 263 GetHidStringProperty(hid_device, CFSTR(kIOHIDProductKey)), |
265 GetHidStringProperty(hid_device, CFSTR(kIOHIDSerialNumberKey)), | 264 GetHidStringProperty(hid_device, CFSTR(kIOHIDSerialNumberKey)), |
266 kHIDBusTypeUSB, // TODO(reillyg): Detect Bluetooth. crbug.com/443335 | 265 kHIDBusTypeUSB, // TODO(reillyg): Detect Bluetooth. crbug.com/443335 |
267 report_descriptor); | 266 report_descriptor); |
268 } | 267 } |
269 | 268 |
270 } // namespace device | 269 } // namespace device |
OLD | NEW |