xone icon indicating copy to clipboard operation
xone copied to clipboard

fix: build on kernel v6.11

Open tskaar opened this issue 1 year ago • 29 comments

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

tskaar avatar Jul 30 '24 20:07 tskaar

builds on Fedora Rawhide too. Thanks!

BrycensRanch avatar Aug 01 '24 01:08 BrycensRanch

Works on KDE Neon, thank you!

greeeeeenbean avatar Aug 14 '24 01:08 greeeeeenbean

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

mben42 avatar Aug 26 '24 21:08 mben42

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?

tskaar avatar Aug 26 '24 22:08 tskaar

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.

mben42 avatar Aug 26 '24 22:08 mben42

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

tskaar avatar Aug 26 '24 22:08 tskaar

I've added this to my fork.

dlundqvist avatar Sep 06 '24 09:09 dlundqvist

@medusalix do you consider merging it?

Grief avatar Sep 15 '24 23:09 Grief

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

BeiNacht avatar Sep 18 '24 11:09 BeiNacht

✅ nixos-rebuild switch

tested and confirmed PR works

trevorjamesmartin avatar Sep 19 '24 16:09 trevorjamesmartin

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

Mavarice avatar Sep 22 '24 22:09 Mavarice

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

chizzyc-rust avatar Sep 24 '24 13:09 chizzyc-rust

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: https://github.com/torvalds/linux/commit/c28dd08ef713d2127c5bad3f3e0e93d6ec0309a2

tskaar avatar Sep 24 '24 21:09 tskaar

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

Lioli7k avatar Sep 29 '24 12:09 Lioli7k

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!

AccaliaDeElementia avatar Oct 01 '24 21:10 AccaliaDeElementia

Builds and works fine on liquorix kernel 6.11.1 on Linux Mint 22 :+1:

DiPiVR avatar Oct 03 '24 04:10 DiPiVR

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

Dratnet avatar Oct 06 '24 21:10 Dratnet

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'

andrewbaker-uk avatar Oct 15 '24 08:10 andrewbaker-uk

@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(...)

tskaar avatar Oct 15 '24 10:10 tskaar

@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

GeorgeLukasWagner avatar Oct 15 '24 13:10 GeorgeLukasWagner

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 avatar Oct 15 '24 14:10 andrewbaker-uk

@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!

andrewbaker-uk avatar Oct 15 '24 19:10 andrewbaker-uk

@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 :smile:

tskaar avatar Oct 15 '24 20:10 tskaar

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

Freakygnome avatar Oct 19 '24 12:10 Freakygnome

Is there a reason why this fix is not upstream?

thingsiplay avatar Oct 22 '24 16:10 thingsiplay

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.

AccaliaDeElementia avatar Oct 30 '24 17:10 AccaliaDeElementia

@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.

Instinctlol avatar Oct 30 '24 17:10 Instinctlol

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. :)

AccaliaDeElementia avatar Oct 30 '24 19:10 AccaliaDeElementia

Confirming the fix for 6.11.6-arch1-1. Thanks a lot for the patch :heart_hands: !

thomasnemer avatar Nov 11 '24 09:11 thomasnemer