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

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

Issue 1373923003: HID report descriptors not available before OS X 10.8. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | 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 "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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698