Commit 84e58612 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Send DISFFC_RESET command on HID joystick (Un)Acquire.

parent 9a9a1656
......@@ -707,6 +707,8 @@ static HRESULT WINAPI hid_joystick_Acquire( IDirectInputDevice8W *iface )
impl->read_ovl.hEvent = impl->base.read_event;
if (ReadFile( impl->device, impl->input_report_buf, report_len, NULL, &impl->read_ovl ))
impl->base.read_callback( iface );
IDirectInputDevice8_SendForceFeedbackCommand( iface, DISFFC_RESET );
}
LeaveCriticalSection( &impl->base.crit );
......@@ -726,6 +728,8 @@ static HRESULT WINAPI hid_joystick_Unacquire( IDirectInputDevice8W *iface )
{
ret = CancelIoEx( impl->device, &impl->read_ovl );
if (!ret) WARN( "CancelIoEx failed, last error %u\n", GetLastError() );
IDirectInputDevice8_SendForceFeedbackCommand( iface, DISFFC_RESET );
}
hr = IDirectInputDevice2WImpl_Unacquire( iface );
LeaveCriticalSection( &impl->base.crit );
......
......@@ -5259,14 +5259,6 @@ static void test_force_feedback_joystick( void )
.report_len = 2,
.report_buf = {1, 0x01},
};
struct hid_expect expect_dc_reset_todo =
{
.code = IOCTL_HID_WRITE_REPORT,
.todo = TRUE,
.report_id = 1,
.report_len = 2,
.report_buf = {1, 0x01},
};
const DIDEVICEINSTANCEW expect_devinst =
{
......@@ -5775,7 +5767,7 @@ static void test_force_feedback_joystick( void )
hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE );
ok( hr == DI_OK, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr );
set_hid_expect( file, &expect_dc_reset_todo, sizeof(expect_dc_reset_todo) );
set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) );
hr = IDirectInputDevice8_Acquire( device );
ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr );
set_hid_expect( file, NULL, 0 );
......@@ -5821,7 +5813,7 @@ static void test_force_feedback_joystick( void )
test_periodic_effect( device, file );
set_hid_expect( file, &expect_dc_reset_todo, sizeof(expect_dc_reset_todo) );
set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) );
hr = IDirectInputDevice8_Unacquire( device );
ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
set_hid_expect( file, NULL, 0 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment