@@ -203,6 +203,32 @@ def scale_to_8bit(value, axes_dict, axis_key):
203
203
"XB1_DPY" :"ABS_HAT0Y" ,
204
204
}
205
205
206
+ ps5_to_linux_ev_code_dict = {
207
+ "PS5_CROSS" :"BTN_EAST" ,
208
+ "PS5_CIRCLE" :"BTN_C" ,
209
+ "PS5_SQUARE" :"BTN_SOUTH" ,
210
+ "PS5_TRIANGLE" :"BTN_NORTH" ,
211
+ "PS5_L1" :"BTN_WEST" ,
212
+ "PS5_R1" :"BTN_Z" ,
213
+ "PS5_CREATE" :"BTN_TL2" ,
214
+ "PS5_OPTION" :"BTN_TR2" ,
215
+ "PS5_LOGO" :"BTN_MODE" ,
216
+ "PS5_L2_BUTTON" :"BTN_TL" ,
217
+ "PS5_R2_BUTTON" :"BTN_TR" ,
218
+ "PS5_MUTE" :"BTN_THUMBR" ,
219
+ "PS5_TOUCHPAD_BUTTON" :"BTN_THUMBL" ,
220
+ "PS5_LSB" :"BTN_SELECT" ,
221
+ "PS5_RSB" :"BTN_START" ,
222
+ "PS5_LSX" :"ABS_X" ,
223
+ "PS5_LSY" :"ABS_Y" ,
224
+ "PS5_RSX" :"ABS_Z" ,
225
+ "PS5_RSY" :"ABS_RZ" ,
226
+ "PS5_L2_ANALOG" :"ABS_RX" ,
227
+ "PS5_R2_ANALOG" :"ABS_RY" ,
228
+ "PS5_DPX" :"ABS_HAT0X" ,
229
+ "PS5_DPY" :"ABS_HAT0Y" ,
230
+ }
231
+
206
232
def translate_dict (old_mapping_dict , lookup_dict ):
207
233
translated_map_dict = dict (old_mapping_dict )
208
234
for key in old_mapping_dict :
@@ -267,6 +293,8 @@ def find_keycode_in_mapping(source_code, mapping_dict, usb_gamepad_type):
267
293
return None , None
268
294
if usb_gamepad_type == "Xbox" :
269
295
map_dict_copy = translate_dict (map_dict_copy , xbox_one_to_linux_ev_code_dict )
296
+ if usb_gamepad_type == "PlayStation" :
297
+ map_dict_copy = translate_dict (map_dict_copy , ps5_to_linux_ev_code_dict )
270
298
target_info = None
271
299
for item in source_name :
272
300
if item in map_dict_copy :
0 commit comments