Bumblebee-Project / bbswitch

Disable discrete graphics (currently nvidia only)
GNU General Public License v2.0
491 stars 78 forks source link

build failure on armhf and ppc64el #213

Open arighi opened 2 years ago

arighi commented 2 years ago

I'm getting the following build error on armhf and ppc64 with linux 5.15:

 CC [M]  /var/lib/dkms/bbswitch/0.8/build/bbswitch.o
/var/lib/dkms/bbswitch/0.8/build/bbswitch.c: In function ‘bbswitch_off’:
/var/lib/dkms/bbswitch/0.8/build/bbswitch.c:271:13: error: implicit declaration of function ‘acpi_bus_get_device’; did you mean ‘acpi_get_gpe_device’? [-Werror=implicit-function-declaration]
  271 |         r = acpi_bus_get_device(dis_handle, &ad);
      |             ^~~~~~~~~~~~~~~~~~~
      |             acpi_get_gpe_device
/var/lib/dkms/bbswitch/0.8/build/bbswitch.c:276:15: error: invalid use of undefined type ‘struct acpi_device’
  276 |         if (ad->power.state == ACPI_STATE_UNKNOWN) {
      |               ^~
/var/lib/dkms/bbswitch/0.8/build/bbswitch.c:278:15: error: invalid use of undefined type ‘struct acpi_device’
  278 |             ad->power.state = ACPI_STATE_D0;
      |               ^~

This is because in bbswitch_off() we use acpi_bus_get_device() to determine the power state, but this feature is only available on x86 and arm64. We should probably ifdef that chunk of code and use it only on x86 and arm64.

arighi commented 2 years ago

Created PR #214