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

Looking for support to kernel 6.0+ #67

Open
Sjd-Risca opened this issue Nov 7, 2022 · 8 comments
Open

Looking for support to kernel 6.0+ #67

Sjd-Risca opened this issue Nov 7, 2022 · 8 comments

Comments

@Sjd-Risca
Copy link

Trying to compile on Debian testing I get the following trace:

DKMS make.log for applespi-0.1 for kernel 6.0.0-2-amd64 (x86_64)
Fri Nov  4 14:58:20 UTC 2022
make -C /lib/modules/6.0.0-2-amd64/build M=/var/lib/dkms/applespi/0.1/build modules
make[1]: Entering directory '/usr/src/linux-headers-6.0.0-2-amd64'
  CC [M]  /var/lib/dkms/applespi/0.1/build/applespi.o
  CC [M]  /var/lib/dkms/applespi/0.1/build/apple-ibridge.o
  CC [M]  /var/lib/dkms/applespi/0.1/build/apple-ib-tb.o
  CC [M]  /var/lib/dkms/applespi/0.1/build/apple-ib-als.o
/var/lib/dkms/applespi/0.1/build/applespi.c: In function 'applespi_get_saved_bl_level':
/var/lib/dkms/applespi/0.1/build/applespi.c:1810:38: error: invalid application of 'sizeof' to incomplete type 'struct efivar_entry'
 1810 |         efivar_entry = kmalloc(sizeof(*efivar_entry), GFP_KERNEL);
      |                                      ^
In file included from /usr/src/linux-headers-6.0.0-2-common/include/linux/string.h:253,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/bitmap.h:11,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/cpumask.h:12,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/smp.h:13,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/lockdep.h:14,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/mutex.h:17,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/kernfs.h:11,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/sysfs.h:16,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/kobject.h:20,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/of.h:17,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/irqdomain.h:35,
                 from /usr/src/linux-headers-6.0.0-2-common/include/linux/acpi.h:13,
                 from /var/lib/dkms/applespi/0.1/build/applespi.c:44:
/var/lib/dkms/applespi/0.1/build/applespi.c:1814:28: error: invalid use of undefined type 'struct efivar_entry'
 1814 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |                            ^~
/usr/src/linux-headers-6.0.0-2-common/include/linux/fortify-string.h:377:44: note: in definition of macro '__fortify_memcpy_chk'
  377 |         fortify_memcpy_chk(__fortify_size, p_size, q_size,              \
      |                                            ^~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1814:9: note: in expansion of macro 'memcpy'
 1814 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |         ^~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1814:28: error: invalid use of undefined type 'struct efivar_entry'
 1814 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |                            ^~
/usr/src/linux-headers-6.0.0-2-common/include/linux/fortify-string.h:378:28: note: in definition of macro '__fortify_memcpy_chk'
  378 |                            p_size_field, q_size_field, #op);            \
      |                            ^~~~~~~~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1814:9: note: in expansion of macro 'memcpy'
 1814 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |         ^~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1814:28: error: invalid use of undefined type 'struct efivar_entry'
 1814 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |                            ^~
/usr/src/linux-headers-6.0.0-2-common/include/linux/fortify-string.h:379:27: note: in definition of macro '__fortify_memcpy_chk'
  379 |         __underlying_##op(p, q, __fortify_size);                        \
      |                           ^
/var/lib/dkms/applespi/0.1/build/applespi.c:1814:9: note: in expansion of macro 'memcpy'
 1814 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |         ^~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1816:21: error: invalid use of undefined type 'struct efivar_entry'
 1816 |         efivar_entry->var.VendorGuid = EFI_BL_LEVEL_GUID;
      |                     ^~
/var/lib/dkms/applespi/0.1/build/applespi.c:1819:15: error: implicit declaration of function 'efivar_entry_get'; did you mean 'efi_mokvar_entry_next'? [-Werror=implicit
-function-declaration]
 1819 |         sts = efivar_entry_get(efivar_entry, NULL, &efi_data_len, &efi_data);
      |               ^~~~~~~~~~~~~~~~
      |               efi_mokvar_entry_next
/var/lib/dkms/applespi/0.1/build/applespi.c: In function 'applespi_save_bl_level':
/var/lib/dkms/applespi/0.1/build/applespi.c:1846:15: error: implicit declaration of function 'efivar_entry_set_safe' [-Werror=implicit-function-declaration]
 1846 |         sts = efivar_entry_set_safe((efi_char16_t *)EFI_BL_LEVEL_NAME, efi_guid,
      |               ^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.0.0-2-common/scripts/Makefile.build:254: /var/lib/dkms/applespi/0.1/build/applespi.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/usr/src/linux-headers-6.0.0-2-common/Makefile:1876: /var/lib/dkms/applespi/0.1/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.0.0-2-amd64'
make: *** [Makefile:16: all] Error 2

Here some details about local setup on Debian testing (bookworm):

# uname -a
Linux mac 6.0.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.0.5-1 (2022-10-28) x86_64 GNU/Linux
#  apt install linux-headers-amd64 dkms git make wget curl
#  git clone https://github.com/roadrunner2/macbook12-spi-driver.git /usr/src/applespi-0.1
#  pushd /usr/src/applespi-0.1/
#  wget https://patch-diff.githubusercontent.com/raw/roadrunner2/macbook12-spi-driver/pull/65.patch
#  patch --dry-run < 65.patch
#  patch  < 65.patch
@eado
Copy link

eado commented Nov 15, 2022

Would also love this. Experiencing the same thing on:

Linux machine 6.0.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 10 Nov 2022 21:14:24 +0000 x86_64 GNU/Linux

@flavian112
Copy link

Hi, i've noticed the same problem since updating to Linux Kernel 6. I don't have much in-depth knowledge of Linux, so my "quick, dirty workaround" is the following: As some of the efivar API doesn't seem to be available anymore (don't know if it's been deprecated or was internal), the compilation fails with the 'applespi_get_saved_bl_level' and the 'applespi_save_bl_level' function. Since it is not a big deal-breaker for me if the backlight levels don't get saved in between boots, I just changed them into dummy functions for now ;)

@eado
Copy link

eado commented Nov 15, 2022

Great to hear you got it working. I tried your method and loaded the modules using dkms. Doesn't load on boot because it's asking for it to be signed?

kernel: applespi: module verification failed: signature and/or required key missing - tainting kernel

@flavian112
Copy link

Weird, I have the same kernel version installed and I'm also on Arch. I just did: make all && make install, this worked for me.

@eado
Copy link

eado commented Nov 17, 2022

Looks like it did work! I just had to disable usbmuxd for the Touch Bar to activate. Very odd.

@flavian112
Copy link

flavian112 commented Nov 17, 2022

Great to hear that you got it to work and yes I think it's a known problem that the device rules of usbmuxd interfere with the touchbar driver. (see #42)

@almas
Copy link

almas commented May 11, 2024

You can try https://github.com/almas/macbook12-spi-driver/tree/touchbar-driver-hid-driver
I have successfully installed this driver with kernel 6.5.0-28-generic.

@crocco95
Copy link

crocco95 commented Jun 9, 2024

You can try https://github.com/almas/macbook12-spi-driver/tree/touchbar-driver-hid-driver I have successfully installed this driver with kernel 6.5.0-28-generic.

It worked perfectly for me, thanks a lot

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

No branches or pull requests

5 participants