tests_kernel.test_gamepad module
- class AsusGamepad(rdesc=[5, 1, 9, 5, 161, 1, 133, 1, 5, 9, 10, 1, 0, 10, 2, 0, 10, 4, 0, 10, 5, 0, 10, 7, 0, 10, 8, 0, 10, 14, 0, 10, 15, 0, 10, 13, 0, 5, 12, 10, 36, 2, 10, 35, 2, 21, 0, 37, 1, 117, 1, 149, 11, 129, 2, 117, 1, 149, 1, 129, 3, 5, 1, 117, 4, 149, 1, 37, 7, 70, 59, 1, 102, 20, 0, 9, 57, 129, 66, 102, 0, 0, 9, 1, 161, 0, 9, 48, 9, 49, 9, 50, 9, 53, 5, 2, 9, 197, 9, 196, 21, 0, 38, 255, 0, 53, 0, 70, 255, 0, 117, 8, 149, 6, 129, 2, 192, 133, 2, 5, 8, 10, 1, 0, 10, 2, 0, 10, 3, 0, 10, 4, 0, 21, 0, 37, 1, 117, 1, 149, 4, 145, 2, 117, 4, 149, 1, 145, 3, 192, 5, 12, 9, 1, 161, 1, 133, 3, 5, 1, 9, 6, 161, 2, 5, 6, 9, 32, 21, 0, 38, 255, 0, 117, 8, 149, 1, 129, 2, 6, 188, 255, 10, 173, 189, 117, 8, 149, 6, 129, 2, 192, 192], name=None)
Bases:
UHIDTestGamepad- report_descriptor = [5, 1, 9, 5, 161, 1, 133, 1, 5, 9, 10, 1, 0, 10, 2, 0, 10, 4, 0, 10, 5, 0, 10, 7, 0, 10, 8, 0, 10, 14, 0, 10, 15, 0, 10, 13, 0, 5, 12, 10, 36, 2, 10, 35, 2, 21, 0, 37, 1, 117, 1, 149, 11, 129, 2, 117, 1, 149, 1, 129, 3, 5, 1, 117, 4, 149, 1, 37, 7, 70, 59, 1, 102, 20, 0, 9, 57, 129, 66, 102, 0, 0, 9, 1, 161, 0, 9, 48, 9, 49, 9, 50, 9, 53, 5, 2, 9, 197, 9, 196, 21, 0, 38, 255, 0, 53, 0, 70, 255, 0, 117, 8, 149, 6, 129, 2, 192, 133, 2, 5, 8, 10, 1, 0, 10, 2, 0, 10, 3, 0, 10, 4, 0, 21, 0, 37, 1, 117, 1, 149, 4, 145, 2, 117, 4, 149, 1, 145, 3, 192, 5, 12, 9, 1, 161, 1, 133, 3, 5, 1, 9, 6, 161, 2, 5, 6, 9, 32, 21, 0, 38, 255, 0, 117, 8, 149, 1, 129, 2, 6, 188, 255, 10, 173, 189, 117, 8, 149, 6, 129, 2, 192, 192]
- class BaseTest
Bases:
object- class TestGamepad
Bases:
TestUhid- assert_button(button)
- send_initial_state()
send an empty report to initialize the axes
- test_buttons()
check for button reliability.
- test_dual_buttons()
check for button reliability when pressing 2 buttons
- test_hat_switch(hat_value, expected_evdev, evdev_value)
- test_left_joystick_press_down()
check for the left joystick reliability
- test_left_joystick_press_left()
check for the left joystick reliability
- test_left_joystick_press_right()
check for the left joystick reliability
- test_left_joystick_press_up()
check for the left joystick reliability
- test_right_joystick_press_down()
check for the right joystick reliability
- test_right_joystick_press_left()
check for the right joystick reliability
- test_right_joystick_press_right()
check for the right joystick reliability
- test_right_joystick_press_up()
check for the right joystick reliability
- class RaptorMach2Joystick(name, rdesc=None, application='Joystick', input_info=(BusType.USB, 4544, 22022))
Bases:
UHIDTestJoystickGamepad- axes_map = {'left_stick': {'x': <hidtools.device.base_gamepad.AxisMapping object>, 'y': <hidtools.device.base_gamepad.AxisMapping object>}, 'right_stick': {'x': <hidtools.device.base_gamepad.AxisMapping object>, 'y': <hidtools.device.base_gamepad.AxisMapping object>}}
- event(*, left=(None, None), right=(None, None), hat_switch=None, buttons=None)
Send an input event on the default report ID.
- Parameters:
left – a tuple of absolute (x, y) value of the left joypad where
Noneis “leave unchanged”right – a tuple of absolute (x, y) value of the right joypad where
Noneis “leave unchanged”hat_switch – an absolute angular value of the hat switch where
Noneis “leave unchanged”buttons – a dict of index/bool for the button states, where
Noneis “leave unchanged”
- class SaitekGamepad(rdesc=[5, 1, 9, 4, 161, 1, 9, 1, 161, 0, 133, 1, 9, 48, 21, 0, 38, 255, 0, 53, 0, 70, 255, 0, 117, 8, 149, 1, 129, 2, 9, 49, 129, 2, 5, 2, 9, 186, 129, 2, 9, 187, 129, 2, 5, 9, 25, 1, 41, 12, 37, 1, 69, 1, 117, 1, 149, 12, 129, 2, 149, 1, 117, 0, 129, 3, 5, 1, 9, 57, 37, 7, 70, 59, 1, 85, 0, 101, 68, 117, 4, 129, 66, 101, 0, 192, 5, 15, 9, 146, 161, 2, 133, 2, 9, 160, 9, 159, 37, 1, 69, 0, 117, 1, 149, 2, 129, 2, 117, 6, 149, 1, 129, 3, 9, 34, 117, 7, 37, 127, 129, 2, 9, 148, 117, 1, 37, 1, 129, 2, 192, 9, 33, 161, 2, 133, 11, 9, 34, 38, 255, 0, 117, 8, 145, 2, 9, 83, 37, 10, 145, 2, 9, 80, 39, 254, 255, 0, 0, 71, 254, 255, 0, 0, 117, 16, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 9, 84, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 9, 167, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 192, 9, 90, 161, 2, 133, 12, 9, 34, 38, 255, 0, 69, 0, 117, 8, 145, 2, 9, 92, 38, 16, 39, 70, 16, 39, 117, 16, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 9, 91, 37, 127, 117, 8, 145, 2, 9, 94, 38, 16, 39, 117, 16, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 9, 93, 37, 127, 117, 8, 145, 2, 192, 9, 115, 161, 2, 133, 13, 9, 34, 38, 255, 0, 69, 0, 145, 2, 9, 112, 21, 129, 37, 127, 54, 240, 216, 70, 16, 39, 145, 2, 192, 9, 110, 161, 2, 133, 14, 9, 34, 21, 0, 38, 255, 0, 53, 0, 69, 0, 145, 2, 9, 112, 37, 127, 70, 16, 39, 145, 2, 9, 111, 21, 129, 54, 240, 216, 145, 2, 9, 113, 21, 0, 38, 255, 0, 53, 0, 70, 104, 1, 145, 2, 9, 114, 117, 16, 38, 16, 39, 70, 16, 39, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 192, 9, 119, 161, 2, 133, 81, 9, 34, 37, 127, 69, 0, 117, 8, 145, 2, 9, 120, 161, 2, 9, 123, 9, 121, 9, 122, 21, 1, 37, 3, 145, 0, 192, 9, 124, 21, 0, 38, 254, 0, 145, 2, 192, 9, 146, 161, 2, 133, 82, 9, 150, 161, 2, 9, 154, 9, 153, 9, 151, 9, 152, 9, 155, 9, 156, 21, 1, 37, 6, 145, 0, 192, 192, 5, 255, 10, 1, 3, 161, 2, 133, 64, 10, 2, 3, 161, 2, 26, 17, 3, 42, 32, 3, 37, 16, 145, 0, 192, 10, 3, 3, 21, 0, 39, 255, 255, 0, 0, 117, 16, 145, 2, 192, 5, 15, 9, 125, 161, 2, 133, 67, 9, 126, 38, 128, 0, 70, 16, 39, 117, 8, 145, 2, 192, 9, 127, 161, 2, 133, 11, 9, 128, 38, 255, 127, 69, 0, 117, 15, 177, 3, 9, 169, 37, 1, 117, 1, 177, 3, 9, 131, 38, 255, 0, 117, 8, 177, 3, 192, 9, 171, 161, 3, 133, 21, 9, 37, 161, 2, 9, 38, 9, 48, 9, 50, 9, 49, 9, 51, 9, 52, 21, 1, 37, 6, 177, 0, 192, 192, 9, 137, 161, 3, 133, 22, 9, 139, 161, 2, 9, 140, 9, 141, 9, 142, 37, 3, 177, 0, 192, 9, 34, 21, 0, 38, 254, 0, 177, 2, 192, 9, 144, 161, 3, 133, 80, 9, 34, 38, 255, 0, 145, 2, 192, 192], name=None)
Bases:
UHIDTestJoystickGamepad- report_descriptor = [5, 1, 9, 4, 161, 1, 9, 1, 161, 0, 133, 1, 9, 48, 21, 0, 38, 255, 0, 53, 0, 70, 255, 0, 117, 8, 149, 1, 129, 2, 9, 49, 129, 2, 5, 2, 9, 186, 129, 2, 9, 187, 129, 2, 5, 9, 25, 1, 41, 12, 37, 1, 69, 1, 117, 1, 149, 12, 129, 2, 149, 1, 117, 0, 129, 3, 5, 1, 9, 57, 37, 7, 70, 59, 1, 85, 0, 101, 68, 117, 4, 129, 66, 101, 0, 192, 5, 15, 9, 146, 161, 2, 133, 2, 9, 160, 9, 159, 37, 1, 69, 0, 117, 1, 149, 2, 129, 2, 117, 6, 149, 1, 129, 3, 9, 34, 117, 7, 37, 127, 129, 2, 9, 148, 117, 1, 37, 1, 129, 2, 192, 9, 33, 161, 2, 133, 11, 9, 34, 38, 255, 0, 117, 8, 145, 2, 9, 83, 37, 10, 145, 2, 9, 80, 39, 254, 255, 0, 0, 71, 254, 255, 0, 0, 117, 16, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 9, 84, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 9, 167, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 192, 9, 90, 161, 2, 133, 12, 9, 34, 38, 255, 0, 69, 0, 117, 8, 145, 2, 9, 92, 38, 16, 39, 70, 16, 39, 117, 16, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 9, 91, 37, 127, 117, 8, 145, 2, 9, 94, 38, 16, 39, 117, 16, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 9, 93, 37, 127, 117, 8, 145, 2, 192, 9, 115, 161, 2, 133, 13, 9, 34, 38, 255, 0, 69, 0, 145, 2, 9, 112, 21, 129, 37, 127, 54, 240, 216, 70, 16, 39, 145, 2, 192, 9, 110, 161, 2, 133, 14, 9, 34, 21, 0, 38, 255, 0, 53, 0, 69, 0, 145, 2, 9, 112, 37, 127, 70, 16, 39, 145, 2, 9, 111, 21, 129, 54, 240, 216, 145, 2, 9, 113, 21, 0, 38, 255, 0, 53, 0, 70, 104, 1, 145, 2, 9, 114, 117, 16, 38, 16, 39, 70, 16, 39, 85, 253, 102, 1, 16, 145, 2, 85, 0, 101, 0, 192, 9, 119, 161, 2, 133, 81, 9, 34, 37, 127, 69, 0, 117, 8, 145, 2, 9, 120, 161, 2, 9, 123, 9, 121, 9, 122, 21, 1, 37, 3, 145, 0, 192, 9, 124, 21, 0, 38, 254, 0, 145, 2, 192, 9, 146, 161, 2, 133, 82, 9, 150, 161, 2, 9, 154, 9, 153, 9, 151, 9, 152, 9, 155, 9, 156, 21, 1, 37, 6, 145, 0, 192, 192, 5, 255, 10, 1, 3, 161, 2, 133, 64, 10, 2, 3, 161, 2, 26, 17, 3, 42, 32, 3, 37, 16, 145, 0, 192, 10, 3, 3, 21, 0, 39, 255, 255, 0, 0, 117, 16, 145, 2, 192, 5, 15, 9, 125, 161, 2, 133, 67, 9, 126, 38, 128, 0, 70, 16, 39, 117, 8, 145, 2, 192, 9, 127, 161, 2, 133, 11, 9, 128, 38, 255, 127, 69, 0, 117, 15, 177, 3, 9, 169, 37, 1, 117, 1, 177, 3, 9, 131, 38, 255, 0, 117, 8, 177, 3, 192, 9, 171, 161, 3, 133, 21, 9, 37, 161, 2, 9, 38, 9, 48, 9, 50, 9, 49, 9, 51, 9, 52, 21, 1, 37, 6, 177, 0, 192, 192, 9, 137, 161, 3, 133, 22, 9, 139, 161, 2, 9, 140, 9, 141, 9, 142, 37, 3, 177, 0, 192, 9, 34, 21, 0, 38, 254, 0, 177, 2, 192, 9, 144, 161, 3, 133, 80, 9, 34, 38, 255, 0, 145, 2, 192, 192]
- class TestAsusGamepad
Bases:
TestGamepad- create_device()
- class TestRaptorMach2Joystick
Bases:
TestGamepad- create_device()
- class TestSaitekGamepad
Bases:
TestGamepad- create_device()