Changeset 49302 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 28, 2013 7:56:55 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.cpp
r49301 r49302 1398 1398 } 1399 1399 1400 /** Get integer property of HID device */ 1401 static uint32_t darwinQueryIntProperty(IOHIDDeviceRef pHidDeviceRef, CFStringRef pProperty) 1402 { 1403 CFTypeRef pNumberRef; 1404 uint32_t value = 0; 1405 1406 AssertReturn(pHidDeviceRef, 0); 1407 AssertReturn(pProperty, 0); 1408 1409 pNumberRef = IOHIDDeviceGetProperty(pHidDeviceRef, pProperty); 1410 if (pNumberRef) 1411 { 1412 if (CFGetTypeID(pNumberRef) == CFNumberGetTypeID()) 1413 { 1414 if (CFNumberGetValue((CFNumberRef)pNumberRef, kCFNumberSInt32Type, &value)) 1415 return value; 1416 } 1417 } 1418 1419 return 0; 1420 } 1421 1400 1422 /** Get HID Vendor ID */ 1401 1423 static uint32_t darwinHidVendorId(IOHIDDeviceRef pHidDeviceRef) 1402 1424 { 1403 CFTypeRef pNumberRef; 1404 uint32_t vendorId = 0; 1405 1406 AssertReturn(pHidDeviceRef, 0); 1407 1408 pNumberRef = IOHIDDeviceGetProperty(pHidDeviceRef, CFSTR(kIOHIDVendorIDKey)); 1409 if (pNumberRef) 1410 { 1411 if (CFGetTypeID(pNumberRef) == CFNumberGetTypeID()) 1412 { 1413 if (CFNumberGetValue((CFNumberRef)pNumberRef, kCFNumberSInt32Type, &vendorId)) 1414 return vendorId; 1415 } 1416 } 1417 1418 return 0; 1425 return darwinQueryIntProperty(pHidDeviceRef, CFSTR(kIOHIDVendorIDKey)); 1426 } 1427 1428 /** Get HID Produce ID */ 1429 static uint32_t darwinHidProductId(IOHIDDeviceRef pHidDeviceRef) 1430 { 1431 return darwinQueryIntProperty(pHidDeviceRef, CFSTR(kIOHIDProductIDKey)); 1419 1432 } 1420 1433 … … 1428 1441 bool fSupported = true; 1429 1442 uint32_t vendorId = darwinHidVendorId(pHidDeviceRef); 1430 1431 switch (vendorId) 1432 { 1433 case 0x05D5: /** Genius (detected with GK-04008/C keyboard) */ 1443 uint32_t productId = darwinHidProductId(pHidDeviceRef); 1444 1445 if (vendorId == 0x05D5) /* Genius */ 1446 { 1447 if (productId == 0x8001) /* GK-04008/C keyboard */ 1434 1448 fSupported = false; 1435 break; 1436 } 1437 1438 LogRel(("HID device Vendor ID 0x%X %s in the list of supported devices.\n", vendorId, (fSupported ? "is" : "is not"))); 1449 } 1450 else if (vendorId == 0x05AC) /* Apple */ 1451 { 1452 if (productId == 0x0263) /* Apple Internal Keyboard */ 1453 fSupported = false; 1454 } 1455 1456 LogRel(("HID device [VendorID=0x%X, ProductId=0x%X] %s in the list of supported devices.\n", vendorId, productId, (fSupported ? "is" : "is not"))); 1439 1457 1440 1458 return fSupported; … … 2015 2033 pKbd = (VBoxKbdState_t *)CFArrayGetValueAtIndex(pHidState->pDeviceCollection, i); 2016 2034 2017 if (pKbd )2035 if (pKbd && darwinHidDeviceSupported(pKbd->pDevice)) 2018 2036 { 2019 2037 rc = darwinSetDeviceLedsState(pKbd->pDevice,
Note:
See TracChangeset
for help on using the changeset viewer.