VirtualBox

Changeset 49965 in vbox for trunk/src


Ignore:
Timestamp:
Dec 17, 2013 8:20:45 PM (11 years ago)
Author:
vboxsync
Message:

Mac OS X host: HID LEDs sync: take care about bluetooth keyboard: wake it up before setting LED in order to decrease LED-set-operation delay up to ~1-0.5 seconds.

Location:
trunk/src/VBox
Files:
6 edited

Legend:

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

    r49957 r49965  
    12811281    IOReturn      rc = kIOReturnError;
    12821282
    1283     /* Try to resume built-in keyboard. Abort if failed in order to avoid GUI freezes. */
    1284     int rc1 = SUPR3ResumeBuiltinKeyboard();
     1283    /* Try to resume suspended keyboard devices. Abort if failed in order to avoid GUI freezes. */
     1284    int rc1 = SUPR3ResumeSuspendedKeyboards();
    12851285    if (RT_FAILURE(rc1))
    12861286        return rc1;
     
    13081308    CFIndex       integerValue;
    13091309
    1310     /* Try to resume built-in keyboard. Abort if failed in order to avoid GUI freezes. */
    1311     int rc1 = SUPR3ResumeBuiltinKeyboard();
     1310    /* Try to resume suspended keyboard devices. Abort if failed in order to avoid GUI freezes. */
     1311    int rc1 = SUPR3ResumeSuspendedKeyboards();
    13121312    if (RT_FAILURE(rc1))
    13131313        return rc1;
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r49787 r49965  
    139139                                                  RTCPUID idCpu, uint8_t idApic, uint64_t iTick);
    140140static void                 supdrvGipInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pCpu, uint64_t u64NanoTS);
    141 static int                  supdrvIOCtl_ResumeBuiltinKbd(void);
     141static int                  supdrvIOCtl_ResumeSuspendedKbds(void);
    142142
    143143
     
    19051905        }
    19061906
    1907         case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_RESUME_BUILTIN_KBD):
     1907        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_RESUME_SUSPENDED_KBDS):
    19081908        {
    19091909            /* validate */
    1910             REQ_CHECK_SIZES(SUP_IOCTL_RESUME_BUILTIN_KBD);
    1911 
    1912             pReqHdr->rc = supdrvIOCtl_ResumeBuiltinKbd();
     1910            REQ_CHECK_SIZES(SUP_IOCTL_RESUME_SUSPENDED_KBDS);
     1911
     1912            pReqHdr->rc = supdrvIOCtl_ResumeSuspendedKbds();
    19131913            return 0;
    19141914        }
     
    61556155 * @returns 0 on Mac OS X platform, VERR_NOT_IMPLEMENTED on the other ones.
    61566156 */
    6157 static int supdrvIOCtl_ResumeBuiltinKbd(void)
     6157static int supdrvIOCtl_ResumeSuspendedKbds(void)
    61586158{
    61596159#if defined(RT_OS_DARWIN)
    6160     return supdrvDarwinResumeBuiltinKbd();
     6160    return supdrvDarwinResumeSuspendedKbds();
    61616161#else
    61626162    return VERR_NOT_IMPLEMENTED;
  • trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h

    r49787 r49965  
    14381438/** @} */
    14391439
    1440 /** @name SUP_IOCTL_RESUME_BUILTIN_KBD
    1441  * Resume built-in keyboard (make sense on MacBook Air/Pro hosts only).
    1442  *
    1443  * @{
    1444  */
    1445 #define SUP_IOCTL_RESUME_BUILTIN_KBD                    SUP_CTL_CODE_SIZE(35, SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE)
    1446 #define SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE               sizeof(SUPREQHDR)
    1447 #define SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE_IN            sizeof(SUPREQHDR)
    1448 #define SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE_OUT           sizeof(SUPREQHDR)
     1440/** @name SUP_IOCTL_RESUME_SUSPENDED_KBDS
     1441 * Resume suspended keyboard devices if any found in the system.
     1442 *
     1443 * @{
     1444 */
     1445#define SUP_IOCTL_RESUME_SUSPENDED_KBDS                 SUP_CTL_CODE_SIZE(35, SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE)
     1446#define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE            sizeof(SUPREQHDR)
     1447#define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_IN         sizeof(SUPREQHDR)
     1448#define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_OUT        sizeof(SUPREQHDR)
    14491449/** @} */
    14501450
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r49787 r49965  
    750750
    751751#if defined(RT_OS_DARWIN)
    752 int VBOXCALL    supdrvDarwinResumeBuiltinKbd(void);
     752int VBOXCALL    supdrvDarwinResumeSuspendedKbds(void);
    753753#endif
    754754
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r49787 r49965  
    21342134
    21352135
    2136 SUPR3DECL(int) SUPR3ResumeBuiltinKeyboard(void)
     2136SUPR3DECL(int) SUPR3ResumeSuspendedKeyboards(void)
    21372137{
    21382138#ifdef RT_OS_DARWIN
     
    21432143    Req.u32Cookie       = g_u32Cookie;
    21442144    Req.u32SessionCookie= g_u32SessionCookie;
    2145     Req.cbIn            = SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE_IN;
    2146     Req.cbOut           = SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE_OUT;
     2145    Req.cbIn            = SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_IN;
     2146    Req.cbOut           = SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_OUT;
    21472147    Req.fFlags          = SUPREQHDR_FLAGS_DEFAULT;
    21482148    Req.rc              = VERR_INTERNAL_ERROR;
    2149     int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_RESUME_BUILTIN_KBD, &Req, SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE);
     2149    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_RESUME_SUSPENDED_KBDS, &Req, SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE);
    21502150    if (RT_SUCCESS(rc))
    21512151        rc = Req.rc;
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r49955 r49965  
    6868#include <IOKit/IODeviceTreeSupport.h>
    6969#include <IOKit/usb/IOUSBHIDDriver.h>
     70#include <IOKit/bluetooth/IOBluetoothHIDDriver.h>
     71#include <IOKit/bluetooth/IOBluetoothHIDDriverTypes.h>
    7072
    7173#ifdef VBOX_WITH_HOST_VMX
     
    11471149#endif /* SUPDRV_WITH_MSR_PROBER */
    11481150
     1151/**
     1152 * Resume Bluetooth keyboard.
     1153 * If there is no Bluetooth keyboard device connected to the system we just ignore this.
     1154 */
     1155static void supdrvDarwinResumeBluetoothKbd(void)
     1156{
     1157    OSDictionary *pDictionary = IOService::serviceMatching("AppleBluetoothHIDKeyboard");
     1158    if (pDictionary)
     1159    {
     1160        OSIterator     *pIter;
     1161        IOBluetoothHIDDriver *pDriver;
     1162
     1163        pIter = IOService::getMatchingServices(pDictionary);
     1164        if (pIter)
     1165        {
     1166            while ((pDriver = (IOBluetoothHIDDriver *)pIter->getNextObject()))
     1167                if (pDriver->isKeyboard())
     1168                    (void)pDriver->hidControl(IOBTHID_CONTROL_EXIT_SUSPEND);
     1169
     1170            pIter->release();
     1171        }
     1172        pDictionary->release();
     1173    }
     1174}
    11491175
    11501176/**
    11511177 * Resume built-in keyboard on MacBook Air and Pro hosts.
    1152  * If there is no built-in keyboard device, return success anyway.
    1153  */
    1154 int VBOXCALL    supdrvDarwinResumeBuiltinKbd(void)
     1178 * If there is no built-in keyboard device attached to the system we just ignore this.
     1179 */
     1180static void supdrvDarwinResumeBuiltinKbd(void)
    11551181{
    11561182    /*
     
    11741200        pDictionary->release();
    11751201    }
     1202}
     1203
     1204
     1205/**
     1206 * Resume suspended keyboard devices (if any).
     1207 */
     1208int VBOXCALL    supdrvDarwinResumeSuspendedKbds(void)
     1209{
     1210    supdrvDarwinResumeBuiltinKbd();
     1211    supdrvDarwinResumeBluetoothKbd();
    11761212
    11771213    return 0;
    11781214}
    1179 
    11801215
    11811216
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