Changeset 79676 in vbox
- Timestamp:
- Jul 10, 2019 2:14:09 PM (5 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
-
idl/VirtualBox.xidl (modified) (2 diffs)
-
include/KeyboardImpl.h (modified) (1 diff)
-
src-client/KeyboardImpl.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r79645 r79676 17582 17582 <interface 17583 17583 name="IKeyboard" extends="$unknown" 17584 uuid=" a7c88b82-2330-44e3-b247-1421a018f9c1"17584 uuid="755e6bdf-1640-41f9-bd74-3ef5fd653250" 17585 17585 wsmap="managed" 17586 17586 reservedMethods="4" reservedAttributes="4" … … 17645 17645 17646 17646 </desc> 17647 </method> 17648 17649 <method name="putUsageCode"> 17650 <desc>Sends a USB HID usage code and page to the keyboard. The 17651 keyRelease flag is set when the key is being released. 17652 17653 <result name="VBOX_E_IPRT_ERROR"> 17654 Could not send usage code to virtual keyboard. 17655 </result> 17656 17657 </desc> 17658 <param name="usageCode" type="long" dir="in"/> 17659 <param name="usagePage" type="long" dir="in"/> 17660 <param name="keyRelease" type="boolean" dir="in"/> 17647 17661 </method> 17648 17662 -
trunk/src/VBox/Main/include/KeyboardImpl.h
r76562 r79676 77 77 HRESULT putCAD(); 78 78 HRESULT releaseKeys(); 79 HRESULT putUsageCode(LONG aUsageCode, LONG aUsagePage, BOOL fKeyRelease); 79 80 80 81 static DECLCALLBACK(void) i_keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds); -
trunk/src/VBox/Main/src-client/KeyboardImpl.cpp
r76760 r79676 218 218 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 219 219 tr("Could not send all scan codes to the virtual keyboard (%Rrc)"), 220 vrc); 221 222 return S_OK; 223 } 224 225 /** 226 * Sends a HID usage code and page to the keyboard. 227 * 228 * @returns COM status code 229 * @param aUsageCode The HID usage code to send 230 * @param aUsagePage The HID usage page corresponding to the code 231 * @param fKeyRelease The key release flag 232 */ 233 HRESULT Keyboard::putUsageCode(LONG aUsageCode, LONG aUsagePage, BOOL fKeyRelease) 234 { 235 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 236 237 CHECK_CONSOLE_DRV(mpDrv[0]); 238 239 /* Send input to the last enabled device. Relies on the fact that 240 * the USB keyboard is always initialized after the PS/2 keyboard. 241 */ 242 PPDMIKEYBOARDPORT pUpPort = NULL; 243 for (int i = KEYBOARD_MAX_DEVICES - 1; i >= 0 ; --i) 244 { 245 if (mpDrv[i] && (mpDrv[i]->u32DevCaps & KEYBOARD_DEVCAP_ENABLED)) 246 { 247 pUpPort = mpDrv[i]->pUpPort; 248 break; 249 } 250 } 251 252 /* No enabled keyboard - throw the input away. */ 253 if (!pUpPort) 254 return S_OK; 255 256 int vrc = VINF_SUCCESS; 257 uint32_t u32Usage; 258 u32Usage = (uint8_t)aUsageCode | ((uint32_t)(uint8_t)aUsagePage << 16) | fKeyRelease ? 0x80000000 : 0; 259 vrc = pUpPort->pfnPutEventHid(pUpPort, u32Usage); 260 if (RT_FAILURE(vrc)) 261 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 262 tr("Could not send usage code to the virtual keyboard (%Rrc)"), 220 263 vrc); 221 264
Note:
See TracChangeset
for help on using the changeset viewer.

