- Timestamp:
- Dec 5, 2013 11:26:00 AM (11 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.cpp
r49779 r49787 39 39 # include <iprt/err.h> 40 40 # include <iprt/semaphore.h> 41 # include <VBox/ usblib.h>41 # include <VBox/sup.h> 42 42 #endif 43 43 … … 1270 1270 IOReturn rc = kIOReturnError; 1271 1271 1272 USBLibResumeBuiltInKeyboard(); 1272 /* Try to resume built-in keyboard. Abort if failed in order to avoid GUI freezes. */ 1273 int rc1 = SUPR3ResumeBuiltinKeyboard(); 1274 if (RT_FAILURE(rc1)) 1275 return rc1; 1273 1276 1274 1277 valueRef = IOHIDValueCreateWithIntegerValue(kCFAllocatorDefault, element, 0, (fEnabled) ? 1 : 0); … … 1294 1297 CFIndex integerValue; 1295 1298 1296 USBLibResumeBuiltInKeyboard(); 1299 /* Try to resume built-in keyboard. Abort if failed in order to avoid GUI freezes. */ 1300 int rc1 = SUPR3ResumeBuiltinKeyboard(); 1301 if (RT_FAILURE(rc1)) 1302 return rc1; 1297 1303 1298 1304 rc = IOHIDDeviceGetValue(hidDevice, element, &valueRef); … … 1915 1921 VBoxHidsState_t *pHidState; 1916 1922 1917 USBLibInit();1918 1919 1923 pHidState = (VBoxHidsState_t *)malloc(sizeof(VBoxHidsState_t)); 1920 1924 AssertReturn(pHidState, NULL); … … 2058 2062 free(pHidState); 2059 2063 2060 USBLibTerm();2061 2062 2064 return rc2; 2063 2065 #else /* !VBOX_WITH_KBD_LEDS_SYNC */ -
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r49786 r49787 139 139 RTCPUID idCpu, uint8_t idApic, uint64_t iTick); 140 140 static void supdrvGipInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pCpu, uint64_t u64NanoTS); 141 static int supdrvIOCtl_ResumeBuiltinKbd(void); 141 142 142 143 … … 1904 1905 } 1905 1906 1907 case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_RESUME_BUILTIN_KBD): 1908 { 1909 /* validate */ 1910 REQ_CHECK_SIZES(SUP_IOCTL_RESUME_BUILTIN_KBD); 1911 1912 pReqHdr->rc = supdrvIOCtl_ResumeBuiltinKbd(); 1913 return 0; 1914 } 1906 1915 1907 1916 default: … … 6140 6149 } 6141 6150 6151 /** 6152 * Resume built-in keyboard on MacBook Air and Pro hosts. 6153 * If there is no built-in keyboard device, return success anyway. 6154 * 6155 * @returns 0 on Mac OS X platform, VERR_NOT_IMPLEMENTED on the other ones. 6156 */ 6157 static int supdrvIOCtl_ResumeBuiltinKbd(void) 6158 { 6159 #if defined(RT_OS_DARWIN) 6160 return supdrvDarwinResumeBuiltinKbd(); 6161 #else 6162 return VERR_NOT_IMPLEMENTED; 6163 #endif 6164 } 6165 -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r49634 r49787 194 194 * - Remove RTSpinlockReleaseNoInts. 195 195 */ 196 #define SUPDRV_IOC_VERSION 0x001a000 6196 #define SUPDRV_IOC_VERSION 0x001a0007 197 197 198 198 /** SUP_IOCTL_COOKIE. */ … … 1438 1438 /** @} */ 1439 1439 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) 1449 /** @} */ 1450 1440 1451 1441 1452 #pragma pack() /* paranoia */ -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r49634 r49787 749 749 #endif /* SUPDRV_WITH_MSR_PROBER */ 750 750 751 #if defined(RT_OS_DARWIN) 752 int VBOXCALL supdrvDarwinResumeBuiltinKbd(void); 753 #endif 751 754 752 755 /******************************************************************************* -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r49634 r49787 2133 2133 } 2134 2134 2135 2136 SUPR3DECL(int) SUPR3ResumeBuiltinKeyboard(void) 2137 { 2138 #ifdef RT_OS_DARWIN 2139 /* 2140 * Issue IOCtl to the SUPDRV kernel module. 2141 */ 2142 SUPREQHDR Req; 2143 Req.u32Cookie = g_u32Cookie; 2144 Req.u32SessionCookie= g_u32SessionCookie; 2145 Req.cbIn = SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE_IN; 2146 Req.cbOut = SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE_OUT; 2147 Req.fFlags = SUPREQHDR_FLAGS_DEFAULT; 2148 Req.rc = VERR_INTERNAL_ERROR; 2149 int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_RESUME_BUILTIN_KBD, &Req, SUP_IOCTL_RESUME_BUILTIN_KBD_SIZE); 2150 if (RT_SUCCESS(rc)) 2151 rc = Req.rc; 2152 return rc; 2153 #else /* !RT_OS_DARWIN */ 2154 return VERR_NOT_SUPPORTED; 2155 #endif 2156 } 2157 -
trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
r49767 r49787 67 67 #include <IOKit/pwr_mgt/RootDomain.h> 68 68 #include <IOKit/IODeviceTreeSupport.h> 69 #include <IOKit/usb/IOUSBHIDDriver.h> 69 70 70 71 #ifdef VBOX_WITH_HOST_VMX … … 1143 1144 1144 1145 1146 /** 1147 * Resume built-in keyboard on MacBook Air and Pro hosts. 1148 * If there is no built-in keyboard device, return success anyway. 1149 */ 1150 int VBOXCALL supdrvDarwinResumeBuiltinKbd(void) 1151 { 1152 /* 1153 * AppleUSBTCKeyboard KEXT is responsible for built-in keyboard management. 1154 * We resume keyboard by accessing to its IOService. */ 1155 OSDictionary *pDictionary = IOService::serviceMatching("AppleUSBTCKeyboard"); 1156 if (pDictionary) 1157 { 1158 OSIterator *pIter; 1159 IOUSBHIDDriver *pDriver; 1160 1161 pIter = IOService::getMatchingServices(pDictionary); 1162 if (pIter) 1163 { 1164 while ((pDriver = (IOUSBHIDDriver *)pIter->getNextObject())) 1165 pDriver->SuspendPort(false, 0); 1166 1167 pIter->release(); 1168 } 1169 pDictionary->release(); 1170 } 1171 1172 return 0; 1173 } 1174 1175 1145 1176 1146 1177 /** -
trunk/src/VBox/HostDrivers/VBoxUSB/darwin/USBLib-darwin.cpp
r49779 r49787 190 190 } 191 191 192 USBLIB_DECL(void) USBLibResumeBuiltInKeyboard(void)193 {194 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1050195 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
r49779 r49787 60 60 #include <IOKit/usb/IOUSBInterface.h> 61 61 #include <IOKit/usb/IOUSBUserClient.h> 62 #include <IOKit/usb/IOUSBHIDDriver.h>63 62 64 63 /* private: */ … … 141 140 IOReturn addFilter(PUSBFILTER pFilter, PVBOXUSBADDFILTEROUT pOut, IOByteCount cbFilter, IOByteCount *pcbOut); 142 141 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);144 142 /** @} */ 145 143 … … 790 788 sizeof(int) /* count1 - size of the output (rc) */ 791 789 }, 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 },800 790 }; 801 791 … … 903 893 } 904 894 905 IOReturn906 org_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 }941 895 942 896 /** -
trunk/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSBInterface.h
r49779 r49787 30 30 /** org_virtualbox_VBoxUSBClient::removeFilter */ 31 31 VBOXUSBMETHOD_REMOVE_FILTER, 32 /** org_virtualbox_VBoxUSBClient::resumeBuiltInKbd */33 VBOXUSBMETHOD_RESUME_BUILTIN_KBD,34 32 /** End/max. */ 35 33 VBOXUSBMETHOD_END
Note:
See TracChangeset
for help on using the changeset viewer.