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

Unified Diff: device/hid/hid_service_mac.cc

Issue 225513005: chrome.hid : enrich device info with Top-Level collections usages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: HidUsageAndPage construction Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/hid/hid_service_linux.cc ('k') | device/hid/hid_service_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_service_mac.cc
diff --git a/device/hid/hid_service_mac.cc b/device/hid/hid_service_mac.cc
index 3df7e592333e6b8ec9620d8f924456b951202572..39e1765e9c181499ac7b01d9b60a78b5fbec416e 100644
--- a/device/hid/hid_service_mac.cc
+++ b/device/hid/hid_service_mac.cc
@@ -143,16 +143,30 @@ void HidServiceMac::PlatformAddDevice(IOHIDDeviceRef hid_device) {
GetHidIntProperty(hid_device, CFSTR(kIOHIDVendorIDKey));
device_info.product_id =
GetHidIntProperty(hid_device, CFSTR(kIOHIDProductIDKey));
- device_info.usage =
- GetHidIntProperty(hid_device, CFSTR(kIOHIDPrimaryUsageKey));
- device_info.usage_page =
- GetHidIntProperty(hid_device, CFSTR(kIOHIDPrimaryUsagePageKey));
device_info.input_report_size =
GetHidIntProperty(hid_device, CFSTR(kIOHIDMaxInputReportSizeKey));
device_info.output_report_size =
GetHidIntProperty(hid_device, CFSTR(kIOHIDMaxOutputReportSizeKey));
device_info.feature_report_size =
GetHidIntProperty(hid_device, CFSTR(kIOHIDMaxFeatureReportSizeKey));
+ CFTypeRef deviceUsagePairsRaw =
+ IOHIDDeviceGetProperty(hid_device, CFSTR(kIOHIDDeviceUsagePairsKey));
+ CFArrayRef deviceUsagePairs =
+ base::mac::CFCast<CFArrayRef>(deviceUsagePairsRaw);
+ CFIndex deviceUsagePairsCount = CFArrayGetCount(deviceUsagePairs);
+ for (CFIndex i = 0; i < deviceUsagePairsCount; i++) {
+ CFDictionaryRef deviceUsagePair = base::mac::CFCast<CFDictionaryRef>(
+ CFArrayGetValueAtIndex(deviceUsagePairs, i));
+ CFNumberRef usage_raw = base::mac::CFCast<CFNumberRef>(
+ CFDictionaryGetValue(deviceUsagePair, CFSTR(kIOHIDDeviceUsageKey)));
+ uint16_t usage;
+ CFNumberGetValue(usage_raw, kCFNumberSInt32Type, &usage);
+ CFNumberRef page_raw = base::mac::CFCast<CFNumberRef>(
+ CFDictionaryGetValue(deviceUsagePair, CFSTR(kIOHIDDeviceUsagePageKey)));
+ UsagePage page;
Ken Rockot(use gerrit already) 2014/04/24 19:26:18 Gah. Sorry. I should have been more careful about
jracle (use Gerrit) 2014/04/24 19:47:01 Gasp, wish I could rebuild. Let's retry, if we rea
+ CFNumberGetValue(page_raw, kCFNumberSInt32Type, &page);
+ device_info.usages.push_back(HidUsageAndPage(usage, page));
+ }
device_info.product_name =
GetHidStringProperty(hid_device, CFSTR(kIOHIDProductKey));
device_info.serial_number =
« no previous file with comments | « device/hid/hid_service_linux.cc ('k') | device/hid/hid_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698