Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux? |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-23-2022, 10:50 AM
|
#1
|
Member
Registered: Apr 2015
Posts: 53
Rep:
|
Stop my xbox pad to act as a mouse
Hello,
I own a Microsoft Xbox One X pad:
Code:
$ lsusb
[...]
Bus 001 Device 006: ID 045e:0b12 Microsoft Corp.
[...]
I am on Slackware 14.2 (64-bit) operating system with the Linux 5.2.8 kernel:
Code:
$ cat /etc/slackware-version
Slackware 14.2
$ uname -r
5.2.8-desktop
The module supporting my pad is xpad.
However, the xpad module provided by linux 5.2.8 is too old to support my recent pad.
So, I downloaded the latest stable release of linux (5.16.2) and built the provided xpad module:
Code:
$ wget -cq https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.16.2.tar.xz
$ tar xf linux-5.16.2.tar.xz
$ cp linux-5.16.2/drivers/input/joystick/xpad.c .
$ wget -cq http://yugiohjcj.free.fr/xpad.c.patch
$ wget -cq http://yugiohjcj.free.fr/Makefile
$ cat xpad.c.patch
--- xpad.c.ori 2022-01-23 16:23:58.507709200 +0100
+++ xpad.c 2022-01-23 16:15:54.043660689 +0100
@@ -1930,8 +1930,6 @@
xpad360w_poweroff_controller(xpad);
} else {
mutex_lock(&input->mutex);
- if (input_device_enabled(input))
- xpad_stop_input(xpad);
mutex_unlock(&input->mutex);
}
@@ -1950,9 +1948,7 @@
retval = xpad360w_start_input(xpad);
} else {
mutex_lock(&input->mutex);
- if (input_device_enabled(input)) {
- retval = xpad_start_input(xpad);
- } else if (xpad->xtype == XTYPE_XBOXONE) {
+ if (xpad->xtype == XTYPE_XBOXONE) {
/*
* Even if there are no users, we'll send Xbox One pads
* the startup sequence so they don't sit there and
$ cat Makefile
obj-m := xpad.o
all:
$(MAKE) -C /tmp/build/linux-5.2.8-desktop M=$(shell pwd) modules
$ make
make -C /tmp/build/linux-5.2.8-desktop M=/tmp/build/xpad/linuxquestions modules
make[1]: Entering directory `/tmp/build/linux-5.2.8-desktop'
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /tmp/build/xpad/linuxquestions/xpad.o
/tmp/build/xpad/linuxquestions/xpad.c: In function ‘xpad_suspend’:
/tmp/build/xpad/linuxquestions/xpad.c:1933:7: error: implicit declaration of function ‘input_device_enabled’; did you mean ‘cpu_feature_enabled’? [-Werror=implicit-function-declaration]
if (input_device_enabled(input))
^~~~~~~~~~~~~~~~~~~~
cpu_feature_enabled
cc1: some warnings being treated as errors
make[3]: *** [/tmp/build/xpad/linuxquestions/xpad.o] Error 1
make[2]: *** [_module_/tmp/build/xpad/linuxquestions] Error 2
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/tmp/build/linux-5.2.8-desktop'
make: *** [all] Error 2
$ patch -p0 < xpad.c.patch
patching file xpad.c
$ make
make -C /tmp/build/linux-5.2.8-desktop M=/tmp/build/xpad/linuxquestions modules
make[1]: Entering directory `/tmp/build/linux-5.2.8-desktop'
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /tmp/build/xpad/linuxquestions/xpad.o
/tmp/build/xpad/linuxquestions/xpad.o: warning: objtool: missing symbol for section .exit.text
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/build/xpad/linuxquestions/xpad.mod.o
LD [M] /tmp/build/xpad/linuxquestions/xpad.ko
make[1]: Leaving directory `/tmp/build/linux-5.2.8-desktop'
Then I loaded the module:
Code:
$ lsmod | grep xpad
$ sudo insmod ./xpad.ko
$ lsmod | grep xpad
xpad 36864 0
$ sudo dmesg
[...]
[11293.241215] input: Microsoft Xbox One X pad as /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/input/input25
[11293.241465] usbcore: registered new interface driver xpad
The pad is now recognized on my Dolphin emulator.
However, each time I use the left analog stick, it also moves the mouse cursor.
Can you help me to stop my xbox pad to act as a mouse please?
Thank you.
Best regards.
|
|
|
01-24-2022, 05:52 PM
|
#2
|
Member
Registered: Apr 2015
Posts: 53
Original Poster
Rep:
|
I found how to fix that.
Instead of using the xpad module provided by the recent linux 5.16.2 kernel, I used the xpad module provided by the old linux 5.2.8 kernel.
Of course, I had to patch it to support the recent pad:
Code:
$ diff -ruN xpad-linux-5.2.8.c xpad.c
--- xpad-linux-5.2.8.c 2022-01-23 17:00:03.289363357 +0100
+++ xpad.c 2022-01-23 17:03:33.167384373 +0100
@@ -130,6 +130,7 @@
{ 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE },
{ 0x045e, 0x02ea, "Microsoft X-Box One S pad", 0, XTYPE_XBOXONE },
{ 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
+ { 0x045e, 0x0b12, "Microsoft Xbox One X pad", 0, XTYPE_XBOXONE },
{ 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 },
{ 0x046d, 0xc21e, "Logitech Gamepad F510", 0, XTYPE_XBOX360 },
{ 0x046d, 0xc21f, "Logitech Gamepad F710", 0, XTYPE_XBOX360 },
It is now working perfectly.
However, if you can explain the behavior of the xpad module provided by the recent linux 5.16.2 kernel, I am interested.
Thank you.
Best regards.
|
|
|
All times are GMT -5. The time now is 10:46 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|