VirtualBox

Changeset 49302 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Oct 28, 2013 7:56:55 AM (11 years ago)
Author:
vboxsync
Message:

OS X host: LEDs sync: update backlisting, also do not broadcast to devices which are not supported.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.cpp

    r49301 r49302  
    13981398}
    13991399
     1400/** Get integer property of HID device */
     1401static 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
    14001422/** Get HID Vendor ID */
    14011423static uint32_t darwinHidVendorId(IOHIDDeviceRef pHidDeviceRef)
    14021424{
    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 */
     1429static uint32_t darwinHidProductId(IOHIDDeviceRef pHidDeviceRef)
     1430{
     1431    return darwinQueryIntProperty(pHidDeviceRef, CFSTR(kIOHIDProductIDKey));
    14191432}
    14201433
     
    14281441    bool     fSupported = true;
    14291442    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 */
    14341448            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")));
    14391457
    14401458    return fSupported;
     
    20152033            pKbd = (VBoxKbdState_t *)CFArrayGetValueAtIndex(pHidState->pDeviceCollection, i);
    20162034
    2017             if (pKbd)
     2035            if (pKbd && darwinHidDeviceSupported(pKbd->pDevice))
    20182036            {
    20192037                rc = darwinSetDeviceLedsState(pKbd->pDevice,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette