Skip to content

Commit cdea040

Browse files
committed
xpadneo, consumer: Move buttons to keyboard device
Signed-off-by: Kai Krakow <kai@kaishome.de>
1 parent ef38514 commit cdea040

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

hid-xpadneo/src/hid-xpadneo.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ static int xpadneo_input_configured(struct hid_device *hdev, struct hid_input *h
865865
/* combine triggers to form a rudder, use ABS_MISC to order after dpad */
866866
input_set_abs_params(xdata->gamepad, ABS_MISC, -1023, 1023, 3, 63);
867867

868-
/* do not report the consumer control buttons as part of the gamepad */
868+
/* do not report the keyboard buttons as part of the gamepad */
869869
__clear_bit(BTN_XBOX, xdata->gamepad->keybit);
870870
__clear_bit(BTN_SHARE, xdata->gamepad->keybit);
871871

@@ -884,7 +884,7 @@ static int xpadneo_event(struct hid_device *hdev, struct hid_field *field,
884884
{
885885
struct xpadneo_devdata *xdata = hid_get_drvdata(hdev);
886886
struct input_dev *gamepad = xdata->gamepad;
887-
struct input_dev *consumer = xdata->consumer;
887+
struct input_dev *keyboard = xdata->keyboard;
888888

889889
if ((usage->type == EV_KEY) && (usage->code == BTN_PADDLES(0))) {
890890
if (gamepad && xdata->profile == 0) {
@@ -929,24 +929,24 @@ static int xpadneo_event(struct hid_device *hdev, struct hid_field *field,
929929
xdata->xbox_button_down = false;
930930
if (xdata->profile_switched) {
931931
xdata->profile_switched = false;
932-
} else if (consumer) {
932+
} else if (keyboard) {
933933
/* replay cached event */
934-
input_report_key(consumer, BTN_XBOX, 1);
935-
input_sync(consumer);
934+
input_report_key(keyboard, BTN_XBOX, 1);
935+
input_sync(keyboard);
936936
/* synthesize the release to remove the scan code */
937-
input_report_key(consumer, BTN_XBOX, 0);
938-
input_sync(consumer);
937+
input_report_key(keyboard, BTN_XBOX, 0);
938+
input_sync(keyboard);
939939
}
940940
}
941-
if (!consumer)
942-
goto consumer_missing;
941+
if (!keyboard)
942+
goto keyboard_missing;
943943
goto stop_processing;
944944
} else if ((usage->type == EV_KEY) && (usage->code == BTN_SHARE)) {
945-
/* move the Share button to the consumer control device */
946-
if (!consumer)
947-
goto consumer_missing;
948-
input_report_key(consumer, BTN_SHARE, value);
949-
input_sync(consumer);
945+
/* move the Share button to the keyboard device */
946+
if (!keyboard)
947+
goto keyboard_missing;
948+
input_report_key(keyboard, BTN_SHARE, value);
949+
input_sync(keyboard);
950950
goto stop_processing;
951951
} else if (xdata->xbox_button_down && (usage->type == EV_KEY)) {
952952
if (!(xdata->quirks & XPADNEO_QUIRK_USE_HW_PROFILES)) {
@@ -985,10 +985,10 @@ static int xpadneo_event(struct hid_device *hdev, struct hid_field *field,
985985
}
986986
return 0;
987987

988-
consumer_missing:
989-
if ((xdata->missing_reported && XPADNEO_MISSING_CONSUMER) == 0) {
990-
xdata->missing_reported |= XPADNEO_MISSING_CONSUMER;
991-
hid_err(hdev, "consumer control not detected\n");
988+
keyboard_missing:
989+
if ((xdata->missing_reported && XPADNEO_MISSING_KEYBOARD) == 0) {
990+
xdata->missing_reported |= XPADNEO_MISSING_KEYBOARD;
991+
hid_err(hdev, "keyboard not detected\n");
992992
}
993993

994994
stop_processing:

hid-xpadneo/src/xpadneo/consumer.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ extern int xpadneo_init_consumer(struct xpadneo_devdata *xdata)
1818
return ret;
1919
}
2020

21-
/* enable key events for consumer control */
22-
input_set_capability(xdata->consumer, EV_KEY, BTN_XBOX);
23-
input_set_capability(xdata->consumer, EV_KEY, BTN_SHARE);
24-
2521
if (synth) {
2622
ret = input_register_device(xdata->consumer);
2723
if (ret) {

hid-xpadneo/src/xpadneo/keyboard.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ extern int xpadneo_init_keyboard(struct xpadneo_devdata *xdata)
1818
return ret;
1919
}
2020

21+
/* enable key events for keyboard */
22+
input_set_capability(xdata->keyboard, EV_KEY, BTN_XBOX);
23+
input_set_capability(xdata->keyboard, EV_KEY, BTN_SHARE);
24+
2125
if (synth) {
2226
ret = input_register_device(xdata->keyboard);
2327
if (ret) {

0 commit comments

Comments
 (0)