Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build on kernel v6.11 #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

tskaar
Copy link

@tskaar tskaar commented Jul 30, 2024

Fixes the build issue:

/var/lib/dkms/xone/0.3.r57.g29ec357/build/bus/bus.c:126:18: error: initialization of ‘int (*)(struct device *, const struct device_driver *)’ from incompatible pointer type ‘int (*)(struct device *, struct device_driver *)’ [-Wincompatible-pointer-types]
  126 |         .match = gip_bus_match,
      |                  ^~~~~~~~~~~~~
/var/lib/dkms/xone/0.3.r57.g29ec357/build/bus/bus.c:126:18: note: (near initialization for ‘gip_bus_type.match’)

Tested and built on torvalds/linux/v6.11-rc1

@BrycensRanch
Copy link

builds on Fedora Rawhide too. Thanks!

@Greenphlem
Copy link

Works on KDE Neon, thank you!

@mben42
Copy link

mben42 commented Aug 26, 2024

Hi, unfortunately it doesn't fix the problem on Manjaro (kernel 6.11.0-rc3-2-MANJARO).

@tskaar
Copy link
Author

tskaar commented Aug 26, 2024

Hi, unfortunately it doesn't fix the problem on Manjaro (kernel 6.11.0-rc3-2-MANJARO).

What exactly is failing, you getting the same issue as in my opening post?

@mben42
Copy link

mben42 commented Aug 26, 2024

Hi, unfortunately it doesn't fix the problem on Manjaro (kernel 6.11.0-rc3-2-MANJARO).

What exactly is failing, you getting the same issue as in my opening post?

Exact same issue yes, I was able to compile by adding -Wno-error=incompatible-pointer-types as a CFLAFS in Makefile.

@tskaar
Copy link
Author

tskaar commented Aug 26, 2024

Hi, unfortunately it doesn't fix the problem on Manjaro (kernel 6.11.0-rc3-2-MANJARO).

What exactly is failing, you getting the same issue as in my opening post?

Exact same issue yes, I was able to compile by adding -Wno-error=incompatible-pointer-types as a CFLAFS in Makefile.

Compiled fine here using Manjaro's PKGBUILD for their kernel and using xone-dkms-git as a reference PKGBUILD (then changing the source to my fixed branch);

(4/5) Install DKMS modules
==> dkms install --no-depmod xone/0.3.r57.g29ec357 -k 6.11.0-rc5-1-MANJARO
==> dkms install --no-depmod hid-xpadneo/v0.9.6 -k 6.11.0-rc5-1-MANJARO
==> depmod 6.11.0-rc5-1-MANJARO

@dlundqvist
Copy link

I've added this to my fork.

@Grief
Copy link

Grief commented Sep 15, 2024

@medusalix do you consider merging it?

@BeiNacht
Copy link

Tested this PR under NixOS 24.05 with 6.11 kernel. It's building and running

@trevorjamesmartin
Copy link

✅ nixos-rebuild switch

tested and confirmed PR works

@Mavarice
Copy link

This PR solved the install issue on Nobara Linux 40 (a fork of Fedora)
No additional steps needed from the main readme except to purge to lingering install files from /usr/src and /var/lib/dkms

@chizzyc-rust
Copy link

Working on 6.11.0-061100-generic, Mint. Can I ask what exactly your code does? I'm not a dev. I dont understand what your if statement accomplishes. Thanks

@tskaar
Copy link
Author

tskaar commented Sep 24, 2024

Working on 6.11.0-061100-generic, Mint. Can I ask what exactly your code does? I'm not a dev. I dont understand what your if statement accomplishes. Thanks

It's just re-defining the signature of the function declaration based on whether it's newer or older than kernel v6.11.
The reason for the re-definition is that the kernel changed device_driver pointer to be of const struct (v6.11) as opposed to struct, you can find the (start of) upstream commit(s) here: torvalds/linux@c28dd08

@Lioli7k
Copy link

Lioli7k commented Sep 29, 2024

Works on OpenSUSE Tumbleweed 20240927. Thank you for the fix!

@AccaliaDeElementia
Copy link

Just took kernel 6.11.1 on Archlinux.

Can confirm this patch allows the build on that kernel version. and functionality works as expected with the patch as well.

Hope it gets merged soon for others to use!

@dusanpol
Copy link

dusanpol commented Oct 3, 2024

Builds and works fine on liquorix kernel 6.11.1 on Linux Mint 22 👍

@Dratnet
Copy link

Dratnet commented Oct 6, 2024

Confirmed, works well with Linux 6.11.2-arch1-1 (x86-64) and resolves build error.

@andrewbaker-uk
Copy link

Install fails on Ubuntu 24.10

Installing xone unknown...
Sign command: /usr/bin/kmodsign
Signing key: /var/lib/shim-signed/mok/MOK.priv
Public certificate (MOK): /var/lib/shim-signed/mok/MOK.der
Creating symlink /var/lib/dkms/xone/unknown/source -> /usr/src/xone-unknown

Building module:
Cleaning build area...
make -j16 KERNELRELEASE=6.11.0-8-generic -C /lib/modules/6.11.0-8-generic/build M=/var/lib/dkms/xone/unknown/build...(bad exit status: 2)
ERROR (dkms apport): binary package for xone: unknown not found
Error! Bad return status for module build on kernel: 6.11.0-8-generic (x86_64)
Consult /var/lib/dkms/xone/unknown/build/make.log for more information.
DKMS make.log for xone-unknown for kernel 6.11.0-8-generic (x86_64)
Tue Oct 15 09:15:42 AM BST 2024
make: Entering directory '/usr/src/linux-headers-6.11.0-8-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-14 (Ubuntu 14.2.0-4ubuntu2) 14.2.0
  You are using:           gcc-14 (Ubuntu 14.2.0-4ubuntu2) 14.2.0
  CC [M]  /var/lib/dkms/xone/unknown/build/transport/wired.o
  CC [M]  /var/lib/dkms/xone/unknown/build/transport/dongle.o
  CC [M]  /var/lib/dkms/xone/unknown/build/transport/mt76.o
  CC [M]  /var/lib/dkms/xone/unknown/build/bus/bus.o
  CC [M]  /var/lib/dkms/xone/unknown/build/bus/protocol.o
  CC [M]  /var/lib/dkms/xone/unknown/build/auth/auth.o
  CC [M]  /var/lib/dkms/xone/unknown/build/auth/crypto.o
  CC [M]  /var/lib/dkms/xone/unknown/build/driver/common.o
  CC [M]  /var/lib/dkms/xone/unknown/build/driver/gamepad.o
  CC [M]  /var/lib/dkms/xone/unknown/build/driver/headset.o
  CC [M]  /var/lib/dkms/xone/unknown/build/driver/chatpad.o
  CC [M]  /var/lib/dkms/xone/unknown/build/driver/madcatz_strat.o
  CC [M]  /var/lib/dkms/xone/unknown/build/driver/madcatz_glam.o
  CC [M]  /var/lib/dkms/xone/unknown/build/driver/pdp_jaguar.o
  LD [M]  /var/lib/dkms/xone/unknown/build/xone-gip-pdp-jaguar.o
/var/lib/dkms/xone/unknown/build/bus/bus.c:126:18: error: initialization of ‘int (*)(struct device *, const struct device_driver *)’ from incompatible pointer type ‘int (*)(struct device *, struct device_driver *)’ [-Wincompatible-pointer-types]
  126 |         .match = gip_bus_match,
      |                  ^~~~~~~~~~~~~
/var/lib/dkms/xone/unknown/build/bus/bus.c:126:18: note: (near initialization for ‘gip_bus_type.match’)
make[2]: *** [scripts/Makefile.build:244: /var/lib/dkms/xone/unknown/build/bus/bus.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/usr/src/linux-headers-6.11.0-8-generic/Makefile:1931: /var/lib/dkms/xone/unknown/build] Error 2
make: *** [Makefile:224: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.11.0-8-generic'

@tskaar
Copy link
Author

tskaar commented Oct 15, 2024

@andrewbaker-uk

Install fails on Ubuntu 24.10

Can you dump the definition of int gip_bus_match(...) from your /var/lib/dkms/xone/unknown/build/bus/bus.c.
Just include everything between the end of struct device_type{...} until static int gip_bus_probe(...)

@GeorgeLukasWagner
Copy link

@andrewbaker-uk
i fixed the build issue on my machine by typecasting the function pointer like this,
.match = (int (*)(struct device *, const struct device_driver *))gip_bus_match,
i think this would work too if the other solution failed

@andrewbaker-uk
Copy link

I'll try and get that info over @tskaar. I went scorched earth and reinstalled 24.04 (luckily was a clean install anyway). Will try and reproduce in a VM.

@GeorgeLukasWagner will give it a go

@andrewbaker-uk
Copy link

@andrewbaker-uk

Install fails on Ubuntu 24.10

Can you dump the definition of int gip_bus_match(...) from your /var/lib/dkms/xone/unknown/build/bus/bus.c. Just include everything between the end of struct device_type{...} until static int gip_bus_probe(...)

Medusalix

static int gip_bus_match(struct device *dev, struct device_driver *driver)
{
	struct gip_client *client;
	struct gip_driver *drv;
	int i;

	if (dev->type != &gip_client_type)
		return false;

	client = to_gip_client(dev);
	drv = to_gip_driver(driver);

	for (i = 0; i < client->classes->count; i++)
		if (!strcmp(client->classes->strings[i], drv->class))
			return true;

	return false;
}

tskaar
Can't check as it has installed successfully in a VM running 24.10.

@tskaar it may have been an Id10T error, just remembered cloning your repo but not checking out the fix-6.11 branch in which case I apologise!

@tskaar
Copy link
Author

tskaar commented Oct 15, 2024

@andrewbaker-uk;
Considering you are missing:

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
static int gip_bus_match(struct device *dev, struct device_driver *driver)
#else
static int gip_bus_match(struct device *dev, const struct device_driver *driver)
#endif

I suspect that you just forgot to just apply the patch, luckily a relatively easy fix 😄

@Freakygnome
Copy link

Builds and works fine on 6.11.3-200.fc40.x86_64

@thingsiplay
Copy link

Is there a reason why this fix is not upstream?

@dlundqvist dlundqvist mentioned this pull request Oct 29, 2024
@AccaliaDeElementia
Copy link

something seems up with this fix for 6.11.5-arch1-1.

my Elite2 gamepad connects and seems functional, but giving inputs on the device causes the device to disconnect and reconnect within a few seconds of input received.

kernel dmesg output starting at the first message produced when the gamepad disconnects until it's fully reconnected again is here: https://pastebin.com/QjQdbWqf

using the dlundqvist fork from the AUR:

3 aur/xone-dlundqvist-dkms-git 0.3.r84.gc7b24b7-1 (+7 5.50) (Installed: 0.3.r90.gf314bce-1)
    Modern Linux driver for Xbox One and Xbox Series X|S controllers - dlundqvist fork

Happy to provide more debug logs or testing if there's anything else that would be handy.

@Instinctlol
Copy link

@AccaliaDeElementia that's a problem with the fork. I also ran into multiple issues with it and was curious why people in this PR didn't have any issues.

You need to install xone-dkms-git, but based on this PR. I followed this guide which does exactly that and now it seems to be working fine again.

@AccaliaDeElementia
Copy link

Alright, i can confirm, the issue is to do with the fork, not the patch.

weird.... but at least I'm up and running again. :)

mwick83 added a commit to mwick83/xone that referenced this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.