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 · 13 comments
Open

Looking for support to kernel 6.0+ #67

Sjd-Risca opened this issue Nov 7, 2022 · 13 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

@RamtinKosari
Copy link

Hi, im on Ubuntu with 6.8.0-40-generic Kernel and i have same issue, it has error like this :

dkms install -m applespi -v 0.1
Creating symlink /var/lib/dkms/applespi/0.1/source -> /usr/src/applespi-0.1

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j16 KERNELRELEASE=6.8.0-40-generic...(bad exit status: 2)
ERROR (dkms apport): binary package for applespi: 0.1 not found
Error! Bad return status for module build on kernel: 6.8.0-40-generic (x86_64)
Consult /var/lib/dkms/applespi/0.1/build/make.log for more information.

@Bandito11
Copy link

Bandito11 commented Aug 28, 2024

I have the same error.

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.

This is didn't work for me for 6.10.6-200.fc40.x86_64 (x86_64)

@RealFX-Code
Copy link

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.

Hi, Hope this finds you well. It appears that the code you've sent doesn't work on 6.11.3-gentoo with the t2linux patches.

build log: https://pastebin.com/QiYm4LYK

@RealFX-Code
Copy link

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.

Hi, Hope this finds you well. It appears that the code you've sent doesn't work on 6.11.3-gentoo with the t2linux patches.

build log: https://pastebin.com/QiYm4LYK

I don't know if it's the module that doesn't work, or tiny-dfr... But I have got the module compiling with this patch:

diff --git a/apple-ib-als.c b/apple-ib-als.c
index 9cb4347..5c4f26b 100644
--- a/apple-ib-als.c
+++ b/apple-ib-als.c
@@ -645,7 +645,7 @@ error:
        return rc;
 }

-static int appleals_platform_remove(struct platform_device *pdev)
+static void appleals_platform_remove(struct platform_device *pdev)
 {
        struct appleib_device_data *ddata = pdev->dev.platform_data;
        struct appleib_device *ib_dev = ddata->ib_dev;
@@ -658,10 +658,10 @@ static int appleals_platform_remove(struct platform_device *pdev)

        kfree(als_dev);

-       return 0;
+       return;

 error:
-       return rc;
+       return;
 }

 static const struct platform_device_id appleals_platform_ids[] = {
diff --git a/apple-ib-tb.c b/apple-ib-tb.c
index 2b1763e..57b0b90 100644
--- a/apple-ib-tb.c
+++ b/apple-ib-tb.c
@@ -1259,7 +1259,7 @@ error:
        return rc;
 }

-static int appletb_platform_remove(struct platform_device *pdev)
+static void appletb_platform_remove(struct platform_device *pdev)
 {
        struct appleib_device_data *ddata = pdev->dev.platform_data;
        struct appleib_device *ib_dev = ddata->ib_dev;
@@ -1272,10 +1272,11 @@ static int appletb_platform_remove(struct platform_device *pdev)

        appletb_free_device(tb_dev);

-       return 0;
+       return;

 error:
-       return rc;
+//     return rc;
+    return;
 }

 static const struct platform_device_id appletb_platform_ids[] = {
diff --git a/apple-ibridge.c b/apple-ibridge.c
index b176e32..858fd33 100644
--- a/apple-ibridge.c
+++ b/apple-ibridge.c
@@ -898,7 +898,7 @@ MODULE_DEVICE_TABLE(acpi, appleib_acpi_match);
 static struct acpi_driver appleib_driver = {
        .name           = "apple-ibridge",
        .class          = "topcase", /* ? */
-       .owner          = THIS_MODULE,
+       //.owner                = THIS_MODULE,
        .ids            = appleib_acpi_match,
        .ops            = {
                .add            = appleib_probe,

@RealFX-Code
Copy link

For anyone interested, I forked the module and added the patch. This one compiles just fine on 6.11.x afaik.
https://github.com/RealFX-Code/macbook12-spi-driver

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

8 participants