VirtualBox

儲存庫 vbox 的更動 49779


忽略:
時間撮記:
2013-12-4 下午05:20:25 (11 年 以前)
作者:
vboxsync
訊息:

Mac OS X host: HID LEDs sync: resume built-in kbd before set its LEDs (extended VBoxUSB.kext and USBLib); introduce GUI/HidLedsSync extradata option in order to enable LEDs sync (not set/disabled by default); all Apple kbd devices removed from blacklist; SCROLL LED sync enabled again.

位置:
trunk
檔案:
修改 10 筆資料

圖例:

未更動
新增
刪除
  • trunk/include/VBox/usblib-darwin.h

    r44529 r49779  
    55
    66/*
    7  * Copyright (C) 2007-2010 Oracle Corporation
     7 * Copyright (C) 2007-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5050/** @} */
    5151
     52USBLIB_DECL(void) USBLibResumeBuiltInKeyboard(void);
     53
    5254/** @} */
    5355RT_C_DECLS_END
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r49596 r49779  
    183183# Necessary for the hdd backend enumeration
    184184VirtualBox_LIBS = $(LIB_DDU)
     185
     186# Necessary for the HID LEDs sync
     187VirtualBox_LIBS.darwin += $(PATH_OUT)/lib/USBLib.a
    185188
    186189if1of ($(KBUILD_TARGET), linux freebsd netbsd openbsd)
     
    10981101tstDarwinKeyboard_LIBS = \
    10991102        $(LIB_RUNTIME)
     1103tstDarwinKeyboard_LIBS.darwin += $(PATH_OUT)/lib/USBLib.a
     1104
    11001105endif
    11011106
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp

    r49698 r49779  
    7979const char* UIDefs::GUI_DefaultCloseAction = "GUI/DefaultCloseAction";
    8080const char* UIDefs::GUI_RestrictedStatusBarIndicators = "GUI/RestrictedStatusBarIndicators";
     81const char* UIDefs::GUI_HidLedsSync = "GUI/HidLedsSync";
    8182
    8283/* Settings dialogs stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r49698 r49779  
    148148    extern const char* GUI_DefaultCloseAction;
    149149    extern const char* GUI_RestrictedStatusBarIndicators;
     150    extern const char* GUI_HidLedsSync;
    150151
    151152    /* Settings dialogs stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.cpp

    r49601 r49779  
    2424
    2525#define VBOX_WITH_KBD_LEDS_SYNC
    26 //#define VBOX_WITH_KBD_SCROLL_LED_SYNC
    2726//#define VBOX_WITHOUT_KBD_LEDS_SYNC_FILTERING
    2827
     
    4039# include <iprt/err.h>
    4140# include <iprt/semaphore.h>
     41# include <VBox/usblib.h>
    4242#endif
    4343
     
    12701270    IOReturn      rc = kIOReturnError;
    12711271
     1272    USBLibResumeBuiltInKeyboard();
     1273
    12721274    valueRef = IOHIDValueCreateWithIntegerValue(kCFAllocatorDefault, element, 0, (fEnabled) ? 1 : 0);
    12731275    if (valueRef)
     
    12911293    IOReturn      rc;
    12921294    CFIndex       integerValue;
     1295
     1296    USBLibResumeBuiltInKeyboard();
    12931297
    12941298    rc = IOHIDDeviceGetValue(hidDevice, element, &valueRef);
     
    13421346                    rc = darwinLedElementSetValue(hidDevice, element, fCapsLockOn);
    13431347                    break;
    1344 #ifdef VBOX_WITH_KBD_SCROLL_LED_SYNC
    13451348                case kHIDUsage_LED_ScrollLock:
    13461349                    rc = darwinLedElementSetValue(hidDevice, element, fScrollLockOn);
    13471350                    break;
    1348 #endif
    13491351            }
    13501352            if (rc != 0)
     
    13891391                    rc = darwinLedElementGetValue(hidDevice, element, fCapsLockOn);
    13901392                    break;
    1391 #ifdef VBOX_WITH_KBD_SCROLL_LED_SYNC
    13921393                case kHIDUsage_LED_ScrollLock:
    13931394                    rc = darwinLedElementGetValue(hidDevice, element, fScrollLockOn);
    13941395                    break;
    1395 #endif
    13961396            }
    13971397            if (rc != 0)
     
    14561456    {
    14571457        if (productId == 0x8001) /* GK-04008/C keyboard */
    1458             fSupported = false;
    1459     }
    1460     else if (vendorId == 0x05AC) /* Apple */
    1461     {
    1462         if (productId == 0x0263) /* Apple Internal Keyboard */
    14631458            fSupported = false;
    14641459    }
     
    19201915    VBoxHidsState_t *pHidState;
    19211916
     1917    USBLibInit();
     1918
    19221919    pHidState = (VBoxHidsState_t *)malloc(sizeof(VBoxHidsState_t));
    19231920    AssertReturn(pHidState, NULL);
     
    20612058    free(pHidState);
    20622059
     2060    USBLibTerm();
     2061
    20632062    return rc2;
    20642063#else /* !VBOX_WITH_KBD_LEDS_SYNC */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r49596 r49779  
    511511    /* Here we have to update host LED lock states using values provided by UISession:
    512512     * [bool] uisession() -> isNumLock(), isCapsLock(), isScrollLock() can be used for that. */
    513     LogRelFlow(("UIMachineLogic::sltKeyboardLedsChanged: Updating host LED lock states (NOT IMPLEMENTED).\n"));
     513
     514    if (!isHidLedsSyncEnabled())
     515        return;
     516
    514517#ifdef Q_WS_MAC
     518    LogRelFlow(("UIMachineLogic::sltKeyboardLedsChanged: Updating host LED lock states.\n"));
    515519    DarwinHidDevicesBroadcastLeds(m_pHostLedsState, uisession()->isNumLock(), uisession()->isCapsLock(), uisession()->isScrollLock());
    516520#endif
     
    672676            pAction->setText(gpConverter->toString(pAction->data().value<KDragAndDropMode>()));
    673677    }
     678}
     679
     680bool UIMachineLogic::isHidLedsSyncEnabled()
     681{
     682    QString strHidLedsSyncSettings = session().GetMachine().GetExtraData(GUI_HidLedsSync);
     683    if (strHidLedsSyncSettings == "1")
     684        return true;
     685    return false;
    674686}
    675687
     
    23042316     * [bool] uisession() -> isNumLock(), isCapsLock(), isScrollLock() can be used for that. */
    23052317
    2306     LogRelFlow(("UIMachineLogic::sltSwitchKeyboardLedsToGuestLeds: keep host LED lock states and broadcast guest's ones (NOT IMPLEMENTED).\n"));
     2318    if (!isHidLedsSyncEnabled())
     2319        return;
     2320
    23072321#ifdef Q_WS_MAC
     2322    LogRelFlow(("UIMachineLogic::sltSwitchKeyboardLedsToGuestLeds: keep host LED lock states and broadcast guest's ones.\n"));
    23082323    if (m_pHostLedsState == NULL)
    23092324        m_pHostLedsState = DarwinHidDevicesKeepLedsState();
     
    23202335//           session().GetMachine().GetName().toAscii().constData());
    23212336
    2322     LogRelFlow(("UIMachineLogic::sltSwitchKeyboardLedsToPreviousLeds: restore host LED lock states (NOT IMPLEMENTED).\n"));
     2337    if (!isHidLedsSyncEnabled())
     2338        return;
    23232339
    23242340    /* Here we have to restore host LED lock states. */
    23252341#ifdef Q_WS_MAC
     2342    LogRelFlow(("UIMachineLogic::sltSwitchKeyboardLedsToPreviousLeds: restore host LED lock states.\n"));
     2343
    23262344    if (m_pHostLedsState)
    23272345    {
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r49506 r49779  
    133133    void addMachineWindow(UIMachineWindow *pMachineWindow);
    134134    void retranslateUi();
     135    bool isHidLedsSyncEnabled();
    135136#ifdef Q_WS_MAC
    136137    bool isDockIconPreviewEnabled() const { return m_fIsDockIconEnabled; }
  • trunk/src/VBox/HostDrivers/VBoxUSB/darwin/USBLib-darwin.cpp

    r44529 r49779  
    55
    66/*
    7  * Copyright (C) 2007-2010 Oracle Corporation
     7 * Copyright (C) 2007-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    190190}
    191191
     192USBLIB_DECL(void) USBLibResumeBuiltInKeyboard(void)
     193{
     194#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
     195    kern_return_t kr = IOConnectMethodStructureIStructureO(g_Connection,
     196                                                           VBOXUSBMETHOD_RESUME_BUILTIN_KBD,
     197                                                           0,
     198                                                           NULL,
     199                                                           NULL,
     200                                                           NULL);
     201#else  /* 10.5 and later */
     202    kern_return_t kr = IOConnectCallStructMethod(g_Connection,
     203                                                 VBOXUSBMETHOD_RESUME_BUILTIN_KBD,
     204                                                 NULL, 0,
     205                                                 NULL, NULL);
     206#endif /* 10.5 and later */
     207    AssertMsg(kr == kIOReturnSuccess, ("kr=%#x\n", kr));
     208    NOREF(kr);
     209}
  • trunk/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp

    r44528 r49779  
    99
    1010/*
    11  * Copyright (C) 2006-2010 Oracle Corporation
     11 * Copyright (C) 2006-2013 Oracle Corporation
    1212 *
    1313 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6060#include <IOKit/usb/IOUSBInterface.h>
    6161#include <IOKit/usb/IOUSBUserClient.h>
     62#include <IOKit/usb/IOUSBHIDDriver.h>
    6263
    6364/* private: */
     
    140141    IOReturn addFilter(PUSBFILTER pFilter, PVBOXUSBADDFILTEROUT pOut, IOByteCount cbFilter, IOByteCount *pcbOut);
    141142    IOReturn removeFilter(uintptr_t *puId, int *prc, IOByteCount cbIn, IOByteCount *pcbOut);
     143    IOReturn resumeBuiltInKbd(void *unused1, void *unused2, IOByteCount unused3, IOByteCount *unused4, void *unused5, void *unused6);
    142144    /** @} */
    143145
     
    788790            sizeof(int)                                             /* count1 - size of the output (rc) */
    789791        },
     792        /* [VBOXUSBMETHOD_RESUME_BUILTIN_KBD] = */
     793        {
     794            (IOService *)0,                                         /* object */
     795            (IOMethod)&org_virtualbox_VBoxUSBClient::resumeBuiltInKbd, /* func */
     796            kIOUCScalarIScalarO,                                    /* flags - scalar input (count0) and scalar output (count1) */
     797            0,                                                      /* count0 - # of input parameters */
     798            0                                                       /* count1 - # of output parameters */
     799        },
    790800    };
    791801
     
    893903}
    894904
     905IOReturn
     906org_virtualbox_VBoxUSBClient::resumeBuiltInKbd(void *unused1, void *unused2, IOByteCount unused3, IOByteCount *unused4, void *unused5, void *unused6)
     907{
     908    (void)unused1;
     909    (void)unused2;
     910    (void)unused3;
     911    (void)unused4;
     912    (void)unused5;
     913    (void)unused6;
     914
     915    OSDictionary *pDictionary;
     916
     917    VBOXUSB_LOCK();
     918
     919    pDictionary = IOService::serviceMatching("AppleUSBTCKeyboard");
     920    if (pDictionary)
     921    {
     922        OSIterator     *pIter;
     923        IOUSBHIDDriver *pDriver;
     924
     925        pIter = IOService::getMatchingServices(pDictionary);
     926        if (pIter)
     927        {
     928            while ((pDriver = (IOUSBHIDDriver *)pIter->getNextObject()))
     929                pDriver->SuspendPort(false, 0);
     930
     931            pIter->release();
     932        }
     933
     934        pDictionary->release();
     935    }
     936
     937    VBOXUSB_UNLOCK();
     938
     939    return kIOReturnSuccess;
     940}
    895941
    896942/**
  • trunk/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSBInterface.h

    r44529 r49779  
    55
    66/*
    7  * Copyright (C) 2007-2010 Oracle Corporation
     7 * Copyright (C) 2007-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3030    /** org_virtualbox_VBoxUSBClient::removeFilter */
    3131    VBOXUSBMETHOD_REMOVE_FILTER,
     32    /** org_virtualbox_VBoxUSBClient::resumeBuiltInKbd */
     33    VBOXUSBMETHOD_RESUME_BUILTIN_KBD,
    3234    /** End/max. */
    3335    VBOXUSBMETHOD_END
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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