Skip to content

customhidsony: fix DKMS build failures on kernel >= 6.12#4192

Open
manzolo wants to merge 1 commit intoRetroPie:masterfrom
manzolo:fix/customhidsony-kernel612
Open

customhidsony: fix DKMS build failures on kernel >= 6.12#4192
manzolo wants to merge 1 commit intoRetroPie:masterfrom
manzolo:fix/customhidsony-kernel612

Conversation

@manzolo
Copy link
Copy Markdown
Contributor

@manzolo manzolo commented Apr 25, 2026

Summary

Two kernel API changes break the hid-sony DKMS module when building against kernel >= 6.12 (Ubuntu 24.10+):

1. asm/unaligned.h removed (kernel >= 6.12)

The hid-sony source downloaded from rpi-5.10.y includes <asm/unaligned.h>, which was removed in kernel 6.12 in favour of <linux/unaligned.h>. Build error:

drivers/hid/hid-sony.c:38:10: fatal error: asm/unaligned.h: No such file or directory

Fix: detect the kernel version in the DKMS PRE_BUILD script and replace the include via sed when kernel >= 6.12.

2. hid_driver.report_fixup return type changed to const u8 * (kernel >= 6.2)

The old source has sony_report_fixup returning u8 *, but newer kernel headers expect const u8 *, causing -Werror=incompatible-pointer-types to abort the build:

hid-sony.c:3053:29: error: initialization of 'const __u8 *...' from incompatible pointer type 'u8 *...'

Fix: add ccflags-y += -Wno-error=incompatible-pointer-types to the DKMS Makefile. Promoting u8 * to const u8 * is always safe. On older kernels the flag is a no-op.

Backwards compatibility

  • asm/unaligned.h replacement: guarded by kernel version check, no change on kernel < 6.12
  • ccflags-y flag: no-op on kernels where the type already matches

Test

Verified on Ubuntu 26.04 / kernel 7.0.0-14-generic and kernel 6.17.0-22-generic.

Two kernel API changes break the hid-sony DKMS module when building
against kernel >= 6.12:

1. asm/unaligned.h was removed; the replacement is linux/unaligned.h.
   Detect this at DKMS pre-build time using the kernel version and
   patch the downloaded hid-sony.c source accordingly.

2. The hid_driver.report_fixup callback return type changed from u8*
   to const u8* (kernel >= 6.2). The old rpi-5.10.y source still uses
   the non-const signature, causing -Werror=incompatible-pointer-types
   to fail the build. Suppress the error via ccflags-y since promoting
   u8* to const u8* is always safe.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant