Skip to content

Commit

Permalink
Add raw multitouch as default profile
Browse files Browse the repository at this point in the history
  • Loading branch information
aus4000 authored and cj360 committed Jan 16, 2020
1 parent 01aa864 commit 523aed2
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ds4drv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
##
# Controller settings
#
# This is the default profile for each controller.
# This is the default profile for each controller. It is created before the other profiles as "default".
# Multiple controllers slots are defined by increasing the number.
#
# Controller sections contain:
Expand Down
6 changes: 5 additions & 1 deletion ds4drv/actions/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
ReportAction.add_option("--emulate-xpad-wireless", action="store_true",
help="Emulates the same joystick layout as a wireless "
"Xbox 360 controller used via the xpad module")
ReportAction.add_option("--emulate-kernel", action="store_true",
help="Emulates the same joystick layout as the default kernel driver.")
ReportAction.add_option("--ignored-buttons", metavar="button(s)",
type=buttoncombo(","), default=[],
help="A comma-separated list of buttons to never send "
Expand Down Expand Up @@ -72,8 +74,10 @@ def load_options(self, options):
joystick_layout = "xpad"
elif options.emulate_xpad_wireless:
joystick_layout = "xpad_wireless"
else:
elif options.emulate_kernel:
joystick_layout = "ds4"
else:
joystick_layout = "ds4drv"

if not self.mouse and options.trackpad_mouse:
self.mouse = create_uinput_device("mouse")
Expand Down
54 changes: 54 additions & 0 deletions ds4drv/uinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,57 @@ def create_mapping(name, description, bustype=0, vendor=0, product=0,


# Pre-configued mappings
create_mapping(
"ds4drv", "Sony Computer Entertainment Wireless Controller (Userspace)",
# Bus type, vendor, product, version
ecodes.BUS_USB, 1356, 1476, 273,
# Axes
{
"ABS_X": "left_analog_x",
"ABS_Y": "left_analog_y",
"ABS_RX": "right_analog_x",
"ABS_RY": "right_analog_y",
"ABS_Z": "l2_analog",
"ABS_RZ": "r2_analog",
"ABS_THROTTLE": "orientation_roll",
"ABS_RUDDER": "orientation_pitch",
"ABS_WHEEL": "orientation_yaw",
"ABS_DISTANCE": "motion_z",
"ABS_TILT_X": "motion_x",
"ABS_TILT_Y": "motion_y",
},
# Axes options
{
"ABS_THROTTLE": (-16385, 16384, 0, 0),
"ABS_RUDDER": (-16385, 16384, 0, 0),
"ABS_WHEEL": (-16385, 16384, 0, 0),
"ABS_DISTANCE": (-32768, 32767, 0, 10),
"ABS_TILT_X": (-32768, 32767, 0, 10),
"ABS_TILT_Y": (-32768, 32767, 0, 10),
},
# Buttons
{
"BTN_START": "button_options",
"BTN_MODE": "button_ps",
"BTN_SELECT": "button_share",
"BTN_A": "button_cross",
"BTN_B": "button_circle",
"BTN_X": "button_square",
"BTN_Y": "button_triangle",
"BTN_TL": "button_l1",
"BTN_TR": "button_r1",
"BTN_THUMBL": "button_l3",
"BTN_THUMBR": "button_r3",
},

# Hats
{
"ABS_HAT0X": ("dpad_left", "dpad_right"),
"ABS_HAT0Y": ("dpad_up", "dpad_down")
},
)

# Emulate the way the kernel does it
create_mapping(
"ds4", "Sony Computer Entertainment Wireless Controller",
# Bus type, vendor, product, version
Expand Down Expand Up @@ -112,6 +163,7 @@ def create_mapping(name, description, bustype=0, vendor=0, product=0,
}
)

# Emulate xboxdrv's button assignments.
create_mapping(
"xboxdrv", "Xbox Gamepad (userspace driver)",
# Bus type, vendor, product, version
Expand Down Expand Up @@ -148,6 +200,7 @@ def create_mapping(name, description, bustype=0, vendor=0, product=0,
}
)

# Emulate the way the kernel does Xbox 360/Xbone controllers with xpad
create_mapping(
"xpad", "Microsoft X-Box 360 pad",
# Bus type, vendor, product, version
Expand Down Expand Up @@ -184,6 +237,7 @@ def create_mapping(name, description, bustype=0, vendor=0, product=0,
}
)

# Emulate the way the kernel does Xbox 360 Wireless controllers with xpad
create_mapping(
"xpad_wireless", "Xbox 360 Wireless Receiver",
# Bus type, vendor, product, version
Expand Down

0 comments on commit 523aed2

Please sign in to comment.