This reverts commit a9b5bb326a1514e2c4185633ab34b22c9bbc9863.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
This first patch is only there so that the testbot can run the tests without failing spuriously. The change broke graphics drivers, although I don't know precisely how and it should probably be fixed instead of reverting it.
tools/makedep.c | 78 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 25 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index 9ea46aed8d8..d5412eccfa4 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -2189,10 +2189,19 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra for (j = 0; j < subdirs.count; j++) { if (submakes[j]->importlib && !strcmp( submakes[j]->importlib, name )) - lib = obj_dir_path( submakes[j], strmake( "lib%s.a", name )); - else - lib = get_static_lib( submakes[j], name ); - if (lib) break; + { + if (is_cross || !*dll_ext || submakes[j]->staticimplib) + lib = obj_dir_path( submakes[j], strmake( "lib%s.a", name )); + else + { + strarray_add_uniq( deps, strmake( "%s/lib%s.def", submakes[j]->obj_dir, name )); + if (needs_implib_symlink( submakes[j] )) + strarray_add_uniq( deps, strmake( "dlls/lib%s.def", name )); + } + break; + } + + if ((lib = get_static_lib( submakes[j], name ))) break; }
if (lib) @@ -2579,8 +2588,12 @@ static void output_uninstall_rules( struct makefile *make ) static struct strarray output_importlib_symlinks( const struct makefile *make ) { struct strarray ret = empty_strarray; - const char *lib, *dst, *ext[2] = { "a", "cross.a" }; - int i, count = 1 + !!crosstarget; + const char *lib, *dst, *ext[4]; + int i, count = 0; + + ext[count++] = (*dll_ext && !make->implib_objs.count) ? "def" : "a"; + if (crosstarget) ext[count++] = "cross.a"; + if (needs_delay_lib( make )) ext[count++] = "delay.a";
for (i = 0; i < count; i++) { @@ -3307,27 +3320,42 @@ static void output_module( struct makefile *make ) if (spec_file && make->importlib) { char *importlib_path = obj_dir_path( make, strmake( "lib%s", make->importlib )); - - strarray_add( &make->clean_files, strmake( "lib%s.a", make->importlib )); - if (!*dll_ext && needs_delay_lib( make )) + if (*dll_ext && !make->implib_objs.count) { - strarray_add( &make->clean_files, strmake( "lib%s.delay.a", make->importlib )); - output( "%s.delay.a ", importlib_path ); + strarray_add( &make->clean_files, strmake( "lib%s.def", make->importlib )); + output( "%s.def: %s %s\n", importlib_path, tools_path( make, "winebuild" ), spec_file ); + output( "\t%s%s -w --def -o $@", cmd_prefix( "BUILD" ), tools_path( make, "winebuild" ) ); + output_filenames( target_flags ); + if (make->is_win16) output_filename( "-m16" ); + output_filename( "--export" ); + output_filename( spec_file ); + output( "\n" ); + add_install_rule( make, make->importlib, + strmake( "lib%s.def", make->importlib ), + strmake( "d%s/lib%s.def", so_dir, make->importlib )); + } + else + { + strarray_add( &make->clean_files, strmake( "lib%s.a", make->importlib )); + if (!*dll_ext && needs_delay_lib( make )) + { + strarray_add( &make->clean_files, strmake( "lib%s.delay.a", make->importlib )); + output( "%s.delay.a ", importlib_path ); + } + output( "%s.a: %s %s", importlib_path, tools_path( make, "winebuild" ), spec_file ); + output_filenames_obj_dir( make, make->implib_objs ); + output( "\n" ); + output( "\t%s%s -w --implib -o $@", cmd_prefix( "BUILD" ), tools_path( make, "winebuild" ) ); + output_filenames( target_flags ); + if (make->is_win16) output_filename( "-m16" ); + output_filename( "--export" ); + output_filename( spec_file ); + output_filenames_obj_dir( make, make->implib_objs ); + output( "\n" ); + add_install_rule( make, make->importlib, + strmake( "lib%s.a", make->importlib ), + strmake( "d%s/lib%s.a", so_dir, make->importlib )); } - output( "%s.a: %s %s", importlib_path, tools_path( make, "winebuild" ), spec_file ); - output_filenames_obj_dir( make, make->implib_objs ); - output( "\n" ); - output( "\t%s%s -w --implib -o $@", cmd_prefix( "BUILD" ), tools_path( make, "winebuild" ) ); - output_filenames( target_flags ); - if (make->is_win16) output_filename( "-m16" ); - output_filename( "--export" ); - output_filename( spec_file ); - output_filenames_obj_dir( make, make->implib_objs ); - output( "\n" ); - add_install_rule( make, make->importlib, - strmake( "lib%s.a", make->importlib ), - strmake( "d%s/lib%s.a", so_dir, make->importlib )); - if (crosstarget) { struct strarray cross_files = strarray_replace_extension( &make->implib_objs, ".o", ".cross.o" );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 2 + dlls/dinput8/tests/device.c | 18 +++ dlls/dinput8/tests/driver_hid.c | 83 +++++++++++ dlls/dinput8/tests/driver_hid.h | 3 +- dlls/dinput8/tests/hid.c | 245 ++++++++++++++++++++++++-------- 5 files changed, 290 insertions(+), 61 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 4af7da6654d..57e08025650 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -322,6 +322,8 @@ static const WCHAR *object_usage_to_string( DIDEVICEOBJECTINSTANCEW *instance ) case MAKELONG(PID_USAGE_DC_ENABLE_ACTUATORS, HID_USAGE_PAGE_PID): return L"DC Enable Actuators"; case MAKELONG(PID_USAGE_DC_STOP_ALL_EFFECTS, HID_USAGE_PAGE_PID): return L"DC Stop All Effects";
+ case MAKELONG(PID_USAGE_DEVICE_GAIN, HID_USAGE_PAGE_PID): return L"Device Gain"; + case MAKELONG(PID_USAGE_DEVICE_GAIN_REPORT, HID_USAGE_PAGE_PID): return L"Device Gain Report"; case MAKELONG(PID_USAGE_CP_OFFSET, HID_USAGE_PAGE_PID): return L"CP Offset"; case MAKELONG(PID_USAGE_DEAD_BAND, HID_USAGE_PAGE_PID): return L"Dead Band"; case MAKELONG(PID_USAGE_DEVICE_CONTROL, HID_USAGE_PAGE_PID): return L"PID Device Control"; diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c index 5ae9e225dc9..019f63ad825 100644 --- a/dlls/dinput8/tests/device.c +++ b/dlls/dinput8/tests/device.c @@ -1414,6 +1414,15 @@ static void test_mouse_info(void) ok( prop_range.lMin == DIPROPRANGE_NOMIN, "got %d expected %d\n", prop_range.lMin, DIPROPRANGE_NOMIN ); ok( prop_range.lMax == DIPROPRANGE_NOMAX, "got %d expected %d\n", prop_range.lMax, DIPROPRANGE_NOMAX );
+ prop_range.diph.dwHow = DIPH_DEVICE; + prop_range.diph.dwObj = 0; + prop_dword.dwData = 0xdeadbeef; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); + ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); + prop_dword.dwData = 1000; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); + ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); + res = 0; hr = IDirectInputDevice8_EnumObjects( device, check_object_count, &res, DIDFT_AXIS | DIDFT_PSHBUTTON ); ok( hr == DI_OK, "EnumObjects returned %#x\n", hr ); @@ -1732,6 +1741,15 @@ static void test_keyboard_info(void) hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_RANGE returned %#x\n", hr );
+ prop_range.diph.dwHow = DIPH_DEVICE; + prop_range.diph.dwObj = 0; + prop_dword.dwData = 0xdeadbeef; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); + ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); + prop_dword.dwData = 1000; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); + ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); + res = 0; hr = IDirectInputDevice8_EnumObjects( device, check_object_count, &res, DIDFT_AXIS | DIDFT_PSHBUTTON ); ok( hr == DI_OK, "EnumObjects returned %#x\n", hr ); diff --git a/dlls/dinput8/tests/driver_hid.c b/dlls/dinput8/tests/driver_hid.c index d6f085e4f30..2201fd07080 100644 --- a/dlls/dinput8/tests/driver_hid.c +++ b/dlls/dinput8/tests/driver_hid.c @@ -55,6 +55,7 @@ struct expect_queue struct hid_expect *end; struct hid_expect spurious; struct hid_expect *buffer; + IRP *pending_wait; };
static void expect_queue_init( struct expect_queue *queue ) @@ -68,6 +69,24 @@ static void expect_queue_init( struct expect_queue *queue )
static void expect_queue_cleanup( struct expect_queue *queue ) { + KIRQL irql; + IRP *irp; + + KeAcquireSpinLock( &queue->lock, &irql ); + if ((irp = queue->pending_wait)) + { + queue->pending_wait = NULL; + if (!IoSetCancelRoutine( irp, NULL )) irp = NULL; + } + KeReleaseSpinLock( &queue->lock, irql ); + + if (irp) + { + irp->IoStatus.Information = 0; + irp->IoStatus.Status = STATUS_DELETE_PENDING; + IoCompleteRequest( irp, IO_NO_INCREMENT ); + } + ExFreePool( queue->buffer ); }
@@ -112,6 +131,54 @@ static void expect_queue_reset( struct expect_queue *queue, void *buffer, unsign ExFreePool( missing ); }
+static void WINAPI wait_cancel_routine( DEVICE_OBJECT *device, IRP *irp ) +{ + struct expect_queue *queue = irp->Tail.Overlay.DriverContext[0]; + KIRQL irql; + + IoReleaseCancelSpinLock( irp->CancelIrql ); + + KeAcquireSpinLock( &queue->lock, &irql ); + queue->pending_wait = NULL; + KeReleaseSpinLock( &queue->lock, irql ); + + irp->IoStatus.Information = 0; + irp->IoStatus.Status = STATUS_CANCELLED; + IoCompleteRequest( irp, IO_NO_INCREMENT ); +} + +static NTSTATUS expect_queue_wait( struct expect_queue *queue, IRP *irp ) +{ + NTSTATUS status; + KIRQL irql; + + KeAcquireSpinLock( &queue->lock, &irql ); + if (queue->pos == queue->end) + status = STATUS_SUCCESS; + else + { + IoSetCancelRoutine( irp, wait_cancel_routine ); + if (irp->Cancel && !IoSetCancelRoutine( irp, NULL )) + status = STATUS_CANCELLED; + else + { + irp->Tail.Overlay.DriverContext[0] = queue; + IoMarkIrpPending( irp ); + queue->pending_wait = irp; + status = STATUS_PENDING; + } + } + KeReleaseSpinLock( &queue->lock, irql ); + + if (status == STATUS_SUCCESS) + { + irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest( irp, IO_NO_INCREMENT ); + } + + return status; +} + static void expect_queue_next( struct expect_queue *queue, ULONG code, HID_XFER_PACKET *packet, LONG *index, struct hid_expect *expect, BOOL compare_buf ) { @@ -119,6 +186,7 @@ static void expect_queue_next( struct expect_queue *queue, ULONG code, HID_XFER_ ULONG len = packet->reportBufferLen; BYTE *buf = packet->reportBuffer; BYTE id = packet->reportId; + IRP *irp = NULL; KIRQL irql;
missing = ExAllocatePool( PagedPool, EXPECT_QUEUE_BUFFER_SIZE ); @@ -140,8 +208,21 @@ static void expect_queue_next( struct expect_queue *queue, ULONG code, HID_XFER_ if (tmp < queue->end) queue->pos = tmp + 1; else tmp = &queue->spurious; *expect = *tmp; + + if (queue->pos == queue->end && (irp = queue->pending_wait)) + { + queue->pending_wait = NULL; + if (!IoSetCancelRoutine( irp, NULL )) irp = NULL; + } KeReleaseSpinLock( &queue->lock, irql );
+ if (irp) + { + irp->IoStatus.Information = 0; + irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest( irp, IO_NO_INCREMENT ); + } + ok( tmp != &queue->spurious, "got spurious packet\n" );
winetest_push_context( "%s expect[%d]", tmp->context, tmp - queue->buffer ); @@ -624,6 +705,8 @@ static NTSTATUS WINAPI driver_ioctl( DEVICE_OBJECT *device, IRP *irp ) irp->IoStatus.Status = STATUS_SUCCESS; IoCompleteRequest( irp, IO_NO_INCREMENT ); return STATUS_SUCCESS; + case IOCTL_WINETEST_HID_WAIT_EXPECT: + return expect_queue_wait( &expect_queue, irp ); case IOCTL_WINETEST_HID_SEND_INPUT: input_queue_reset( &input_queue, irp->AssociatedIrp.SystemBuffer, in_size ); irp->IoStatus.Status = STATUS_SUCCESS; diff --git a/dlls/dinput8/tests/driver_hid.h b/dlls/dinput8/tests/driver_hid.h index 6c355760171..ffd45bd2e35 100644 --- a/dlls/dinput8/tests/driver_hid.h +++ b/dlls/dinput8/tests/driver_hid.h @@ -40,7 +40,8 @@ DEFINE_GUID(control_class,0xdeadbeef,0x29ef,0x4538,0xa5,0xfd,0xb6,0x95,0x73,0xa3,0x62,0xc0);
#define IOCTL_WINETEST_HID_SET_EXPECT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x800, METHOD_IN_DIRECT, FILE_ANY_ACCESS) -#define IOCTL_WINETEST_HID_SEND_INPUT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x801, METHOD_IN_DIRECT, FILE_ANY_ACCESS) +#define IOCTL_WINETEST_HID_WAIT_EXPECT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x801, METHOD_NEITHER, FILE_ANY_ACCESS) +#define IOCTL_WINETEST_HID_SEND_INPUT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x802, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
struct hid_expect { diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 38bdfb7455e..2534c8afe1f 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -743,7 +743,7 @@ static inline void check_hidp_value_caps_( int line, HIDP_VALUE_CAPS *caps, cons } }
-static BOOL sync_ioctl( HANDLE file, DWORD code, void *in_buf, DWORD in_len, void *out_buf, DWORD *ret_len ) +static BOOL sync_ioctl( HANDLE file, DWORD code, void *in_buf, DWORD in_len, void *out_buf, DWORD *ret_len, DWORD timeout ) { OVERLAPPED ovl = {0}; DWORD out_len = ret_len ? *ret_len : 0; @@ -752,7 +752,19 @@ static BOOL sync_ioctl( HANDLE file, DWORD code, void *in_buf, DWORD in_len, voi ovl.hEvent = CreateEventW( NULL, TRUE, FALSE, NULL ); ret = DeviceIoControl( file, code, in_buf, in_len, out_buf, out_len, &out_len, &ovl ); if (!ret && GetLastError() == ERROR_IO_PENDING) - ret = GetOverlappedResult( file, &ovl, &out_len, TRUE ); + { + ret = GetOverlappedResultEx( file, &ovl, &out_len, timeout, TRUE ); + todo_wine_if( timeout != INFINITE ) + ok( ret, "GetOverlappedResultEx returned %u\n", GetLastError() ); + } + if (!ret && GetLastError() == ERROR_TIMEOUT) + { + ret = CancelIoEx( file, &ovl ); + ok( ret, "CancelIoEx returned %u\n", GetLastError() ); + ret = GetOverlappedResultEx( file, &ovl, &out_len, INFINITE, TRUE ); + ok( !ret, "GetOverlappedResultEx succeeded\n" ); + ok( GetLastError() == ERROR_OPERATION_ABORTED, "GetOverlappedResultEx returned %u\n", GetLastError() ); + } CloseHandle( ovl.hEvent );
if (ret_len) *ret_len = out_len; @@ -774,10 +786,20 @@ static void set_hid_expect_( int line, HANDLE file, struct hid_expect *expect, D for (i = 0; i < expect_size / sizeof(struct hid_expect); ++i) snprintf( expect[i].context, ARRAY_SIZE(expect[i].context), "%s:%d", source_file, line );
- ret = sync_ioctl( file, IOCTL_WINETEST_HID_SET_EXPECT, expect, expect_size, NULL, 0 ); + ret = sync_ioctl( file, IOCTL_WINETEST_HID_SET_EXPECT, expect, expect_size, NULL, 0, INFINITE ); ok( ret, "IOCTL_WINETEST_HID_SET_EXPECT failed, last error %u\n", GetLastError() ); }
+#define wait_hid_expect( a, b ) wait_hid_expect_( __LINE__, a, b ) +static void wait_hid_expect_( int line, HANDLE file, DWORD timeout ) +{ + BOOL ret = sync_ioctl( file, IOCTL_WINETEST_HID_WAIT_EXPECT, NULL, 0, NULL, 0, timeout ); + todo_wine + ok( ret, "IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error %u\n", GetLastError() ); + + set_hid_expect( file, NULL, 0 ); +} + #define send_hid_input( a, b, c ) send_hid_input_( __LINE__, a, b, c ) static void send_hid_input_( int line, HANDLE file, struct hid_expect *expect, DWORD expect_size ) { @@ -793,7 +815,7 @@ static void send_hid_input_( int line, HANDLE file, struct hid_expect *expect, D for (i = 0; i < expect_size / sizeof(struct hid_expect); ++i) snprintf( expect[i].context, ARRAY_SIZE(expect[i].context), "%s:%d", source_file, line );
- ret = sync_ioctl( file, IOCTL_WINETEST_HID_SEND_INPUT, expect, expect_size, NULL, 0 ); + ret = sync_ioctl( file, IOCTL_WINETEST_HID_SEND_INPUT, expect, expect_size, NULL, 0, INFINITE ); ok( ret, "IOCTL_WINETEST_HID_SEND_INPUT failed, last error %u\n", GetLastError() ); }
@@ -883,7 +905,7 @@ static void test_hidp_get_input( HANDLE file, int report_id, ULONG report_len, P
SetLastError( 0xdeadbeef ); length = report_len * 2; - ret = sync_ioctl( file, IOCTL_HID_GET_INPUT_REPORT, NULL, 0, report, &length ); + ret = sync_ioctl( file, IOCTL_HID_GET_INPUT_REPORT, NULL, 0, report, &length, INFINITE ); ok( ret, "IOCTL_HID_GET_INPUT_REPORT failed, last error %u\n", GetLastError() ); ok( length == 3, "got length %u, expected 3\n", length ); ok( report[0] == report_id, "got report[0] %02x, expected %02x\n", report[0], report_id ); @@ -977,7 +999,7 @@ static void test_hidp_get_feature( HANDLE file, int report_id, ULONG report_len,
length = report_len * 2; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_GET_FEATURE, NULL, 0, report, &length ); + ret = sync_ioctl( file, IOCTL_HID_GET_FEATURE, NULL, 0, report, &length, INFINITE ); ok( ret, "IOCTL_HID_GET_FEATURE failed, last error %u\n", GetLastError() ); ok( length == 3, "got length %u, expected 3\n", length ); ok( report[0] == report_id, "got report[0] %02x, expected %02x\n", report[0], report_id ); @@ -1073,13 +1095,13 @@ static void test_hidp_set_feature( HANDLE file, int report_id, ULONG report_len,
length = report_len * 2; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_SET_FEATURE, NULL, 0, report, &length ); + ret = sync_ioctl( file, IOCTL_HID_SET_FEATURE, NULL, 0, report, &length, INFINITE ); ok( !ret, "IOCTL_HID_SET_FEATURE succeeded\n" ); ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "IOCTL_HID_SET_FEATURE returned error %u\n", GetLastError() ); length = 0; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_SET_FEATURE, report, report_len * 2, NULL, &length ); + ret = sync_ioctl( file, IOCTL_HID_SET_FEATURE, report, report_len * 2, NULL, &length, INFINITE ); ok( ret, "IOCTL_HID_SET_FEATURE failed, last error %u\n", GetLastError() ); ok( length == 3, "got length %u, expected 3\n", length );
@@ -1168,13 +1190,13 @@ static void test_hidp_set_output( HANDLE file, int report_id, ULONG report_len,
length = report_len * 2; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_SET_OUTPUT_REPORT, NULL, 0, report, &length ); + ret = sync_ioctl( file, IOCTL_HID_SET_OUTPUT_REPORT, NULL, 0, report, &length, INFINITE ); ok( !ret, "IOCTL_HID_SET_OUTPUT_REPORT succeeded\n" ); ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "IOCTL_HID_SET_OUTPUT_REPORT returned error %u\n", GetLastError() ); length = 0; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_SET_OUTPUT_REPORT, report, report_len * 2, NULL, &length ); + ret = sync_ioctl( file, IOCTL_HID_SET_OUTPUT_REPORT, report, report_len * 2, NULL, &length, INFINITE ); ok( ret, "IOCTL_HID_SET_OUTPUT_REPORT failed, last error %u\n", GetLastError() ); ok( length == 3, "got length %u, expected 3\n", length );
@@ -2173,7 +2195,7 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
value = 10; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &value, sizeof(ULONG), NULL, NULL ); + ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &value, sizeof(ULONG), NULL, NULL, INFINITE ); ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() );
Sleep( 600 ); @@ -2392,7 +2414,7 @@ static void test_hid_device( DWORD report_id, DWORD polled, const HIDP_CAPS *exp { out_len = sizeof(ULONG); SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_GET_POLL_FREQUENCY_MSEC, NULL, 0, &poll_freq, &out_len ); + ret = sync_ioctl( file, IOCTL_HID_GET_POLL_FREQUENCY_MSEC, NULL, 0, &poll_freq, &out_len, INFINITE ); ok( ret, "IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() ); ok( out_len == sizeof(ULONG), "got out_len %u, expected sizeof(ULONG)\n", out_len ); todo_wine @@ -2401,27 +2423,27 @@ static void test_hid_device( DWORD report_id, DWORD polled, const HIDP_CAPS *exp out_len = 0; poll_freq = 500; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len ); + ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len, INFINITE ); ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() ); ok( out_len == 0, "got out_len %u, expected 0\n", out_len );
out_len = 0; poll_freq = 10001; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len ); + ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len, INFINITE ); ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() ); ok( out_len == 0, "got out_len %u, expected 0\n", out_len );
out_len = 0; poll_freq = 0; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len ); + ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len, INFINITE ); ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() ); ok( out_len == 0, "got out_len %u, expected 0\n", out_len );
out_len = sizeof(ULONG); SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_GET_POLL_FREQUENCY_MSEC, NULL, 0, &poll_freq, &out_len ); + ret = sync_ioctl( file, IOCTL_HID_GET_POLL_FREQUENCY_MSEC, NULL, 0, &poll_freq, &out_len, INFINITE ); ok( ret, "IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() ); ok( out_len == sizeof(ULONG), "got out_len %u, expected sizeof(ULONG)\n", out_len ); ok( poll_freq == 10000, "got poll_freq %u, expected 10000\n", poll_freq ); @@ -2429,13 +2451,13 @@ static void test_hid_device( DWORD report_id, DWORD polled, const HIDP_CAPS *exp out_len = 0; poll_freq = 500; SetLastError( 0xdeadbeef ); - ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len ); + ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len, INFINITE ); ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() ); ok( out_len == 0, "got out_len %u, expected 0\n", out_len );
out_len = sizeof(ULONG); SetLastError( 0xdeadbeef ); - ret = sync_ioctl( async_file, IOCTL_HID_GET_POLL_FREQUENCY_MSEC, NULL, 0, &poll_freq, &out_len ); + ret = sync_ioctl( async_file, IOCTL_HID_GET_POLL_FREQUENCY_MSEC, NULL, 0, &poll_freq, &out_len, INFINITE ); ok( ret, "IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() ); ok( out_len == sizeof(ULONG), "got out_len %u, expected sizeof(ULONG)\n", out_len ); ok( poll_freq == 500, "got poll_freq %u, expected 500\n", poll_freq ); @@ -4358,7 +4380,8 @@ static void test_simple_joystick(void) ok( hr == DI_OK, "SetEventNotification returned: %#x\n", hr );
file = CreateFileW( prop_guid_path.wszPath, FILE_READ_ACCESS | FILE_WRITE_ACCESS, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL ); + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL ); ok( file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() );
hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, 0 ); @@ -5551,12 +5574,30 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO .report_buf = {1,0x01}, }, }; - struct hid_expect expect_dc_reset = + struct hid_expect expect_acquire[] = { - .code = IOCTL_HID_WRITE_REPORT, - .report_id = 1, - .report_len = 2, - .report_buf = {1, 0x01}, + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 1, + .report_len = 2, + .report_buf = {1, 0x01}, + }, + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 8, + .report_len = 2, + .report_buf = {8, 0x19}, + .todo = TRUE, + }, + }; + struct hid_expect expect_reset[] = + { + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 1, + .report_len = 2, + .report_buf = {1, 0x01}, + }, }; static const DWORD expect_axes_init[2] = {0}; const DIEFFECT expect_desc_init = @@ -5689,16 +5730,16 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO hr = IDirectInputEffect_GetParameters( effect, &desc, 0 ); ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
- set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_reset, sizeof(expect_reset) ); hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 ); hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DURATION ); ok( hr == DI_OK, "GetParameters returned %#x\n", hr ); - set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_acquire, sizeof(expect_acquire) ); hr = IDirectInputDevice8_Acquire( device ); ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); - set_hid_expect( file, NULL, 0 ); + wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
desc.dwDuration = 0xdeadbeef; hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DURATION ); @@ -5810,16 +5851,16 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO if (version >= 0x700) check_member( desc, expect_desc_init, "%u", dwStartDelay ); else ok( desc.dwStartDelay == 0xcdcdcdcd, "got dwStartDelay %#x\n", desc.dwStartDelay );
- set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_reset, sizeof(expect_reset) ); hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 ); hr = IDirectInputEffect_Download( effect ); ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Download returned %#x\n", hr ); - set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_acquire, sizeof(expect_acquire) ); hr = IDirectInputDevice8_Acquire( device ); ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); - set_hid_expect( file, NULL, 0 ); + wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
hr = IDirectInputEffect_Download( effect ); ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#x\n", hr ); @@ -5835,16 +5876,16 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_NODOWNLOAD ); ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
- set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_reset, sizeof(expect_reset) ); hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 ); hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_DURATION ); ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr ); - set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_acquire, sizeof(expect_acquire) ); hr = IDirectInputDevice8_Acquire( device ); ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); - set_hid_expect( file, NULL, 0 ); + wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_DURATION | DIEP_NODOWNLOAD ); ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr ); @@ -6111,10 +6152,10 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO hr = IDirectInputEffect_Stop( effect ); ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Stop returned %#x\n", hr );
- set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_acquire, sizeof(expect_acquire) ); hr = IDirectInputDevice8_Acquire( device ); ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); - set_hid_expect( file, NULL, 0 ); + wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
hr = IDirectInputEffect_Unload( effect ); ok( hr == DI_NOEFFECT, "Unload returned %#x\n", hr ); @@ -6291,7 +6332,7 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO winetest_pop_context(); }
- set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_reset, sizeof(expect_reset) ); hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 ); @@ -6299,10 +6340,10 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO ok( hr == DI_OK, "CreateEffect returned %#x\n", hr ); ref = IDirectInputEffect_Release( effect ); ok( ref == 0, "Release returned %d\n", ref ); - set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_acquire, sizeof(expect_acquire) ); hr = IDirectInputDevice8_Acquire( device ); ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); - set_hid_expect( file, NULL, 0 ); + wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */ }
static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file, DWORD version ) @@ -6858,6 +6899,21 @@ static void test_force_feedback_joystick( DWORD version ) REPORT_COUNT(1, 1), OUTPUT(1, Data|Var|Abs), END_COLLECTION, + + + USAGE(1, PID_USAGE_DEVICE_GAIN_REPORT), + COLLECTION(1, Logical), + REPORT_ID(1, 8), + + USAGE(1, PID_USAGE_DEVICE_GAIN), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(2, 0x00ff), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(2, 0x2710), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Var|Abs), + END_COLLECTION, END_COLLECTION, }; #undef REPORT_ID_OR_USAGE_PAGE @@ -6881,12 +6937,46 @@ static void test_force_feedback_joystick( DWORD version ) .dwHardwareRevision = 1, .dwFFDriverVersion = 1, }; - struct hid_expect expect_dc_reset = + struct hid_expect expect_acquire[] = + { + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 1, + .report_len = 2, + .report_buf = {1, 0x01}, + }, + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 8, + .report_len = 2, + .report_buf = {8, 0x19}, + .todo = TRUE, + }, + }; + struct hid_expect expect_reset[] = + { + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 1, + .report_len = 2, + .report_buf = {1, 0x01}, + }, + }; + struct hid_expect expect_set_device_gain_1 = { .code = IOCTL_HID_WRITE_REPORT, - .report_id = 1, + .report_id = 8, .report_len = 2, - .report_buf = {1, 0x01}, + .report_buf = {8, 0x19}, + .todo = TRUE, + }; + struct hid_expect expect_set_device_gain_2 = + { + .code = IOCTL_HID_WRITE_REPORT, + .report_id = 8, + .report_len = 2, + .report_buf = {8, 0x33}, + .todo = TRUE, };
const DIDEVICEINSTANCEW expect_devinst = @@ -7004,7 +7094,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Button, - .dwOfs = version >= 0x800 ? 0x64 : 0x10, + .dwOfs = version >= 0x800 ? 0x68 : 0x10, .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(0)|DIDFT_FFEFFECTTRIGGER, .dwFlags = DIDOI_FFEFFECTTRIGGER, .tszName = L"Button 0", @@ -7016,7 +7106,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Button, - .dwOfs = version >= 0x800 ? 0x65 : 0x11, + .dwOfs = version >= 0x800 ? 0x69 : 0x11, .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(1)|DIDFT_FFEFFECTTRIGGER, .dwFlags = DIDOI_FFEFFECTTRIGGER, .tszName = L"Button 1", @@ -7028,7 +7118,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x6c : 0, + .dwOfs = version >= 0x800 ? 0x70 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(12)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"DC Device Reset", @@ -7052,7 +7142,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x6d : 0, + .dwOfs = version >= 0x800 ? 0x71 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(14)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Start", @@ -7064,7 +7154,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x6e : 0, + .dwOfs = version >= 0x800 ? 0x72 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(15)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Start Solo", @@ -7076,7 +7166,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x6f : 0, + .dwOfs = version >= 0x800 ? 0x73 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(16)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Stop", @@ -7112,7 +7202,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x70 : 0, + .dwOfs = version >= 0x800 ? 0x74 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(19)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"ET Square", @@ -7124,7 +7214,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x71 : 0, + .dwOfs = version >= 0x800 ? 0x75 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(20)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"ET Sine", @@ -7136,7 +7226,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x72 : 0, + .dwOfs = version >= 0x800 ? 0x76 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(21)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"ET Spring", @@ -7148,7 +7238,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x73 : 0, + .dwOfs = version >= 0x800 ? 0x77 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(22)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Z Axis", @@ -7160,7 +7250,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x74 : 0, + .dwOfs = version >= 0x800 ? 0x78 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(23)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Y Axis", @@ -7172,7 +7262,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x75 : 0, + .dwOfs = version >= 0x800 ? 0x79 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(24)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"X Axis", @@ -7184,7 +7274,7 @@ static void test_force_feedback_joystick( DWORD version ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = version >= 0x800 ? 0x76 : 0, + .dwOfs = version >= 0x800 ? 0x7a : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(25)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Direction Enable", @@ -7419,6 +7509,18 @@ static void test_force_feedback_joystick( DWORD version ) .wUsage = PID_USAGE_DEAD_BAND, .wReportId = 7, }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwOfs = version >= 0x800 ? 0x64 : 0, + .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(44)|DIDFT_OUTPUT, + .dwFlags = 0x80008000, + .tszName = L"Device Gain", + .wCollectionNumber = 15, + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_DEVICE_GAIN, + .wReportId = 8, + }, { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, @@ -7545,6 +7647,14 @@ static void test_force_feedback_joystick( DWORD version ) .wUsagePage = HID_USAGE_PAGE_PID, .wUsage = PID_USAGE_TYPE_SPECIFIC_BLOCK_OFFSET, }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Unknown, + .dwType = DIDFT_COLLECTION|DIDFT_NODATA|DIDFT_MAKEINSTANCE(15), + .tszName = L"Collection 15 - Device Gain Report", + .wUsagePage = HID_USAGE_PAGE_PID, + .wUsage = PID_USAGE_DEVICE_GAIN_REPORT, + }, }; const DIEFFECTINFOW expect_effects[] = { @@ -7713,7 +7823,8 @@ static void test_force_feedback_joystick( DWORD version ) ok( hr == DI_OK, "GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr );
file = CreateFileW( prop_guid_path.wszPath, FILE_READ_ACCESS | FILE_WRITE_ACCESS, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL ); + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL ); ok( file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() );
hwnd = CreateWindowW( L"static", L"dinput", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10, 10, 200, 200, @@ -7771,10 +7882,24 @@ static void test_force_feedback_joystick( DWORD version ) hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE ); ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
- set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_acquire, sizeof(expect_acquire) ); hr = IDirectInputDevice8_Acquire( device ); ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); - set_hid_expect( file, NULL, 0 ); + wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */ + + set_hid_expect( file, &expect_set_device_gain_2, sizeof(expect_set_device_gain_2) ); + prop_dword.dwData = 2000; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); + todo_wine + ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); + wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */ + + set_hid_expect( file, &expect_set_device_gain_1, sizeof(expect_set_device_gain_1) ); + prop_dword.dwData = 1000; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); + todo_wine + ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); + wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
hr = IDirectInputDevice8_Escape( device, &escape ); todo_wine @@ -7792,10 +7917,10 @@ static void test_force_feedback_joystick( DWORD version ) hr = IDirectInputDevice8_SendForceFeedbackCommand( device, 0xdeadbeef ); ok( hr == DIERR_INVALIDPARAM, "SendForceFeedbackCommand returned %#x\n", hr );
- set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_acquire, sizeof(expect_acquire) ); hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET ); ok( hr == DI_OK, "SendForceFeedbackCommand returned %#x\n", hr ); - set_hid_expect( file, NULL, 0 ); + wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_STOPALL ); ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#x\n", hr ); @@ -7818,7 +7943,7 @@ static void test_force_feedback_joystick( DWORD version ) test_periodic_effect( device, file, version ); test_condition_effect( device, file, version );
- set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + set_hid_expect( file, expect_reset, sizeof(expect_reset) ); hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 );
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=102106
Your paranoid android.
=== debiant2 (32 bit report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
dinput: device.c:285: Test failed: Instance GUID should equal product GUID. Expected {00011209-0000-0000-0000-504944564944}, got {9e573edf-7734-11d2-8d4a-23903fb6bdf7} joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:767: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:770: Test failed: Gain not updated: 10000 joystick.c:775: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:778: Test failed: Gain not updated: 10000 joystick.c:785: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:788: Test failed: Gain not updated: 10000 joystick.c:791: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:767: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:770: Test failed: Gain not updated: 10000 joystick.c:775: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:778: Test failed: Gain not updated: 10000 joystick.c:785: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:788: Test failed: Gain not updated: 10000 joystick.c:791: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:767: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:770: Test failed: Gain not updated: 10000 joystick.c:775: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:778: Test failed: Gain not updated: 10000 joystick.c:785: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:788: Test failed: Gain not updated: 10000 joystick.c:791: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started
=== debiant2 (32 bit Arabic:Morocco report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit German report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit French report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit Hebrew:Israel report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit Hindi:India report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit Japanese:Japan report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit Chinese:China report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
dinput: device.c:285: Test failed: Instance GUID should equal product GUID. Expected {00011209-0000-0000-0000-504944564944}, got {9e573edf-7734-11d2-8d4a-23903fb6bdf7} joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:767: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:770: Test failed: Gain not updated: 10000 joystick.c:775: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:778: Test failed: Gain not updated: 10000 joystick.c:785: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:788: Test failed: Gain not updated: 10000 joystick.c:791: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:767: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:770: Test failed: Gain not updated: 10000 joystick.c:775: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:778: Test failed: Gain not updated: 10000 joystick.c:785: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:788: Test failed: Gain not updated: 10000 joystick.c:791: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:767: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:770: Test failed: Gain not updated: 10000 joystick.c:775: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:778: Test failed: Gain not updated: 10000 joystick.c:785: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:788: Test failed: Gain not updated: 10000 joystick.c:791: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80004001 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started
Based on a patch from Ivo Ivanov logos128@gmail.com.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 15 ++++++++++++++- dlls/dinput/device_private.h | 2 ++ dlls/dinput/joystick_hid.c | 8 ++++++++ dlls/dinput/keyboard.c | 1 + dlls/dinput/mouse.c | 1 + dlls/dinput8/tests/hid.c | 6 ------ 6 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 8d65d051a3b..449adaffde2 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1008,7 +1008,7 @@ static HRESULT WINAPI dinput_device_GetProperty( IDirectInputDevice8W *iface, co { DIPROPDWORD *value = (DIPROPDWORD *)header; if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; - value->dwData = 10000; + value->dwData = impl->device_gain; return DI_OK; } case (DWORD_PTR)DIPROP_CALIBRATION: @@ -1094,6 +1094,18 @@ static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, co LeaveCriticalSection( &impl->crit ); return hr; } + case (DWORD_PTR)DIPROP_FFGAIN: + { + const DIPROPDWORD *value = (const DIPROPDWORD *)header; + if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; + if (!impl->vtbl->send_device_gain) return DIERR_UNSUPPORTED; + if (header->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED; + if (value->dwData > 10000) return DIERR_INVALIDPARAM; + EnterCriticalSection( &impl->crit ); + impl->device_gain = value->dwData; + LeaveCriticalSection( &impl->crit ); + return hr; + } case (DWORD_PTR)DIPROP_FFLOAD: case (DWORD_PTR)DIPROP_GRANULARITY: case (DWORD_PTR)DIPROP_VIDPID: @@ -1853,6 +1865,7 @@ HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, This->caps.dwSize = sizeof(DIDEVCAPS); This->caps.dwFlags = DIDC_ATTACHED | DIDC_EMULATED; This->device_format = format; + This->device_gain = 10000; InitializeCriticalSection( &This->crit ); This->dinput = dinput; IDirectInput_AddRef( &dinput->IDirectInput7A_iface ); diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 02befc6e869..a2110942583 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -50,6 +50,7 @@ struct dinput_device_vtbl HRESULT (*get_effect_info)( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, const GUID *guid ); HRESULT (*create_effect)( IDirectInputDevice8W *iface, IDirectInputEffect **out ); HRESULT (*send_force_feedback_command)( IDirectInputDevice8W *iface, DWORD command ); + HRESULT (*send_device_gain)( IDirectInputDevice8W *iface, LONG device_gain ); HRESULT (*enum_created_effect_objects)( IDirectInputDevice8W *iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, void *context, DWORD flags ); }; @@ -98,6 +99,7 @@ struct dinput_device BYTE device_state[DEVICE_STATE_MAX_SIZE];
BOOL autocenter; + LONG device_gain; };
extern HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid, diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 57e08025650..b1d19c2b57c 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -786,6 +786,13 @@ static void set_extra_caps_range( struct hid_joystick *impl, const DIDEVICEOBJEC } }
+static HRESULT hid_joystick_send_device_gain( IDirectInputDevice8W *iface, LONG device_gain ) +{ + FIXME( "iface %p stub!\n", iface ); + + return DIERR_UNSUPPORTED; +} + static HRESULT hid_joystick_set_property( IDirectInputDevice8W *iface, DWORD property, const DIPROPHEADER *header, const DIDEVICEOBJECTINSTANCEW *instance ) { @@ -1268,6 +1275,7 @@ static const struct dinput_device_vtbl hid_joystick_vtbl = hid_joystick_get_effect_info, hid_joystick_create_effect, hid_joystick_send_force_feedback_command, + hid_joystick_send_device_gain, hid_joystick_enum_created_effect_objects, };
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index f906e32a59d..916a1d43233 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -294,4 +294,5 @@ static const struct dinput_device_vtbl keyboard_vtbl = NULL, NULL, NULL, + NULL, }; diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 1b45c8d5fd4..313ac070c86 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -596,4 +596,5 @@ static const struct dinput_device_vtbl mouse_vtbl = NULL, NULL, NULL, + NULL, }; diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 2534c8afe1f..9fec003f598 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5016,11 +5016,9 @@ static void test_simple_joystick(void) prop_dword.diph.dwObj = 0; prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - todo_wine ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); prop_dword.dwData = 1000; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - todo_wine ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
prop_dword.dwData = 0xdeadbeef; @@ -7848,11 +7846,9 @@ static void test_force_feedback_joystick( DWORD version )
prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - todo_wine ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); prop_dword.dwData = 1000; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - todo_wine ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
prop_dword.dwData = 0xdeadbeef; @@ -7890,14 +7886,12 @@ static void test_force_feedback_joystick( DWORD version ) set_hid_expect( file, &expect_set_device_gain_2, sizeof(expect_set_device_gain_2) ); prop_dword.dwData = 2000; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - todo_wine ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
set_hid_expect( file, &expect_set_device_gain_1, sizeof(expect_set_device_gain_1) ); prop_dword.dwData = 1000; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - todo_wine ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr ); wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=102107
Your paranoid android.
=== w8 (32 bit report) ===
dinput8: hid.c:4943: Test failed: state[0]: WaitForSingleObject succeeded
=== debiant2 (32 bit report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
dinput: device.c:285: Test failed: Instance GUID should equal product GUID. Expected {00011209-0000-0000-0000-504944564944}, got {9e573edf-7734-11d2-8d4a-23903fb6bdf7} joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started
=== debiant2 (32 bit Arabic:Morocco report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit German report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit French report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit Hebrew:Israel report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit Hindi:India report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit Japanese:Japan report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit Chinese:China report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
dinput: device.c:285: Test failed: Instance GUID should equal product GUID. Expected {00011209-0000-0000-0000-504944564944}, got {9e573edf-7734-11d2-8d4a-23903fb6bdf7} joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_sdl.c | 8 +++++++ dlls/winebus.sys/bus_udev.c | 8 +++++++ dlls/winebus.sys/hid.c | 38 +++++++++++++++++++++++++++++++++ dlls/winebus.sys/unix_private.h | 2 ++ dlls/winebus.sys/unixlib.c | 12 +++++++++++ 5 files changed, 68 insertions(+)
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 49afcbaf67c..48d5ad85a2b 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -480,6 +480,13 @@ static NTSTATUS sdl_device_physical_device_control(struct unix_device *iface, US return STATUS_NOT_SUPPORTED; }
+static NTSTATUS sdl_device_physical_device_set_gain(struct unix_device *iface, BYTE value) +{ + FIXME("iface %p, value %#x stub!\n", iface, value); + + return STATUS_NOT_IMPLEMENTED; +} + static NTSTATUS sdl_device_physical_effect_control(struct unix_device *iface, BYTE index, USAGE control, BYTE iterations) { @@ -664,6 +671,7 @@ static const struct hid_device_vtbl sdl_device_vtbl = sdl_device_stop, sdl_device_haptics_start, sdl_device_physical_device_control, + sdl_device_physical_device_set_gain, sdl_device_physical_effect_control, sdl_device_physical_effect_update, }; diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 5ff1719848d..74cfe486a03 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -924,6 +924,13 @@ static NTSTATUS lnxev_device_physical_device_control(struct unix_device *iface, return STATUS_NOT_SUPPORTED; }
+static NTSTATUS lnxev_device_physical_device_set_gain(struct unix_device *iface, BYTE value) +{ + FIXME("iface %p, value %#x stub!\n", iface, value); + + return STATUS_NOT_IMPLEMENTED; +} + static NTSTATUS lnxev_device_physical_effect_control(struct unix_device *iface, BYTE index, USAGE control, BYTE iterations) { @@ -1095,6 +1102,7 @@ static const struct hid_device_vtbl lnxev_device_vtbl = lnxev_device_start, lnxev_device_stop, lnxev_device_haptics_start, + lnxev_device_physical_device_set_gain, lnxev_device_physical_device_control, lnxev_device_physical_effect_control, lnxev_device_physical_effect_update, diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c index 893bf1cd7f6..6f22e0e81d8 100644 --- a/dlls/winebus.sys/hid.c +++ b/dlls/winebus.sys/hid.c @@ -412,6 +412,11 @@ static const USAGE pid_device_control_usages[] = PID_USAGE_DC_DEVICE_CONTINUE, };
+struct pid_device_gain +{ + BYTE value; +}; + struct pid_effect_control { BYTE index; @@ -741,6 +746,25 @@ BOOL hid_device_add_physical(struct unix_device *iface, USAGE *usages, USHORT co END_COLLECTION, };
+ const BYTE device_gain_report = ++desc->next_report_id[HidP_Output]; + const BYTE device_gain[] = + { + USAGE_PAGE(1, HID_USAGE_PAGE_PID), + USAGE(1, PID_USAGE_DEVICE_GAIN_REPORT), + COLLECTION(1, Logical), + REPORT_ID(1, device_gain_report), + + USAGE(1, PID_USAGE_DEVICE_GAIN), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(2, 0x00ff), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(2, 0x2710), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Var|Abs), + END_COLLECTION, + }; + const BYTE effect_control_report = ++desc->next_report_id[HidP_Output]; const BYTE effect_control_header[] = { @@ -882,6 +906,9 @@ BOOL hid_device_add_physical(struct unix_device *iface, USAGE *usages, USHORT co if (!hid_report_descriptor_append(desc, device_control_footer, sizeof(device_control_footer))) return FALSE;
+ if (!hid_report_descriptor_append(desc, device_gain, sizeof(device_gain))) + return FALSE; + if (!hid_report_descriptor_append(desc, effect_control_header, sizeof(effect_control_header))) return FALSE; for (i = 1; i < ARRAY_SIZE(pid_effect_control_usages); ++i) @@ -936,6 +963,7 @@ BOOL hid_device_add_physical(struct unix_device *iface, USAGE *usages, USHORT co memcpy(iface->hid_physical.effect_types + 1, usages, count * sizeof(*usages));
iface->hid_physical.device_control_report = device_control_report; + iface->hid_physical.device_gain_report = device_gain_report; iface->hid_physical.effect_control_report = effect_control_report; iface->hid_physical.effect_update_report = effect_update_report; return TRUE; @@ -1013,6 +1041,16 @@ static void hid_device_set_output_report(struct unix_device *iface, HID_XFER_PAC else io->Status = iface->hid_vtbl->physical_device_control(iface, control); } + else if (packet->reportId == physical->device_gain_report) + { + struct pid_device_gain *report = (struct pid_device_gain *)(packet->reportBuffer + 1); + + io->Information = sizeof(*report) + 1; + if (packet->reportBufferLen < io->Information) + io->Status = STATUS_BUFFER_TOO_SMALL; + else + io->Status = iface->hid_vtbl->physical_device_set_gain(iface, report->value); + } else if (packet->reportId == physical->effect_control_report) { struct pid_effect_control *report = (struct pid_effect_control *)(packet->reportBuffer + 1); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 89a0c9abad9..ef574e48cee 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -109,6 +109,7 @@ struct hid_device_vtbl NTSTATUS (*haptics_start)(struct unix_device *iface, DWORD duration_ms, USHORT rumble_intensity, USHORT buzz_intensity); NTSTATUS (*physical_device_control)(struct unix_device *iface, USAGE control); + NTSTATUS (*physical_device_set_gain)(struct unix_device *iface, BYTE value); NTSTATUS (*physical_effect_control)(struct unix_device *iface, BYTE index, USAGE control, BYTE iterations); NTSTATUS (*physical_effect_update)(struct unix_device *iface, BYTE index, struct effect_params *params); }; @@ -157,6 +158,7 @@ struct hid_physical struct effect_params effect_params[256];
BYTE device_control_report; + BYTE device_gain_report; BYTE effect_control_report; BYTE effect_update_report; BYTE set_periodic_report; diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 6cf58570c76..9d819bab7e3 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -106,6 +106,11 @@ static NTSTATUS mouse_physical_device_control(struct unix_device *iface, USAGE c return STATUS_NOT_SUPPORTED; }
+static NTSTATUS mouse_physical_device_set_gain(struct unix_device *iface, BYTE value) +{ + return STATUS_NOT_SUPPORTED; +} + static NTSTATUS mouse_physical_effect_control(struct unix_device *iface, BYTE index, USAGE control, BYTE iterations) { @@ -125,6 +130,7 @@ static const struct hid_device_vtbl mouse_vtbl = mouse_stop, mouse_haptics_start, mouse_physical_device_control, + mouse_physical_device_set_gain, mouse_physical_effect_control, mouse_physical_effect_update, }; @@ -183,6 +189,11 @@ static NTSTATUS keyboard_physical_device_control(struct unix_device *iface, USAG return STATUS_NOT_SUPPORTED; }
+static NTSTATUS keyboard_physical_device_set_gain(struct unix_device *iface, BYTE value) +{ + return STATUS_NOT_SUPPORTED; +} + static NTSTATUS keyboard_physical_effect_control(struct unix_device *iface, BYTE index, USAGE control, BYTE iterations) { @@ -202,6 +213,7 @@ static const struct hid_device_vtbl keyboard_vtbl = keyboard_stop, keyboard_haptics_start, keyboard_physical_device_control, + keyboard_physical_device_set_gain, keyboard_physical_effect_control, keyboard_physical_effect_update, };
Based on a patch from Ivo Ivanov logos128@gmail.com.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index b1d19c2b57c..00e08e2ef40 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -136,6 +136,13 @@ struct pid_set_ramp_force struct hid_value_caps *end_caps; };
+struct pid_device_gain +{ + BYTE id; + ULONG collection; + struct hid_value_caps *device_gain_caps; +}; + struct hid_joystick { struct dinput_device base; @@ -166,6 +173,7 @@ struct hid_joystick struct pid_set_condition pid_set_condition; struct pid_set_constant_force pid_set_constant_force; struct pid_set_ramp_force pid_set_ramp_force; + struct pid_device_gain pid_device_gain; };
static inline struct hid_joystick *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) @@ -1551,6 +1559,7 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps * struct pid_set_condition *set_condition = &impl->pid_set_condition; struct pid_set_periodic *set_periodic = &impl->pid_set_periodic; struct pid_set_envelope *set_envelope = &impl->pid_set_envelope; + struct pid_device_gain *device_gain = &impl->pid_device_gain;
#define SET_COLLECTION( rep ) \ do \ @@ -1581,6 +1590,7 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps * case PID_USAGE_SET_CONDITION_REPORT: SET_COLLECTION( set_condition ); break; case PID_USAGE_SET_CONSTANT_FORCE_REPORT: SET_COLLECTION( set_constant_force ); break; case PID_USAGE_SET_RAMP_FORCE_REPORT: SET_COLLECTION( set_ramp_force ); break; + case PID_USAGE_DEVICE_GAIN_REPORT: SET_COLLECTION( device_gain ); break;
case PID_USAGE_DEVICE_CONTROL: SET_SUB_COLLECTION( device_control, control_coll ); break; case PID_USAGE_EFFECT_OPERATION: SET_SUB_COLLECTION( effect_control, control_coll ); break; @@ -1610,6 +1620,7 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap struct pid_set_condition *set_condition = &impl->pid_set_condition; struct pid_set_periodic *set_periodic = &impl->pid_set_periodic; struct pid_set_envelope *set_envelope = &impl->pid_set_envelope; + struct pid_device_gain *device_gain = &impl->pid_device_gain;
if (!(instance->dwType & DIDFT_OUTPUT)) return DIENUM_CONTINUE;
@@ -1776,6 +1787,16 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap set_ramp_force->end_caps = caps; } } + if (instance->wCollectionNumber == device_gain->collection) + { + SET_REPORT_ID( device_gain ); + if (instance->wUsage == PID_USAGE_DEVICE_GAIN) + { + caps->physical_min = 0; + caps->physical_max = 10000; + device_gain->device_gain_caps = caps; + } + }
#undef SET_REPORT_ID
@@ -1874,6 +1895,7 @@ HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, TRACE( "set constant force id %u, coll %u\n", impl->pid_set_constant_force.id, impl->pid_set_constant_force.collection ); TRACE( "set ramp force id %u, coll %u\n", impl->pid_set_ramp_force.id, impl->pid_set_ramp_force.collection ); + TRACE( "device gain id %u, coll %u\n", impl->pid_device_gain.id, impl->pid_device_gain.collection );
if (impl->pid_device_control.id) {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=102109
Your paranoid android.
=== debiant2 (32 bit report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
dinput: device.c:285: Test failed: Instance GUID should equal product GUID. Expected {00011209-0000-0000-0000-504944564944}, got {9e573edf-7734-11d2-8d4a-23903fb6bdf7} joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started
=== debiant2 (32 bit Chinese:China report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
dinput: device.c:285: Test failed: Instance GUID should equal product GUID. Expected {00011209-0000-0000-0000-504944564944}, got {9e573edf-7734-11d2-8d4a-23903fb6bdf7} joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started
From: Ivo Ivanov logos128@gmail.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 00e08e2ef40..0502362de2f 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -674,6 +674,29 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *filter, return DIENUM_CONTINUE; }
+static void set_parameter_value( struct hid_joystick_effect *impl, char *report_buf, + struct hid_value_caps *caps, LONG value ) +{ + ULONG report_len = impl->joystick->caps.OutputReportByteLength; + PHIDP_PREPARSED_DATA preparsed = impl->joystick->preparsed; + LONG log_min, log_max, phy_min, phy_max; + NTSTATUS status; + + if (!caps) return; + + log_min = caps->logical_min; + log_max = caps->logical_max; + phy_min = caps->physical_min; + phy_max = caps->physical_max; + + if (value > phy_max || value < phy_min) value = -1; + else value = log_min + (value - phy_min) * (log_max - log_min) / (phy_max - phy_min); + status = HidP_SetUsageValue( HidP_Output, caps->usage_page, caps->link_collection, + caps->usage_min, value, preparsed, report_buf, report_len ); + if (status != HIDP_STATUS_SUCCESS) WARN( "HidP_SetUsageValue %04x:%04x returned %#x\n", + caps->usage_page, caps->usage_min, status ); +} + static void hid_joystick_addref( IDirectInputDevice8W *iface ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); @@ -2632,29 +2655,6 @@ static HRESULT WINAPI hid_joystick_effect_GetEffectStatus( IDirectInputEffect *i return DIERR_UNSUPPORTED; }
-static void set_parameter_value( struct hid_joystick_effect *impl, char *report_buf, - struct hid_value_caps *caps, LONG value ) -{ - ULONG report_len = impl->joystick->caps.OutputReportByteLength; - PHIDP_PREPARSED_DATA preparsed = impl->joystick->preparsed; - LONG log_min, log_max, phy_min, phy_max; - NTSTATUS status; - - if (!caps) return; - - log_min = caps->logical_min; - log_max = caps->logical_max; - phy_min = caps->physical_min; - phy_max = caps->physical_max; - - if (value > phy_max || value < phy_min) value = -1; - else value = log_min + (value - phy_min) * (log_max - log_min) / (phy_max - phy_min); - status = HidP_SetUsageValue( HidP_Output, caps->usage_page, caps->link_collection, - caps->usage_min, value, preparsed, report_buf, report_len ); - if (status != HIDP_STATUS_SUCCESS) WARN( "HidP_SetUsageValue %04x:%04x returned %#x\n", - caps->usage_page, caps->usage_min, status ); -} - static void set_parameter_value_us( struct hid_joystick_effect *impl, char *report_buf, struct hid_value_caps *caps, LONG value ) {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=102110
Your paranoid android.
=== debiant2 (32 bit report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
dinput: device.c:285: Test failed: Instance GUID should equal product GUID. Expected {00011209-0000-0000-0000-504944564944}, got {9e573edf-7734-11d2-8d4a-23903fb6bdf7} joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started
=== debiant2 (32 bit Chinese:China report) ===
dinput8: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
dinput: device.c:285: Test failed: Instance GUID should equal product GUID. Expected {00011209-0000-0000-0000-504944564944}, got {9e573edf-7734-11d2-8d4a-23903fb6bdf7} joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:412: Test failed: DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: 0 Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:414: Test failed: DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: L"\\?\hid#winetest#0#{4d1e55b2-f16f-11cf-88cb-001111000030}" joystick.c:621: Test failed: IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: 80004003 joystick.c:626: Test failed: IDirectInputEffect_SetParameters failed: 800704df joystick.c:656: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:657: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:662: Test failed: IDirectInputEffect_SetParameters failed: 00000000 joystick.c:667: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:668: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:676: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:677: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:681: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:683: Test succeeded inside todo block: IDirectInputEffect_GetEffectStatus() reported effect as stopped joystick.c:711: Test failed: IDirectInputDevice2_GetProperty() reported autocenter as disabled joystick.c:782: Test succeeded inside todo block: IDirectInputDevice_SetProperty() should have returned 80070057: 80070057 joystick.c:798: Test failed: IDirectInputDevice_SetProperty() failed: 80070057 joystick.c:801: Test failed: Gain not updated: 10000 joystick.c:817: Test failed: IDirectInputDevice_SendForceFeedbackCommand() failed: c0110004 joystick.c:819: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:820: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started joystick.c:831: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:835: Test failed: IDirectInputEffect_GetEffectStatus() failed: 80004001 joystick.c:836: Test failed: IDirectInputEffect_GetEffectStatus() reported effect as started
Based on a patch from Ivo Ivanov logos128@gmail.com.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 4 +++- dlls/dinput/device_private.h | 2 +- dlls/dinput/joystick_hid.c | 42 +++++++++++++++++++++++++++++------- dlls/dinput8/tests/hid.c | 14 ------------ 4 files changed, 38 insertions(+), 24 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 449adaffde2..f21d951d268 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1103,6 +1103,8 @@ static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, co if (value->dwData > 10000) return DIERR_INVALIDPARAM; EnterCriticalSection( &impl->crit ); impl->device_gain = value->dwData; + if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) hr = DI_OK; + else hr = impl->vtbl->send_device_gain( iface, impl->device_gain ); LeaveCriticalSection( &impl->crit ); return hr; } @@ -1520,7 +1522,7 @@ static HRESULT WINAPI dinput_device_SendForceFeedbackCommand( IDirectInputDevice
EnterCriticalSection( &impl->crit ); if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) hr = DIERR_NOTEXCLUSIVEACQUIRED; - else hr = impl->vtbl->send_force_feedback_command( iface, command ); + else hr = impl->vtbl->send_force_feedback_command( iface, command, FALSE ); LeaveCriticalSection( &impl->crit );
return hr; diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index a2110942583..aeab89c840a 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -49,7 +49,7 @@ struct dinput_device_vtbl const DIDEVICEOBJECTINSTANCEW *instance ); HRESULT (*get_effect_info)( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, const GUID *guid ); HRESULT (*create_effect)( IDirectInputDevice8W *iface, IDirectInputEffect **out ); - HRESULT (*send_force_feedback_command)( IDirectInputDevice8W *iface, DWORD command ); + HRESULT (*send_force_feedback_command)( IDirectInputDevice8W *iface, DWORD command, BOOL unacquire ); HRESULT (*send_device_gain)( IDirectInputDevice8W *iface, LONG device_gain ); HRESULT (*enum_created_effect_objects)( IDirectInputDevice8W *iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, void *context, DWORD flags ); diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 0502362de2f..6cd537c5776 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -674,11 +674,11 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *filter, return DIENUM_CONTINUE; }
-static void set_parameter_value( struct hid_joystick_effect *impl, char *report_buf, - struct hid_value_caps *caps, LONG value ) +static void set_report_value( struct hid_joystick *impl, char *report_buf, + struct hid_value_caps *caps, LONG value ) { - ULONG report_len = impl->joystick->caps.OutputReportByteLength; - PHIDP_PREPARSED_DATA preparsed = impl->joystick->preparsed; + ULONG report_len = impl->caps.OutputReportByteLength; + PHIDP_PREPARSED_DATA preparsed = impl->preparsed; LONG log_min, log_max, phy_min, phy_max; NTSTATUS status;
@@ -819,9 +819,23 @@ static void set_extra_caps_range( struct hid_joystick *impl, const DIDEVICEOBJEC
static HRESULT hid_joystick_send_device_gain( IDirectInputDevice8W *iface, LONG device_gain ) { - FIXME( "iface %p stub!\n", iface ); + struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); + struct pid_device_gain *report = &impl->pid_device_gain; + ULONG report_len = impl->caps.OutputReportByteLength; + char *report_buf = impl->output_report_buf; + NTSTATUS status;
- return DIERR_UNSUPPORTED; + TRACE( "iface %p.\n", iface ); + + if (!report->id || !report->device_gain_caps) return DI_OK; + + status = HidP_InitializeReportForID( HidP_Output, report->id, impl->preparsed, report_buf, report_len ); + if (status != HIDP_STATUS_SUCCESS) return status; + + set_report_value( impl, report_buf, report->device_gain_caps, device_gain ); + + if (!WriteFile( impl->device, report_buf, report_len, NULL, NULL )) return DIERR_INPUTLOST; + return DI_OK; }
static HRESULT hid_joystick_set_property( IDirectInputDevice8W *iface, DWORD property, @@ -884,6 +898,8 @@ static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface ) return DI_OK; }
+static HRESULT hid_joystick_send_force_feedback_command( IDirectInputDevice8W *iface, DWORD command, BOOL unacquire ); + static HRESULT hid_joystick_unacquire( IDirectInputDevice8W *iface ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); @@ -895,7 +911,9 @@ static HRESULT hid_joystick_unacquire( IDirectInputDevice8W *iface ) if (!ret) WARN( "CancelIoEx failed, last error %u\n", GetLastError() ); else WaitForSingleObject( impl->base.read_event, INFINITE );
- IDirectInputDevice8_SendForceFeedbackCommand( iface, DISFFC_RESET ); + if (!(impl->base.caps.dwFlags & DIDC_FORCEFEEDBACK)) return DI_OK; + if (!impl->base.acquired || !(impl->base.dwCoopLevel & DISCL_EXCLUSIVE)) return DI_OK; + hid_joystick_send_force_feedback_command( iface, DISFFC_RESET, TRUE ); return DI_OK; }
@@ -1027,7 +1045,7 @@ static BOOL CALLBACK unload_effect_object( IDirectInputEffect *effect, void *con return DIENUM_CONTINUE; }
-static HRESULT hid_joystick_send_force_feedback_command( IDirectInputDevice8W *iface, DWORD command ) +static HRESULT hid_joystick_send_force_feedback_command( IDirectInputDevice8W *iface, DWORD command, BOOL unacquire ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); struct pid_control_report *report = &impl->pid_device_control; @@ -1060,6 +1078,8 @@ static HRESULT hid_joystick_send_force_feedback_command( IDirectInputDevice8W *i if (status != HIDP_STATUS_SUCCESS) return status;
if (!WriteFile( impl->device, report_buf, report_len, NULL, NULL )) return DIERR_INPUTLOST; + if (!unacquire) hid_joystick_send_device_gain( iface, impl->base.device_gain ); + return DI_OK; }
@@ -2655,6 +2675,12 @@ static HRESULT WINAPI hid_joystick_effect_GetEffectStatus( IDirectInputEffect *i return DIERR_UNSUPPORTED; }
+static void set_parameter_value( struct hid_joystick_effect *impl, char *report_buf, + struct hid_value_caps *caps, LONG value ) +{ + return set_report_value( impl->joystick, report_buf, caps, value ); +} + static void set_parameter_value_us( struct hid_joystick_effect *impl, char *report_buf, struct hid_value_caps *caps, LONG value ) { diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 9fec003f598..ac4b8023611 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -754,17 +754,8 @@ static BOOL sync_ioctl( HANDLE file, DWORD code, void *in_buf, DWORD in_len, voi if (!ret && GetLastError() == ERROR_IO_PENDING) { ret = GetOverlappedResultEx( file, &ovl, &out_len, timeout, TRUE ); - todo_wine_if( timeout != INFINITE ) ok( ret, "GetOverlappedResultEx returned %u\n", GetLastError() ); } - if (!ret && GetLastError() == ERROR_TIMEOUT) - { - ret = CancelIoEx( file, &ovl ); - ok( ret, "CancelIoEx returned %u\n", GetLastError() ); - ret = GetOverlappedResultEx( file, &ovl, &out_len, INFINITE, TRUE ); - ok( !ret, "GetOverlappedResultEx succeeded\n" ); - ok( GetLastError() == ERROR_OPERATION_ABORTED, "GetOverlappedResultEx returned %u\n", GetLastError() ); - } CloseHandle( ovl.hEvent );
if (ret_len) *ret_len = out_len; @@ -794,7 +785,6 @@ static void set_hid_expect_( int line, HANDLE file, struct hid_expect *expect, D static void wait_hid_expect_( int line, HANDLE file, DWORD timeout ) { BOOL ret = sync_ioctl( file, IOCTL_WINETEST_HID_WAIT_EXPECT, NULL, 0, NULL, 0, timeout ); - todo_wine ok( ret, "IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error %u\n", GetLastError() );
set_hid_expect( file, NULL, 0 ); @@ -5585,7 +5575,6 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO .report_id = 8, .report_len = 2, .report_buf = {8, 0x19}, - .todo = TRUE, }, }; struct hid_expect expect_reset[] = @@ -6948,7 +6937,6 @@ static void test_force_feedback_joystick( DWORD version ) .report_id = 8, .report_len = 2, .report_buf = {8, 0x19}, - .todo = TRUE, }, }; struct hid_expect expect_reset[] = @@ -6966,7 +6954,6 @@ static void test_force_feedback_joystick( DWORD version ) .report_id = 8, .report_len = 2, .report_buf = {8, 0x19}, - .todo = TRUE, }; struct hid_expect expect_set_device_gain_2 = { @@ -6974,7 +6961,6 @@ static void test_force_feedback_joystick( DWORD version ) .report_id = 8, .report_len = 2, .report_buf = {8, 0x33}, - .todo = TRUE, };
const DIDEVICEINSTANCEW expect_devinst =
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_sdl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 48d5ad85a2b..220e360d78f 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -482,9 +482,13 @@ static NTSTATUS sdl_device_physical_device_control(struct unix_device *iface, US
static NTSTATUS sdl_device_physical_device_set_gain(struct unix_device *iface, BYTE value) { - FIXME("iface %p, value %#x stub!\n", iface, value); + struct sdl_device *impl = impl_from_unix_device(iface);
- return STATUS_NOT_IMPLEMENTED; + TRACE("iface %p, value %#x.\n", iface, value); + + pSDL_HapticSetGain(impl->sdl_haptic, value * 100 / 255); + + return STATUS_SUCCESS; }
static NTSTATUS sdl_device_physical_effect_control(struct unix_device *iface, BYTE index,
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_udev.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 74cfe486a03..d7bbd5ba79d 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -926,9 +926,20 @@ static NTSTATUS lnxev_device_physical_device_control(struct unix_device *iface,
static NTSTATUS lnxev_device_physical_device_set_gain(struct unix_device *iface, BYTE value) { - FIXME("iface %p, value %#x stub!\n", iface, value); + struct lnxev_device *impl = lnxev_impl_from_unix_device(iface); + struct input_event ie = + { + .type = EV_FF, + .code = FF_GAIN, + .value = value * 100 / 255, + };
- return STATUS_NOT_IMPLEMENTED; + TRACE("iface %p, value %#x.\n", iface, value); + + if (write(impl->base.device_fd, &ie, sizeof(ie)) == -1) + WARN("write failed %d %s\n", errno, strerror(errno)); + + return STATUS_SUCCESS; }
static NTSTATUS lnxev_device_physical_effect_control(struct unix_device *iface, BYTE index, @@ -1102,8 +1113,8 @@ static const struct hid_device_vtbl lnxev_device_vtbl = lnxev_device_start, lnxev_device_stop, lnxev_device_haptics_start, - lnxev_device_physical_device_set_gain, lnxev_device_physical_device_control, + lnxev_device_physical_device_set_gain, lnxev_device_physical_effect_control, lnxev_device_physical_effect_update, };
Rémi Bernon rbernon@codeweavers.com writes:
This reverts commit a9b5bb326a1514e2c4185633ab34b22c9bbc9863.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
This first patch is only there so that the testbot can run the tests without failing spuriously. The change broke graphics drivers, although I don't know precisely how and it should probably be fixed instead of reverting it.
Yes, sorry about that. This should fix it: