Changeset 68089 in vbox
- Timestamp:
- Jul 23, 2017 10:07:12 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117129
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/PS2M.cpp
r68088 r68089 832 832 #ifdef IN_RING3 833 833 834 /** Is there any state change to send as events to the guest? */ 835 static uint32_t ps2mHaveEvents(PPS2M pThis) 836 { 837 return pThis->iAccumX | pThis->iAccumY | pThis->iAccumZ 838 | (pThis->fCurrB != pThis->fReportedB) | (pThis->fAccumB != 0); 839 } 840 834 841 /* Event rate throttling timer to emulate the auxiliary device sampling rate. 835 842 */ … … 848 855 #else 849 856 /* If more movement is accumulated, report it and restart the timer. */ 850 uHaveEvents = p This->iAccumX | pThis->iAccumY | pThis->iAccumZ | (pThis->fCurrB != pThis->fReportedB);857 uHaveEvents = ps2mHaveEvents(pThis); 851 858 LogFlowFunc(("Have%s events\n", uHaveEvents ? "" : " no")); 852 859 … … 991 998 } 992 999 1000 #ifdef RT_STRICT 1001 /** Test the event accumulation mechanism which we use to delay events going 1002 * to the guest to one per 50ms. This test depends on ps2mPutEventWorker() not 1003 * touching the timer if This.fThrottleActive is true. */ 1004 /** @todo if we add any more tests it might be worth using a table of test 1005 * operations and checks. */ 1006 static void ps2mTestAccumulation(void) 1007 { 1008 PS2M This; 1009 unsigned i; 1010 int rc; 1011 uint8_t b; 1012 1013 RT_ZERO(This); 1014 This.evtQ.cSize = AUX_EVT_QUEUE_SIZE; 1015 This.u8State = AUX_STATE_ENABLED; 1016 This.fThrottleActive = true; 1017 /* Certain Windows touch pad drivers report a double tap as a press, then 1018 * a release-press-release all within a single 50ms interval. Simulate 1019 * this to check that it is handled right. */ 1020 ps2mPutEventWorker(&This, 0, 0, 0, 0, 1); 1021 if (ps2mHaveEvents(&This)) 1022 ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true); 1023 ps2mPutEventWorker(&This, 0, 0, 0, 0, 0); 1024 if (ps2mHaveEvents(&This)) 1025 ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true); 1026 ps2mPutEventWorker(&This, 0, 0, 0, 0, 1); 1027 ps2mPutEventWorker(&This, 0, 0, 0, 0, 0); 1028 if (ps2mHaveEvents(&This)) 1029 ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true); 1030 if (ps2mHaveEvents(&This)) 1031 ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true); 1032 for (i = 0; i < 12; ++i) 1033 { 1034 const uint8_t abExpected[] = { 9, 0, 0, 8, 0, 0, 9, 0, 0, 8, 0, 0}; 1035 1036 rc = PS2MByteFromAux(&This, &b); 1037 AssertRCSuccess(rc); 1038 Assert(b == abExpected[i]); 1039 } 1040 rc = PS2MByteFromAux(&This, &b); 1041 Assert(rc != VINF_SUCCESS); 1042 /* Button hold down during mouse drags was broken at some point during 1043 * testing fixes for the previous issue. Test that that works. */ 1044 ps2mPutEventWorker(&This, 0, 0, 0, 0, 1); 1045 if (ps2mHaveEvents(&This)) 1046 ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true); 1047 if (ps2mHaveEvents(&This)) 1048 ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true); 1049 for (i = 0; i < 3; ++i) 1050 { 1051 const uint8_t abExpected[] = { 9, 0, 0 }; 1052 1053 rc = PS2MByteFromAux(&This, &b); 1054 AssertRCSuccess(rc); 1055 Assert(b == abExpected[i]); 1056 } 1057 rc = PS2MByteFromAux(&This, &b); 1058 Assert(rc != VINF_SUCCESS); 1059 } 1060 #endif /* RT_STRICT */ 1061 993 1062 /* -=-=-=-=-=- Mouse: IMousePort -=-=-=-=-=- */ 994 1063 … … 1186 1255 LogFlowFunc(("iInstance=%d\n", iInstance)); 1187 1256 1257 #ifdef RT_STRICT 1258 ps2mTestAccumulation(); 1259 #endif 1260 1188 1261 pThis->pParent = pParent; 1189 1262
Note:
See TracChangeset
for help on using the changeset viewer.