Skip to content

Commit fa41a04

Browse files
committed
xpadneo, mouse: Support toggling mouse mode
This adds a flag to toggle mouse mode by pressing Guide+Select. Signed-off-by: Kai Krakow <[email protected]>
1 parent eb8516e commit fa41a04

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

hid-xpadneo/src/hid-xpadneo.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,20 @@ static u8 *xpadneo_report_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int
747747
return rdesc;
748748
}
749749

750+
static void xpadneo_toggle_mouse(struct xpadneo_devdata *xdata)
751+
{
752+
if (xdata->mouse_mode) {
753+
xdata->mouse_mode = false;
754+
hid_info(xdata->hdev, "mouse mode disabled\n");
755+
} else {
756+
xdata->mouse_mode = true;
757+
hid_info(xdata->hdev, "mouse mode enabled\n");
758+
}
759+
760+
/* Indicate that a request was made */
761+
xdata->profile_switched = true;
762+
}
763+
750764
static void xpadneo_switch_profile(struct xpadneo_devdata *xdata, const u8 profile,
751765
const bool emulated)
752766
{
@@ -1035,6 +1049,10 @@ static int xpadneo_event(struct hid_device *hdev, struct hid_field *field,
10351049
if (value == 1)
10361050
xpadneo_switch_profile(xdata, 3, true);
10371051
goto stop_processing;
1052+
case BTN_SELECT:
1053+
if (value == 1)
1054+
xpadneo_toggle_mouse(xdata);
1055+
goto stop_processing;
10381056
}
10391057
}
10401058
}

hid-xpadneo/src/xpadneo.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ struct xpadneo_devdata {
136136
bool xbox_button_down, profile_switched;
137137
u8 profile;
138138

139+
/* mouse mode */
140+
bool mouse_mode;
141+
139142
/* trigger scale */
140143
struct {
141144
u8 left, right;

0 commit comments

Comments
 (0)