Changeset 48788 in vbox
- Timestamp:
- Oct 1, 2013 8:09:35 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.cpp
r48772 r48788 40 40 # include <IOKit/IOCFPlugIn.h> 41 41 # include <IOKit/hid/IOHIDUsageTables.h> 42 # include <IOKit/usb/USB.h>43 42 # include <CoreFoundation/CoreFoundation.h> 44 43 #endif 44 # include <IOKit/usb/USB.h> 45 45 #include <IOKit/hid/IOHIDLib.h> 46 46 #include <ApplicationServices/ApplicationServices.h> … … 1464 1464 } 1465 1465 1466 /** Some keyboard devices might freeze after LEDs manipulation. We filter out such devices here. 1467 * In the list below, devices which verified to be stable against LEDs manipulation. 1468 * If you want to add new device, add it here. Currently, we only filter devices by Vendor ID. 1469 * In future it might make sense to take Product ID into account as well. */ 1470 static bool darwinHidDeviceSupported(IOHIDDeviceRef pHidDeviceRef) 1471 { 1472 bool fSupported = false; 1473 CFTypeRef pNumberRef; 1474 uint32_t vendorId = 0; 1475 1476 pNumberRef = IOHIDDeviceGetProperty(pHidDeviceRef, CFSTR(kIOHIDVendorIDKey)); 1477 if (pNumberRef) 1478 { 1479 if (CFGetTypeID(pNumberRef) == CFNumberGetTypeID()) 1480 { 1481 if (CFNumberGetValue((CFNumberRef)pNumberRef, kCFNumberSInt32Type, &vendorId)) 1482 { 1483 switch (vendorId) 1484 { 1485 case kIOUSBVendorIDAppleComputer: /** Apple devices always in the list */ 1486 case 0x03F0: /** Hewlett-Packard (verified with model KU-0316) */ 1487 fSupported = true; 1488 break; 1489 } 1490 1491 Log2(("HID device Vendor ID 0x%X %s in the list of supported devices.\n", vendorId, (fSupported ? "is" : "is not"))); 1492 } 1493 } 1494 } 1495 1496 return fSupported; 1497 } 1498 1466 1499 #endif // !VBOX_WITH_KBD_LEDS_SYNC 1467 1500 … … 1508 1541 for (CFIndex i = 0; i < hidsState->cDevices; i++) 1509 1542 { 1510 if (IOHIDDeviceConformsTo(hidsState->hidDevicesCollection[i], kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard)) 1543 if (IOHIDDeviceConformsTo(hidsState->hidDevicesCollection[i], kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard) 1544 && darwinHidDeviceSupported(hidsState->hidDevicesCollection[i])) 1511 1545 { 1512 1546 rc = darwinGetDeviceLedsState(hidsState->hidDevicesCollection[i], … … 1604 1638 } 1605 1639 1606 IOHIDDeviceRegisterInputValueCallback(hidsState->hidDevicesCollection[i], NULL, NULL); 1607 IOHIDDeviceUnscheduleFromRunLoop(hidsState->hidDevicesCollection[i], CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 1640 /* Only supported devices have subscription to input callbacks. */ 1641 if (darwinHidDeviceSupported(hidsState->hidDevicesCollection[i])) 1642 { 1643 IOHIDDeviceRegisterInputValueCallback(hidsState->hidDevicesCollection[i], NULL, NULL); 1644 IOHIDDeviceUnscheduleFromRunLoop(hidsState->hidDevicesCollection[i], CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 1645 } 1608 1646 } 1609 1647 } … … 1677 1715 for (CFIndex i = 0; i < cDevices; i++) 1678 1716 { 1679 if (IOHIDDeviceConformsTo(hidDevicesCollection[i], kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard)) 1717 if (IOHIDDeviceConformsTo(hidDevicesCollection[i], kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard) 1718 && darwinHidDeviceSupported(hidDevicesCollection[i])) 1680 1719 { 1681 1720 rc = darwinSetDeviceLedsState(hidDevicesCollection[i], elementMatchingDict,
Note:
See TracChangeset
for help on using the changeset viewer.

