Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2bae0cb5
Commit
2bae0cb5
authored
Dec 19, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Dec 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput/tests: Add a device count parameter to hid_device_(start|stop).
parent
15630ab4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
42 deletions
+42
-42
dinput_test.h
dlls/dinput/tests/dinput_test.h
+2
-2
force_feedback.c
dlls/dinput/tests/force_feedback.c
+6
-6
hid.c
dlls/dinput/tests/hid.c
+10
-10
hotplug.c
dlls/dinput/tests/hotplug.c
+4
-4
joystick8.c
dlls/dinput/tests/joystick8.c
+20
-20
No files found.
dlls/dinput/tests/dinput_test.h
View file @
2bae0cb5
...
...
@@ -54,8 +54,8 @@ extern HANDLE device_added, device_removed;
extern
HINSTANCE
instance
;
extern
BOOL
localized
;
/* object names get translated */
BOOL
hid_device_start
(
struct
hid_device_desc
*
desc
);
void
hid_device_stop
(
struct
hid_device_desc
*
desc
);
BOOL
hid_device_start
(
struct
hid_device_desc
*
desc
,
UINT
count
);
void
hid_device_stop
(
struct
hid_device_desc
*
desc
,
UINT
count
);
BOOL
bus_device_start
(
void
);
void
bus_device_stop
(
void
);
...
...
dlls/dinput/tests/force_feedback.c
View file @
2bae0cb5
...
...
@@ -2926,7 +2926,7 @@ static BOOL test_force_feedback_joystick( DWORD version )
memcpy
(
desc
.
report_descriptor_buf
,
report_descriptor
,
sizeof
(
report_descriptor
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
if
(
FAILED
(
hr
=
dinput_test_create_device
(
version
,
&
devinst
,
&
device
)))
goto
done
;
check_dinput_devices
(
version
,
&
devinst
);
...
...
@@ -3130,7 +3130,7 @@ static BOOL test_force_feedback_joystick( DWORD version )
CloseHandle
(
file
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
winetest_pop_context
();
...
...
@@ -4047,7 +4047,7 @@ static void test_device_managed_effect(void)
memcpy
(
desc
.
expect
,
expect_pool
,
sizeof
(
expect_pool
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
if
(
FAILED
(
hr
=
dinput_test_create_device
(
DIRECTINPUT_VERSION
,
&
devinst
,
&
device
)))
goto
done
;
hr
=
IDirectInputDevice8_GetProperty
(
device
,
DIPROP_GUIDANDPATH
,
&
prop_guid_path
.
diph
);
...
...
@@ -4456,7 +4456,7 @@ static void test_device_managed_effect(void)
CloseHandle
(
file
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
winetest_pop_context
();
}
...
...
@@ -5792,7 +5792,7 @@ static void test_windows_gaming_input(void)
memcpy
(
desc
.
expect
,
expect_init
,
sizeof
(
expect_init
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
ret
=
WaitForSingleObject
(
controller_added
.
event
,
5000
);
ok
(
!
ret
,
"WaitForSingleObject returned %#lx
\n
"
,
ret
);
CloseHandle
(
controller_added
.
event
);
...
...
@@ -6491,7 +6491,7 @@ static void test_windows_gaming_input(void)
IRawGameControllerStatics_Release
(
controller_statics
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
}
...
...
dlls/dinput/tests/hid.c
View file @
2bae0cb5
...
...
@@ -707,7 +707,7 @@ BOOL bus_device_start(void)
return
ret
||
GetLastError
()
==
ERROR_SERVICE_ALREADY_RUNNING
;
}
void
hid_device_stop
(
struct
hid_device_desc
*
desc
)
void
hid_device_stop
(
struct
hid_device_desc
*
desc
,
UINT
count
)
{
HANDLE
control
;
DWORD
ret
;
...
...
@@ -728,7 +728,7 @@ void hid_device_stop( struct hid_device_desc *desc )
}
}
BOOL
hid_device_start
(
struct
hid_device_desc
*
desc
)
BOOL
hid_device_start
(
struct
hid_device_desc
*
desc
,
UINT
count
)
{
HANDLE
control
;
DWORD
ret
;
...
...
@@ -3044,8 +3044,8 @@ static void test_hid_driver( DWORD report_id, DWORD polled )
memcpy
(
desc
.
input
,
&
expect_in
,
sizeof
(
expect_in
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
hid_device_start
(
&
desc
))
test_hid_device
(
report_id
,
polled
,
&
caps
,
desc
.
attributes
.
VendorID
,
desc
.
attributes
.
ProductID
);
hid_device_stop
(
&
desc
);
if
(
hid_device_start
(
&
desc
,
1
))
test_hid_device
(
report_id
,
polled
,
&
caps
,
desc
.
attributes
.
VendorID
,
desc
.
attributes
.
ProductID
);
hid_device_stop
(
&
desc
,
1
);
}
/* undocumented HID internal preparsed data structure */
...
...
@@ -3455,7 +3455,7 @@ static void test_hidp_kdr(void)
memcpy
(
desc
.
report_descriptor_buf
,
report_desc
,
sizeof
(
report_desc
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
swprintf
(
device_path
,
MAX_PATH
,
L"
\\\\
?
\\
hid#vid_%04x&pid_%04x"
,
desc
.
attributes
.
VendorID
,
desc
.
attributes
.
ProductID
);
...
...
@@ -3472,7 +3472,7 @@ static void test_hidp_kdr(void)
CloseHandle
(
file
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
}
void
cleanup_registry_keys
(
void
)
...
...
@@ -3766,10 +3766,10 @@ DWORD WINAPI dinput_test_device_thread( void *stop_event )
memcpy
(
desc
.
report_descriptor_buf
,
gamepad_desc
,
sizeof
(
gamepad_desc
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
hid_device_start
(
&
desc
);
hid_device_start
(
&
desc
,
1
);
ret
=
WaitForSingleObject
(
stop_event
,
5000
);
ok
(
!
ret
,
"WaitForSingleObject returned %#lx
\n
"
,
ret
);
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
return
0
;
}
...
...
@@ -4011,7 +4011,7 @@ static void test_hid_multiple_tlc(void)
memcpy
(
desc
.
report_descriptor_buf
,
report_desc
,
sizeof
(
report_desc
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
2
))
goto
done
;
swprintf
(
device_path
,
MAX_PATH
,
L"
\\\\
?
\\
hid#vid_%04x&pid_%04x&col01"
,
desc
.
attributes
.
VendorID
,
desc
.
attributes
.
ProductID
);
...
...
@@ -4045,7 +4045,7 @@ static void test_hid_multiple_tlc(void)
ok
(
!
ret
,
"Failed to find HID device matching %s
\n
"
,
debugstr_w
(
device_path
)
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
2
);
}
START_TEST
(
hid
)
...
...
dlls/dinput/tests/hotplug.c
View file @
2bae0cb5
...
...
@@ -168,7 +168,7 @@ static BOOL test_input_lost( DWORD version )
memcpy
(
desc
.
report_descriptor_buf
,
report_desc
,
sizeof
(
report_desc
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
if
(
FAILED
(
hr
=
dinput_test_create_device
(
version
,
&
devinst
,
&
device
)))
goto
done
;
hr
=
IDirectInputDevice8_SetDataFormat
(
device
,
&
c_dfDIJoystick2
);
...
...
@@ -188,7 +188,7 @@ static BOOL test_input_lost( DWORD version )
ok
(
hr
==
DI_OK
,
"GetDeviceData returned %#lx
\n
"
,
hr
);
ok
(
count
==
0
,
"got %lu expected 0
\n
"
,
count
);
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
hr
=
IDirectInputDevice8_GetDeviceState
(
device
,
sizeof
(
state
),
&
state
);
ok
(
hr
==
DIERR_INPUTLOST
,
"GetDeviceState returned %#lx
\n
"
,
hr
);
...
...
@@ -209,7 +209,7 @@ static BOOL test_input_lost( DWORD version )
ok
(
hr
==
DI_NOEFFECT
,
"Unacquire returned: %#lx
\n
"
,
hr
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
hid_device_start
(
&
desc
);
hid_device_start
(
&
desc
,
1
);
hr
=
IDirectInputDevice8_Acquire
(
device
);
ok
(
hr
==
S_OK
,
"Acquire returned %#lx
\n
"
,
hr
);
...
...
@@ -220,7 +220,7 @@ static BOOL test_input_lost( DWORD version )
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
winetest_pop_context
();
...
...
dlls/dinput/tests/joystick8.c
View file @
2bae0cb5
...
...
@@ -814,7 +814,7 @@ static void test_simple_joystick( DWORD version )
memcpy
(
desc
.
report_descriptor_buf
,
report_desc
,
sizeof
(
report_desc
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
if
(
FAILED
(
hr
=
dinput_test_create_device
(
version
,
&
devinst
,
&
device
)))
goto
done
;
check_dinput_devices
(
version
,
&
devinst
);
...
...
@@ -2064,7 +2064,7 @@ static void test_simple_joystick( DWORD version )
CloseHandle
(
file
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
winetest_pop_context
();
}
...
...
@@ -2566,7 +2566,7 @@ static BOOL test_device_types( DWORD version )
memcpy
(
desc
.
report_descriptor_buf
,
device_desc
[
i
].
report_desc_buf
,
device_desc
[
i
].
report_desc_len
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
if
(
!
hid_device_start
(
&
desc
,
1
))
{
success
=
FALSE
;
goto
done
;
...
...
@@ -2607,7 +2607,7 @@ static BOOL test_device_types( DWORD version )
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
winetest_pop_context
();
}
...
...
@@ -3036,7 +3036,7 @@ static void test_many_axes_joystick(void)
memcpy
(
desc
.
report_descriptor_buf
,
report_desc
,
sizeof
(
report_desc
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
if
(
FAILED
(
hr
=
dinput_test_create_device
(
DIRECTINPUT_VERSION
,
&
devinst
,
&
device
)))
goto
done
;
check_dinput_devices
(
DIRECTINPUT_VERSION
,
&
devinst
);
...
...
@@ -3133,7 +3133,7 @@ static void test_many_axes_joystick(void)
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
winetest_pop_context
();
}
...
...
@@ -3305,7 +3305,7 @@ static void test_driving_wheel_axes(void)
memcpy
(
desc
.
report_descriptor_buf
,
report_desc
,
sizeof
(
report_desc
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
if
(
FAILED
(
hr
=
dinput_test_create_device
(
DIRECTINPUT_VERSION
,
&
devinst
,
&
device
)))
goto
done
;
check_dinput_devices
(
DIRECTINPUT_VERSION
,
&
devinst
);
...
...
@@ -3353,7 +3353,7 @@ static void test_driving_wheel_axes(void)
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
winetest_pop_context
();
}
...
...
@@ -3541,7 +3541,7 @@ static BOOL test_winmm_joystick(void)
memcpy
(
desc
.
report_descriptor_buf
,
report_desc
,
sizeof
(
report_desc
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
ret
=
joyGetNumDevs
();
ok
(
ret
==
16
,
"joyGetNumDevs returned %u
\n
"
,
ret
);
...
...
@@ -3713,7 +3713,7 @@ static BOOL test_winmm_joystick(void)
CloseHandle
(
file
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
return
device
!=
NULL
;
...
...
@@ -3964,7 +3964,7 @@ static void test_windows_gaming_input(void)
memcpy
(
desc
.
report_descriptor_buf
,
report_desc
,
sizeof
(
report_desc
)
);
fill_context
(
desc
.
context
,
ARRAY_SIZE
(
desc
.
context
)
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
res
=
WaitForSingleObject
(
controller_added
.
event
,
5000
);
ok
(
!
res
,
"WaitForSingleObject returned %#lx
\n
"
,
res
);
CloseHandle
(
controller_added
.
event
);
...
...
@@ -4033,7 +4033,7 @@ static void test_windows_gaming_input(void)
hr
=
IRawGameControllerStatics_remove_RawGameControllerAdded
(
controller_statics
,
controller_added_token
);
ok
(
hr
==
S_OK
,
"remove_RawGameControllerAdded returned %#lx
\n
"
,
hr
);
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
desc
.
report_descriptor_len
=
sizeof
(
wheel_threepedals_desc
);
...
...
@@ -4048,7 +4048,7 @@ static void test_windows_gaming_input(void)
ok
(
hr
==
S_OK
,
"add_RawGameControllerAdded returned %#lx
\n
"
,
hr
);
ok
(
controller_added_token
.
value
,
"got token %I64u
\n
"
,
controller_added_token
.
value
);
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
res
=
WaitForSingleObject
(
controller_added
.
event
,
5000
);
ok
(
!
res
,
"WaitForSingleObject returned %#lx
\n
"
,
res
);
CloseHandle
(
controller_added
.
event
);
...
...
@@ -4098,7 +4098,7 @@ static void test_windows_gaming_input(void)
IRawGameControllerStatics_Release
(
controller_statics
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
}
...
...
@@ -4258,7 +4258,7 @@ static void test_rawinput(void)
ok
(
count
==
ARRAY_SIZE
(
raw_device_list
),
"got count %u
\n
"
,
count
);
device_count
=
res
;
if
(
!
hid_device_start
(
&
desc
))
goto
done
;
if
(
!
hid_device_start
(
&
desc
,
1
))
goto
done
;
count
=
ARRAY_SIZE
(
raw_devices
);
res
=
GetRegisteredRawInputDevices
(
raw_devices
,
&
count
,
sizeof
(
RAWINPUTDEVICE
)
);
...
...
@@ -4281,7 +4281,7 @@ static void test_rawinput(void)
ret
=
RegisterRawInputDevices
(
raw_devices
,
1
,
sizeof
(
RAWINPUTDEVICE
)
);
ok
(
ret
,
"RegisterRawInputDevices failed, error %lu
\n
"
,
GetLastError
()
);
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
res
=
msg_wait_for_events
(
1
,
&
rawinput_device_added
,
10
);
ok
(
res
==
WAIT_TIMEOUT
,
"WaitForSingleObject returned %#lx
\n
"
,
res
);
...
...
@@ -4298,7 +4298,7 @@ static void test_rawinput(void)
ret
=
RegisterRawInputDevices
(
raw_devices
,
1
,
sizeof
(
RAWINPUTDEVICE
)
);
ok
(
ret
,
"RegisterRawInputDevices failed, error %lu
\n
"
,
GetLastError
()
);
hid_device_start
(
&
desc
);
hid_device_start
(
&
desc
,
1
);
res
=
msg_wait_for_events
(
1
,
&
rawinput_device_added
,
1000
);
ok
(
!
res
,
"WaitForSingleObject returned %#lx
\n
"
,
res
);
...
...
@@ -4318,8 +4318,8 @@ static void test_rawinput(void)
ret
=
RegisterRawInputDevices
(
raw_devices
,
1
,
sizeof
(
RAWINPUTDEVICE
)
);
ok
(
ret
,
"RegisterRawInputDevices failed, error %lu
\n
"
,
GetLastError
()
);
hid_device_stop
(
&
desc
);
hid_device_start
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
hid_device_start
(
&
desc
,
1
);
res
=
msg_wait_for_events
(
1
,
&
rawinput_device_added
,
10
);
ok
(
res
==
WAIT_TIMEOUT
,
"WaitForSingleObject returned %#lx
\n
"
,
res
);
...
...
@@ -4392,7 +4392,7 @@ static void test_rawinput(void)
CloseHandle
(
file
);
done:
hid_device_stop
(
&
desc
);
hid_device_stop
(
&
desc
,
1
);
cleanup_registry_keys
();
DestroyWindow
(
hwnd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment