@@ -281,6 +281,8 @@ struct ally_gamepad_cfg {
281281 /* deadzones */
282282 struct deadzone ls_dz ; // left stick
283283 struct deadzone rs_dz ; // right stick
284+ struct deadzone lt_dz ; // left trigger
285+ struct deadzone rt_dz ; // right trigger
284286};
285287
286288/* The hatswitch outputs integers, we use them to index this X|Y pair */
@@ -571,7 +573,20 @@ static ssize_t _gamepad_apply_deadzones(struct hid_device *hdev,
571573 hidbuf [7 ] = ally_cfg -> rs_dz .outer ;
572574
573575 ret = asus_dev_set_report (hdev , hidbuf , FEATURE_ROG_ALLY_REPORT_SIZE );
576+ if (ret < 0 )
577+ goto end ;
578+
579+ hidbuf [2 ] = xpad_cmd_set_tr_dz ;
580+ hidbuf [4 ] = ally_cfg -> lt_dz .inner ;
581+ hidbuf [5 ] = ally_cfg -> lt_dz .outer ;
582+ hidbuf [6 ] = ally_cfg -> rt_dz .inner ;
583+ hidbuf [7 ] = ally_cfg -> rt_dz .outer ;
584+
585+ ret = asus_dev_set_report (hdev , hidbuf , FEATURE_ROG_ALLY_REPORT_SIZE );
586+ if (ret < 0 )
587+ goto end ;
574588
589+ end :
575590 kfree (hidbuf );
576591 return ret ;
577592}
@@ -582,6 +597,10 @@ static void _gamepad_set_deadzones_default(struct ally_gamepad_cfg *ally_cfg)
582597 ally_cfg -> ls_dz .outer = 0x64 ;
583598 ally_cfg -> rs_dz .inner = 0x00 ;
584599 ally_cfg -> rs_dz .outer = 0x64 ;
600+ ally_cfg -> lt_dz .inner = 0x00 ;
601+ ally_cfg -> lt_dz .outer = 0x64 ;
602+ ally_cfg -> rt_dz .inner = 0x00 ;
603+ ally_cfg -> rt_dz .outer = 0x64 ;
585604}
586605
587606static ssize_t axis_xyz_deadzone_index_show (struct device * dev , struct device_attribute * attr ,
@@ -594,6 +613,8 @@ ALLY_DEVICE_ATTR_RO(axis_xyz_deadzone_index, deadzone_index);
594613
595614ALLY_DEADZONES (axis_xy_left , ls_dz );
596615ALLY_DEADZONES (axis_xy_right , rs_dz );
616+ ALLY_DEADZONES (axis_z_left , lt_dz );
617+ ALLY_DEADZONES (axis_z_right , rt_dz );
597618
598619static struct attribute * axis_xy_left_attrs [] = {
599620 & dev_attr_axis_xy_left_deadzone .attr ,
@@ -615,6 +636,26 @@ static const struct attribute_group axis_xy_right_attr_group = {
615636 .attrs = axis_xy_right_attrs ,
616637};
617638
639+ static struct attribute * axis_z_left_attrs [] = {
640+ & dev_attr_axis_z_left_deadzone .attr ,
641+ & dev_attr_axis_xyz_deadzone_index .attr ,
642+ NULL ,
643+ };
644+ static const struct attribute_group axis_z_left_attr_group = {
645+ .name = "axis_z_left" ,
646+ .attrs = axis_z_left_attrs ,
647+ };
648+
649+ static struct attribute * axis_z_right_attrs [] = {
650+ & dev_attr_axis_z_right_deadzone .attr ,
651+ & dev_attr_axis_xyz_deadzone_index .attr ,
652+ NULL ,
653+ };
654+ static const struct attribute_group axis_z_right_attr_group = {
655+ .name = "axis_z_right" ,
656+ .attrs = axis_z_right_attrs ,
657+ };
658+
618659/* A HID packet conatins mappings for two buttons: btn1, btn1_macro, btn2, btn2_macro */
619660static void _btn_pair_to_hid_pkt (struct ally_gamepad_cfg * ally_cfg ,
620661 enum btn_pair_index pair ,
@@ -958,6 +999,8 @@ static const struct attribute_group *gamepad_device_attr_groups[] = {
958999 & ally_controller_attr_group ,
9591000 & axis_xy_left_attr_group ,
9601001 & axis_xy_right_attr_group ,
1002+ & axis_z_left_attr_group ,
1003+ & axis_z_right_attr_group ,
9611004 & btn_mapping_m1_attr_group ,
9621005 & btn_mapping_m2_attr_group ,
9631006 & btn_mapping_a_attr_group ,
0 commit comments