#1010985 bbswitch-dkms: Error in recognizing discrete and integrated graphic card

Package:
bbswitch-dkms
Source:
bbswitch
Description:
Interface for toggling the power on NVIDIA Optimus video cards (dkms)
Submitter:
Valerio Passini
Date:
2022-05-14 18:51:04 UTC
Severity:
important
Tags:
#1010985#5
Date:
2022-05-14 18:48:23 UTC
From:
To:
Dear Maintainer,

In dmesg log there is the following error when bbswitch is loaded:
May 14 16:45:34 Panoramix kernel: [    4.153636] bbswitch: version 0.8
May 14 16:45:34 Panoramix kernel: [    4.153648] bbswitch: Found discrete VGA
device 0000:01:00.0: \_SB_.PCI0.GPP0.PEGP
May 14 16:45:34 Panoramix kernel: [    4.153651] bbswitch: Found discrete VGA
device 0000:06:00.0: \_SB_.PCI0.GP17.VGA_
May 14 16:45:34 Panoramix kernel: [    4.153662] bbswitch: failed to evaluate
\_SB_.PCI0.GP17.VGA_._DSM
{0xF8,0xD8,0x86,0xA4,0xDA,0x0B,0x1B,0x47,0xA7,0x2B,0x60,0x42,0xA6,0xB5,0xBE,
0xE0}
0x100 0x0 {0x00,0x00,0x00,0x00}: AE_NOT_FOUND
May 14 16:45:34 Panoramix kernel: [    4.153666] bbswitch: failed to evaluate
\_SB_.PCI0.GP17.VGA_._DSM
{0xA0,0xA0,0x95,0x9D,0x60,0x00,0x48,0x4D,0xB3,0x4D,0x7E,0x5F,0xEA,0x12,0x9F,
0xD4}
0x102 0x0 {0x00,0x00,0x00,0x00}: AE_NOT_FOUND
May 14 16:45:34 Panoramix kernel: [    4.153667] bbswitch: No suitable _DSM
call found.

Digging around I've found that this error happens to ATI Radeon+Nvidia hybrid
systems.
https://github.com/Bumblebee-Project/bbswitch/issues/187
The workaround is to edit the source code in /usr/src/bbswitch-0.8/bbswitch.c
and change