# Writing to SMBios

## dalu

Ok I have a MSI GT72 2QE laptop (idk how often I've written this already)

and

I'm required to have Windows installed on it in order to be able to switch between integrated (intel) and discrete (nv gtx 980m) gpu.

This happens using some MSI proprietary software that watches or listens for a keypress and then "does something", which also triggers the display of a dialog "blabla you need to reboot  [y/n]"

I asked MSI tech support in Taiwan and they were lazy about it, suggested I keep using Windows.

Now I thought I'd be smart and inspired by some post on Google+ about switching internal/discrete graphics but in the AMD context I went on and did a

dmidecode > intel1

reboot to Windows and switch to nvidia

dmidecode > nvidia1

reboot to Windows and switch to intel

dmidecode > intel2

diff intel1 intel2 = they're the same

diff intel1 nvidia1 = difference in 1 line

```

nvidia1:

Handle 0x0002, DMI type 1, 27 bytes

System Information

    Manufacturer: Micro-Star International Co., Ltd.

    Product Name: GT72 2QE

    Version: REV:0.C

    Serial Number: FFFFFFFF

    UUID: 00000000-0000-0000-7074-616C28000000

    Wake-up Type: Power Switch

    SKU Number: To be filled by O.E.M.

    Family: To be filled by O.E.M.

intel1:

Handle 0x0002, DMI type 1, 27 bytes

System Information

    Manufacturer: Micro-Star International Co., Ltd.

    Product Name: GT72 2QE

    Version: REV:0.C

    Serial Number: FFFFFFFF

    UUID: 00000000-0024-0000-7074-616C28000000

    Wake-up Type: Power Switch

    SKU Number: To be filled by O.E.M.

    Family: To be filled by O.E.M.

```

the difference is the UUID. Of course it can't be that simple or maybe it can.

So I thought all I need to do in order to switch between intel and nvidia is write a UUID into the SMBios.

BIOS is Ami, UEFI. As you see I don't know what I'm doing as this is too low level and I'm usually not touching this low.

This is also where the confusion begins.

Is it SMBios, is it UEFI are they mutually exclusive?

I will also do a binary dump and see if there's more of a difference.

But I guess the BIOS has some configuration data and depending on that data it acts differently.

Just like any program or library with a config set.

The question is how do I write or modify this data?

----------

## roarinelk

This looks like a very recent model, does it have UEFI?

I very much doubt that writing to smbios area will change anything, instead please

post a dump of all EFI variables with both graphics activated, maybe something there

changes (/sys/firmware/efivars/*/data  files).

Or post the actual utility which changes graphics, maybe someone can find out what

it does.

----------

## dalu

Hey roarinelk,

Yes it does have UEFI. But how would you compact that all in 1 file, I'll have to write a program that reads every "file" in /sys/firmware/efi/efivars/*/*

pack it as a file that can be loaded

do the same for nvidia

compare the two data structures

Will take a while.

The proprietary program is called SCM.exe or System Control Manager.

Apparently it comes with a GUI and a service.

The GUI is a .net app.

I have disassembled the scm.exe (GUI) and found exported functions that handle keydown keyup events and also calls with *WMISet or *WMIGet

WMI is Windows lingo for dmi

http://download.msi.com/uti_exe/nb/MSI SCM x64 13.015.04213 for ClickPad.zip

urlencoded

http://download.msi.com/uti_exe/nb/MSI%20SCM%20x64%2013.015.04213%20for%20ClickPad.zip

The difference in the binary dmi dump is exactly this 0x24 at offset 0x9e

It doesn't support optimus or bumblebee but suffers from the same sync issue with the official nvidia drivers. The bug is apparently noted since 2013 but not fixed. Nouveau works but no brightness control. As an aside.

So yeah it will take a while  :Smile: 

p.s.

The key that needs to be pressed is not a standard key on the keyboard but 1 of 5 keys on the top left side of the laptop.

I guess I could run something like xmodmap (or what was that tool again to see which key is pressed?) and see if it has any code associated with it.

----------

## NeddySeagoon

dalu,

This is either a Intel/nVidia muxless system, called Optimus graphick, in which case you need either Bumblebee or to follow the Optimus setup on the Gentoo wiki.

Its also documented in the nVidia-drivers README around about chapter 30.

If its an older system with a video multiplexor, you need the kernel VGA_SWITCHEROO option.

Neither solution requires Windows.

This random review says "In one slightly curious turn, MSI has taken the decision not to employ Nvidia’s Optimus graphics-switching technology"

It looks like its not Optimus.

----------

## dalu

Hey Ned,

yeah it's not Optimus. MSI apparently does Optimus up to 960/965m cards. For some strange reason they don't with the 970 ir 980 ones.

But I guess it does have something to do with it, hence the EDID/sync issue with official drivers.

Idk if it's a licence/cost issue or if they were just being lazy or had a deadline to meet.

Whatever the case I have only 1 provider.

When I run dmesg I see memory start addrs for ACPI ACPI2.0 SMBIOS and EFI.

SMBIOS version is 2.8 btw.

I believe instead of going through the whole tree under /sys/firmware/efi/efivars I could read from /dev/mem but how would I know where to stop?

- Is it possible to modify efivars? I guess it is, else they'd be called eficonsts *snicker*

Okay idk where I went to have a tree of efi directories with files... anyhow under /sys/firmware/efi/efivars

nvidia

```

-rw-r--r--. 1 root root    8  2. Sep 2015  AcpiGlobalVariable-af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e

-rw-r--r--. 1 root root   12  2. Sep 2015  AcpiGlobalVariable-c020489e-6db2-4ef2-9aa5-ca06fc11d36a

-rw-r--r--. 1 root root   87  2. Sep 2015  AMITSESetup-c811fa38-42c8-4579-a9bb-60e94eddfb34

-rw-r--r--. 1 root root  304  2. Sep 2015  Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root  116  2. Sep 2015  Boot0002-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    6  2. Sep 2015  BootCurrent-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    8  2. Sep 2015  BootOptionSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    8  2. Sep 2015  BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    8  2. Sep 2015  BugCheckCode-ba57e015-65b3-4c3c-b274-659192f699e3

-rw-r--r--. 1 root root   12  2. Sep 2015  BugCheckParameter1-ba57e015-65b3-4c3c-b274-659192f699e3

-rw-r--r--. 1 root root    8  2. Sep 2015  BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3

-rw-r--r--. 1 root root   94  2. Sep 2015  ConIn-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   94  2. Sep 2015  ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   40  2. Sep 2015  ConOut-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   40  2. Sep 2015  ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    8  2. Sep 2015  CpuIdCkSum-a09a3211-0d22-4733-4455-06778899aabb

-rw-r--r--. 1 root root   37  2. Sep 2015  CPUS3APICID-1456cc6e-22ac-5289-33ba-2e13bbdabaee

-rw-r--r--. 1 root root 3147  2. Sep 2015  db-d719b2cb-3d3a-4596-a3bc-dad00e67656f

-rw-r--r--. 1 root root  732  2. Sep 2015  dbx-d719b2cb-3d3a-4596-a3bc-dad00e67656f

-rw-r--r--. 1 root root    8  2. Sep 2015  DefaultBootOrder-45cf35f6-0d6e-4d04-856a-0370a5b16f53

-rw-r--r--. 1 root root   12  2. Sep 2015  DimmSPDdata-a09a3266-0d9d-476a-b8ee-0c226be16644

-rw-r--r--. 1 root root 1284  2. Sep 2015  DmiArray-4b3082a3-80c6-4d7e-9cd0-583917265df1

-rw-r--r--. 1 root root    5  2. Sep 2015  DmiVar0100020800-4b3082a3-80c6-4d7e-9cd0-583917265df1

-rw-r--r--. 1 root root   30  2. Sep 2015  DmiVar0b00000100-4b3082a3-80c6-4d7e-9cd0-583917265df1

-rw-r--r--. 1 root root   12  2. Sep 2015  DriverHealthCount-7459a7d4-6533-4480-bba7-79e25a4443c9

-rw-r--r--. 1 root root   12  2. Sep 2015  DriverHlthEnable-0885f288-418c-4be1-a6af-8bad61da08fe

-rw-r--r--. 1 root root   40  2. Sep 2015  ErrOut-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   40  2. Sep 2015  ErrOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root  128  2. Sep 2015  FastBootOption-b540a530-6978-4da7-91cb-7207d764d262

-rw-r--r--. 1 root root    8  2. Sep 2015  FirmwareUpdateCountVar-e08126e5-b93c-4f5e-8e81-6dfcf34ff88e

-rw-r--r--. 1 root root    8  2. Sep 2015  FPDT_Variable-01368881-c4ad-4b1d-b631-d57a8ec8db6b

-rw-r--r--. 1 root root   12  2. Sep 2015  HobRomImage-dde1bc72-d45e-4209-ab85-14462d2f5074

-rw-r--r--. 1 root root   78  2. Sep 2015  IccAdvancedSetupDataVar-7b77fb8b-1e0d-4d7e-953f-3980a261e077

-rw-r--r--. 1 root root 1564  2. Sep 2015  KEK-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    7  2. Sep 2015  Lang-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    7  2. Sep 2015  LangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root  247  2. Sep 2015  LastBoot-b540a530-6978-4da7-91cb-7207d764d262

-rw-r--r--. 1 root root    8  2. Sep 2015  LastBootFailed-b540a530-6978-4da7-91cb-7207d764d262

-rw-r--r--. 1 root root   68  2. Sep 2015  MemoryTypeInformation-4c19049f-4137-4dd3-9c10-8b97a83ffdfa

-rw-r--r--. 1 root root  924  2. Sep 2015  MokListRT-605dab50-e046-4300-abb6-3dd810dd8b23

-rw-r--r--. 1 root root    5  2. Sep 2015  MSIHiddenFun-2a28a81a-dcbf-42f2-8366-b92fa64fe7f7

-rw-r--r--. 1 root root    8  2. Sep 2015  MXMIDVar-c2ba5cee-cd6f-4656-8313-d2eafb643aa3

-rw-r--r--. 1 root root    8  2. Sep 2015  NetworkStackVar-d1405d16-7afc-4695-bb12-41459d3695a2

-rw-r--r--. 1 root root  204  2. Sep 2015  OcCurrent-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root  204  2. Sep 2015  OcDefault-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root  204  2. Sep 2015  OcSetupData-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root   12  2. Sep 2015  OsIndicationsSupported-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    8  2. Sep 2015  PchInit-e6c2f70a-b604-4877-85ba-deec89e117eb

-rw-r--r--. 1 root root   12  2. Sep 2015  PchInitPei-a31b27a4-cae6-48ff-8c5a-294221e6f389

-rw-r--r--. 1 root root   20  2. Sep 2015  PchS3Peim-e6c2f70a-b604-4877-85ba-deec89e117eb

-rw-r--r--. 1 root root  836  2. Sep 2015  PK-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   10  2. Sep 2015  PlatformLang-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   10  2. Sep 2015  PlatformLangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   68  2. Sep 2015  PreviousMemoryTypeInformation-4c19049f-4137-4dd3-9c10-8b97a83ffdfa

-rw-r--r--. 1 root root   12  2. Sep 2015  RSCInfoAddresss-01368881-c4ad-4b1d-b631-d57a8ec8db6b

-rw-r--r--. 1 root root   42  2. Sep 2015  RstSataV-193dfefa-a445-4302-99d8-ef3aad1a04c6

-rw-r--r--. 1 root root   12  2. Sep 2015  S3SS-4bafc2b4-02dc-4104-b236-d6f1b98d9e84

-rw-r--r--. 1 root root    5  2. Sep 2015  SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    8  2. Sep 2015  Setup-80e1202e-2697-4264-9cc9-80762c3e5863

-rw-r--r--. 1 root root 1182  2. Sep 2015  Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root    5  2. Sep 2015  SetupMode-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   16  2. Sep 2015  SetupOcCpuFeatures-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root  132  2. Sep 2015  SignatureSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root 2570  2. Sep 2015  StdDefaults-4599d26f-1a11-49b8-b91f-858745cff824

-rw-r--r--. 1 root root    6  2. Sep 2015  Timeout-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   21  2. Sep 2015  UIT_DATA-fe47349a-7f0d-4641-822b-34baa28ecdd0

-rw-r--r--. 1 root root   36  2. Sep 2015  UIT_HEADER-fe47349a-7f0d-4641-822b-34baa28ecdd0

-rw-r--r--. 1 root root   12  2. Sep 2015  USB_POINT-c811fa38-42c8-4579-a9bb-60e94eddfb34

-rw-r--r--. 1 root root   36  2. Sep 2015  UsbSupport-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root   68  2. Sep 2015  WriteOnceStatus-4b3082a3-80c6-4d7e-9cd0-583917265df1

```

intel

```

-rw-r--r--. 1 root root     8  2. Sep 2015  AcpiGlobalVariable-af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e

-rw-r--r--. 1 root root    12  2. Sep 2015  AcpiGlobalVariable-c020489e-6db2-4ef2-9aa5-ca06fc11d36a

-rw-r--r--. 1 root root    87  2. Sep 2015  AMITSESetup-c811fa38-42c8-4579-a9bb-60e94eddfb34

-rw-r--r--. 1 root root   304  2. Sep 2015  Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    59  2. Sep 2015  Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   116  2. Sep 2015  Boot0002-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    67  2. Sep 2015  Boot0003-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    63  2. Sep 2015  Boot0004-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root     6  2. Sep 2015  BootCurrent-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root     8  2. Sep 2015  BootOptionSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    14  2. Sep 2015  BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root     8  2. Sep 2015  BugCheckCode-ba57e015-65b3-4c3c-b274-659192f699e3

-rw-r--r--. 1 root root    12  2. Sep 2015  BugCheckParameter1-ba57e015-65b3-4c3c-b274-659192f699e3

-rw-r--r--. 1 root root     8  2. Sep 2015  BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3

-rw-r--r--. 1 root root    94  2. Sep 2015  ConIn-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   106  2. Sep 2015  ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    40  2. Sep 2015  ConOut-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    34  2. Sep 2015  ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root     8  2. Sep 2015  CpuIdCkSum-a09a3211-0d22-4733-4455-06778899aabb

-rw-r--r--. 1 root root    37  2. Sep 2015  CPUS3APICID-1456cc6e-22ac-5289-33ba-2e13bbdabaee

-rw-r--r--. 1 root root  3147  2. Sep 2015  db-d719b2cb-3d3a-4596-a3bc-dad00e67656f

-rw-r--r--. 1 root root   732  2. Sep 2015  dbx-d719b2cb-3d3a-4596-a3bc-dad00e67656f

-rw-r--r--. 1 root root     8  2. Sep 2015  DefaultBootOrder-45cf35f6-0d6e-4d04-856a-0370a5b16f53

-rw-r--r--. 1 root root    12  2. Sep 2015  DimmSPDdata-a09a3266-0d9d-476a-b8ee-0c226be16644

-rw-r--r--. 1 root root  1284  2. Sep 2015  DmiArray-4b3082a3-80c6-4d7e-9cd0-583917265df1

-rw-r--r--. 1 root root     5  2. Sep 2015  DmiVar0100020800-4b3082a3-80c6-4d7e-9cd0-583917265df1

-rw-r--r--. 1 root root    30  2. Sep 2015  DmiVar0b00000100-4b3082a3-80c6-4d7e-9cd0-583917265df1

-rw-r--r--. 1 root root    12  2. Sep 2015  DriverHealthCount-7459a7d4-6533-4480-bba7-79e25a4443c9

-rw-r--r--. 1 root root    12  2. Sep 2015  DriverHlthEnable-0885f288-418c-4be1-a6af-8bad61da08fe

-rw-r--r--. 1 root root    40  2. Sep 2015  ErrOut-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   128  2. Sep 2015  FastBootOption-b540a530-6978-4da7-91cb-7207d764d262

-rw-r--r--. 1 root root     8  2. Sep 2015  FirmwareUpdateCountVar-e08126e5-b93c-4f5e-8e81-6dfcf34ff88e

-rw-r--r--. 1 root root     8  2. Sep 2015  FPDT_Variable-01368881-c4ad-4b1d-b631-d57a8ec8db6b

-rw-r--r--. 1 root root    12  2. Sep 2015  HobRomImage-dde1bc72-d45e-4209-ab85-14462d2f5074

-rw-r--r--. 1 root root    78  2. Sep 2015  IccAdvancedSetupDataVar-7b77fb8b-1e0d-4d7e-953f-3980a261e077

-rw-r--r--. 1 root root  1564  2. Sep 2015  KEK-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root     7  2. Sep 2015  Lang-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root     7  2. Sep 2015  LangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   247  2. Sep 2015  LastBoot-b540a530-6978-4da7-91cb-7207d764d262

-rw-r--r--. 1 root root     8  2. Sep 2015  LastBootFailed-b540a530-6978-4da7-91cb-7207d764d262

-rw-r--r--. 1 root root    68  2. Sep 2015  MemoryTypeInformation-4c19049f-4137-4dd3-9c10-8b97a83ffdfa

-rw-r--r--. 1 root root   924  2. Sep 2015  MokListRT-605dab50-e046-4300-abb6-3dd810dd8b23

-rw-r--r--. 1 root root     5  2. Sep 2015  MSIHiddenFun-2a28a81a-dcbf-42f2-8366-b92fa64fe7f7

-rw-r--r--. 1 root root     8  2. Sep 2015  MsiMaiboxAddress-8c774c89-e846-4cf1-8ad3-39aa71895180

-rw-r--r--. 1 root root     8  2. Sep 2015  MXMIDVar-c2ba5cee-cd6f-4656-8313-d2eafb643aa3

-rw-r--r--. 1 root root     8  2. Sep 2015  NetworkStackVar-d1405d16-7afc-4695-bb12-41459d3695a2

-rw-r--r--. 1 root root   204  2. Sep 2015  OcCurrent-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root   204  2. Sep 2015  OcDefault-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root   204  2. Sep 2015  OcSetupData-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root    12  2. Sep 2015  OsIndicationsSupported-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root     8  2. Sep 2015  PchInit-e6c2f70a-b604-4877-85ba-deec89e117eb

-rw-r--r--. 1 root root    12  2. Sep 2015  PchInitPei-a31b27a4-cae6-48ff-8c5a-294221e6f389

-rw-r--r--. 1 root root    20  2. Sep 2015  PchS3Peim-e6c2f70a-b604-4877-85ba-deec89e117eb

-rw-r--r--. 1 root root   836  2. Sep 2015  PK-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    10  2. Sep 2015  PlatformLang-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    10  2. Sep 2015  PlatformLangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    68  2. Sep 2015  PreviousMemoryTypeInformation-4c19049f-4137-4dd3-9c10-8b97a83ffdfa

-rw-r--r--. 1 root root    12  2. Sep 2015  RSCInfoAddresss-01368881-c4ad-4b1d-b631-d57a8ec8db6b

-rw-r--r--. 1 root root    42  2. Sep 2015  RstSataV-193dfefa-a445-4302-99d8-ef3aad1a04c6

-rw-r--r--. 1 root root    12  2. Sep 2015  S3SS-4bafc2b4-02dc-4104-b236-d6f1b98d9e84

-rw-r--r--. 1 root root     5  2. Sep 2015  SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root     8  2. Sep 2015  Setup-80e1202e-2697-4264-9cc9-80762c3e5863

-rw-r--r--. 1 root root  1182  2. Sep 2015  Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root     5  2. Sep 2015  SetupMode-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    16  2. Sep 2015  SetupOcCpuFeatures-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root   132  2. Sep 2015  SignatureSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root  2570  2. Sep 2015  StdDefaults-4599d26f-1a11-49b8-b91f-858745cff824

-rw-r--r--. 1 root root     6  2. Sep 2015  Timeout-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root    21  2. Sep 2015  UIT_DATA-fe47349a-7f0d-4641-822b-34baa28ecdd0

-rw-r--r--. 1 root root    36  2. Sep 2015  UIT_HEADER-fe47349a-7f0d-4641-822b-34baa28ecdd0

-rw-r--r--. 1 root root    12  2. Sep 2015  USB_POINT-c811fa38-42c8-4579-a9bb-60e94eddfb34

-rw-r--r--. 1 root root    36  2. Sep 2015  UsbSupport-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

-rw-r--r--. 1 root root    68  2. Sep 2015  WriteOnceStatus-4b3082a3-80c6-4d7e-9cd0-583917265df1

```

so they're slightly different.

What else was weird.

The IP address changed, I'm assigning ip addr via dhcp4. Maybe it's just a random occurence.

I'll write something real quick that compares both dirs

manual comparison

```

-rw-r--r--. 1 root root  106  2. Sep 2015  ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c

-rw-r--r--. 1 root root   40  2. Sep 2015  ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c

```

differ in size

```

-rw-r--r--. 1 root root    8  2. Sep 2015  MsiMaiboxAddress-8c774c89-e846-4cf1-8ad3-39aa71895180

```

is present in nvidia

next up, content

----------

## Roman_Gruber

 *Quote:*   

> I guess I could run something like xmodmap (or what was that tool again to see which key is pressed?) and see if it has any code associated with it.

 

xev - print contents of X events

----------

## dalu

thanks tw04l124

```

for f in *; do diff $f /root/nvidia/efivars/$f;done

Binary files AcpiGlobalVariable-af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e and /root/nvidia/efivars/AcpiGlobalVariable-af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e differ

Binary files AcpiGlobalVariable-c020489e-6db2-4ef2-9aa5-ca06fc11d36a and /root/nvidia/efivars/AcpiGlobalVariable-c020489e-6db2-4ef2-9aa5-ca06fc11d36a differ

Binary files BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3 and /root/nvidia/efivars/BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3 differ

Binary files ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c and /root/nvidia/efivars/ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c differ

Binary files ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c and /root/nvidia/efivars/ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c differ

Binary files CPUS3APICID-1456cc6e-22ac-5289-33ba-2e13bbdabaee and /root/nvidia/efivars/CPUS3APICID-1456cc6e-22ac-5289-33ba-2e13bbdabaee differ

Binary files FPDT_Variable-01368881-c4ad-4b1d-b631-d57a8ec8db6b and /root/nvidia/efivars/FPDT_Variable-01368881-c4ad-4b1d-b631-d57a8ec8db6b differ

Binary files HobRomImage-dde1bc72-d45e-4209-ab85-14462d2f5074 and /root/nvidia/efivars/HobRomImage-dde1bc72-d45e-4209-ab85-14462d2f5074 differ

diff: /root/nvidia/efivars/MsiMaiboxAddress-8c774c89-e846-4cf1-8ad3-39aa71895180: No such file or directory

Binary files OcCurrent-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 and /root/nvidia/efivars/OcCurrent-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 differ

Binary files OcDefault-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 and /root/nvidia/efivars/OcDefault-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 differ

Binary files PchInit-e6c2f70a-b604-4877-85ba-deec89e117eb and /root/nvidia/efivars/PchInit-e6c2f70a-b604-4877-85ba-deec89e117eb differ

Binary files PchInitPei-a31b27a4-cae6-48ff-8c5a-294221e6f389 and /root/nvidia/efivars/PchInitPei-a31b27a4-cae6-48ff-8c5a-294221e6f389 differ

Binary files PchS3Peim-e6c2f70a-b604-4877-85ba-deec89e117eb and /root/nvidia/efivars/PchS3Peim-e6c2f70a-b604-4877-85ba-deec89e117eb differ

Binary files RSCInfoAddresss-01368881-c4ad-4b1d-b631-d57a8ec8db6b and /root/nvidia/efivars/RSCInfoAddresss-01368881-c4ad-4b1d-b631-d57a8ec8db6b differ

Binary files S3SS-4bafc2b4-02dc-4104-b236-d6f1b98d9e84 and /root/nvidia/efivars/S3SS-4bafc2b4-02dc-4104-b236-d6f1b98d9e84 differ

Binary files Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 and /root/nvidia/efivars/Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 differ

Binary files USB_POINT-c811fa38-42c8-4579-a9bb-60e94eddfb34 and /root/nvidia/efivars/USB_POINT-c811fa38-42c8-4579-a9bb-60e94eddfb34 differ

```

I think we can exclude:

ConInDev

ConOutDev

OcCurrent

OcDefault

USB_POINT

```

Binary files AcpiGlobalVariable-af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e and /root/nvidia/efivars/AcpiGlobalVariable-af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e differ

Binary files AcpiGlobalVariable-c020489e-6db2-4ef2-9aa5-ca06fc11d36a and /root/nvidia/efivars/AcpiGlobalVariable-c020489e-6db2-4ef2-9aa5-ca06fc11d36a differ

Binary files BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3 and /root/nvidia/efivars/BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3 differ

Binary files CPUS3APICID-1456cc6e-22ac-5289-33ba-2e13bbdabaee and /root/nvidia/efivars/CPUS3APICID-1456cc6e-22ac-5289-33ba-2e13bbdabaee differ

Binary files FPDT_Variable-01368881-c4ad-4b1d-b631-d57a8ec8db6b and /root/nvidia/efivars/FPDT_Variable-01368881-c4ad-4b1d-b631-d57a8ec8db6b differ

Binary files HobRomImage-dde1bc72-d45e-4209-ab85-14462d2f5074 and /root/nvidia/efivars/HobRomImage-dde1bc72-d45e-4209-ab85-14462d2f5074 differ

Binary files PchInit-e6c2f70a-b604-4877-85ba-deec89e117eb and /root/nvidia/efivars/PchInit-e6c2f70a-b604-4877-85ba-deec89e117eb differ

Binary files PchInitPei-a31b27a4-cae6-48ff-8c5a-294221e6f389 and /root/nvidia/efivars/PchInitPei-a31b27a4-cae6-48ff-8c5a-294221e6f389 differ

Binary files PchS3Peim-e6c2f70a-b604-4877-85ba-deec89e117eb and /root/nvidia/efivars/PchS3Peim-e6c2f70a-b604-4877-85ba-deec89e117eb differ

Binary files RSCInfoAddresss-01368881-c4ad-4b1d-b631-d57a8ec8db6b and /root/nvidia/efivars/RSCInfoAddresss-01368881-c4ad-4b1d-b631-d57a8ec8db6b differ

Binary files S3SS-4bafc2b4-02dc-4104-b236-d6f1b98d9e84 and /root/nvidia/efivars/S3SS-4bafc2b4-02dc-4104-b236-d6f1b98d9e84 differ

Binary files Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 and /root/nvidia/efivars/Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 differ

```

S3SS is probably s3 sleep state

RSCInfoAddresss Resource Info Addresses

Pch* Sounds like Intel Storage Controller stuff

HobRomImage ?

FPDT_Variable ? FloatingPointDistributedTransaction?  :Smile: 

 *Quote:*   

>   This module install ACPI Firmware Performance Data Table (FPDT).
> 
>   This module register report status code listener to collect performance data
> 
>   for Firmware Basic Boot Performance Record and other boot performance records, 
> ...

 

BugCheckProgress ?

and 2 ACPIGlobalVariable with different UUIDs

which leaves us with

```

AcpiGlobalVariable-af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e

AcpiGlobalVariable-c020489e-6db2-4ef2-9aa5-ca06fc11d36a

BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3

HobRomImage-dde1bc72-d45e-4209-ab85-14462d2f5074

RSCInfoAddresss-01368881-c4ad-4b1d-b631-d57a8ec8db6b

Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9

```

--

```

hexdump HobRomImage-dde1bc72-d45e-4209-ab85-14462d2f5074 

i:

0000000 0007 0000 2000 cbe6 0000 0000          

000000c

n:

0000000 0007 0000 2000 cee6 0000 0000          

000000c

```

```

hexdump Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 

i:

00003d0 0101 0101 0001 0000 0000 0000 0000 0007

00003e0 0000 0101 0001 0000 0a00 1000 6400 c80a

n:

00003d0 0101 0101 0001 0000 0000 0000 0000 0107

00003e0 0000 0101 0001 0000 0a00 1000 6400 c80a

```

```

hexdump AcpiGlobalVariable-af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e 

i:

0000000 0007 0000 9d18 db9a                    

0000008

n:

0000000 0007 0000 9e18 de9a                    

0000008

```

```

hexdump AcpiGlobalVariable-c020489e-6db2-4ef2-9aa5-ca06fc11d36a

i:

0000000 0007 0000 9c18 db9a 0000 0000          

000000c

n:

0000000 0007 0000 9d18 de9a 0000 0000          

000000c

```

```

hexdump RSCInfoAddresss-01368881-c4ad-4b1d-b631-d57a8ec8db6b 

i:

0000000 0006 0000 4c18 dbf6 0000 0000          

000000c

n:

0000000 0006 0000 4c18 def6 0000 0000          

000000c

```

```

hexdump BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3

i:

0000000 0007 0000 0000 0000                    

0000008

n:

0000000 0007 0000 0041 0000                    

0000008

```

I don't think this is getting anywhere.

Most promising values are

Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 

with a 00 01 difference

and

BugCheckProgress-ba57e015-65b3-4c3c-b274-659192f699e3

with a 00 41 difference

xev doesn't capture the keypress, probably because it's not connected to USB but the SMBus or similar.

Keys from top to bottom:

- Power

- Switch GPU

- Turbo Vent on/off

- Some Play Button to start recording/streaming the screen in Windows

- Toggle Keyboard Backlight

Big question is, how do I write to 0x03de in Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 ?

Without using C/Go

Is the /sys/firmware/efi/efivars tree writeable?

----------

## roarinelk

maybe it's a function in ACPI which can be trivially called with the acpi_call kernel module. Can you post the DSDT somewhere?

----------

## dalu

My what?

https://wiki.archlinux.org/index.php/DSDT

```

iasl -d dsdt.dat 

Intel ACPI Component Architecture

ASL+ Optimizing Compiler version 20150515-64

Copyright (c) 2000 - 2015 Intel Corporation

Reading ACPI table from file   dsdt.dat - Length 00054412 (0x00D48C)

ACPI: DSDT 0x0000000000000000 00D48C (v02 MSI_NB MEGABOOK 00000037 INTL 20120711)

Acpi table [DSDT] successfully installed and loaded

Pass 1 parse of [DSDT]

Pass 2 parse of [DSDT]

Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed

ACPI Error: External method arg count mismatch _SB_.PCI0.PEG0.PEGP.SGPO: Current 5, attempted 2 (20150515/dmextern-819)

Found 18 external control methods, reparsing with new information

Pass 1 parse of [DSDT]

Pass 2 parse of [DSDT]

Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed

Disassembly completed

ASL Output:    dsdt.dsl - 512144 bytes

iASL Warning: There were 18 external control methods found during

disassembly, but additional ACPI tables to resolve these externals

were not specified. The resulting disassembler output file may not

compile because the disassembler did not know how many arguments

to assign to these methods. To specify the tables needed to resolve

external control method references, the -e option can be used to

specify the filenames. Note: SSDTs can be dynamically loaded at

runtime and may or may not be available via the host OS.

Example iASL invocations:

    iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml

    iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml

    iasl -e ssdt*.aml -d dsdt.aml

In addition, the -fe option can be used to specify a file containing

control method external declarations with the associated method

argument counts. Each line of the file must be of the form:

    External (<method pathname>, MethodObj, <argument count>)

Invocation:

    iasl -fe refs.txt -d dsdt.aml

```

Last edited by dalu on Thu Sep 03, 2015 10:31 am; edited 2 times in total

----------

## Yamakuzure

 *dalu wrote:*   

> My what?

 Your ACPI's Differentiated System Description Table.

----------

## dalu

https://github.com/dalu/dsdt-for-gentoo-forums/blob/master/dsdt.dsl

does it make a difference if the one or other gpu is active?

----------

## dalu

http://i.imgur.com/nARpSe0.png

http://imgur.com/iYFwqo8

There's a file named MSIWmiAcpi.dll

There are some exported functions

Seems like ACPI was a good guess.

Getting another with nv active now. Shouldn't be different in theory, but who knows. The more you know..

----------

## dalu

what do you know,

1st of all the latest (352.41) nvidia driver works without the syncing issue (I had a monitor sync issue, that's why I couldn't use the official driver)

and then

pressing the "switch video" key leaves a message in dmesg

```

[  129.615601] atkbd serio0: Unknown key pressed (translated set 2, code 0x95 on isa0060/serio0).

[  129.615611] atkbd serio0: Use 'setkeycodes e015 <keycode>' to make it known.

[  129.618426] atkbd serio0: Unknown key released (translated set 2, code 0x95 on isa0060/serio0).

[  129.618438] atkbd serio0: Use 'setkeycodes e015 <keycode>' to make it known.

```

so when disassembling the windows files I could see if there's a check for 0x95 somewhere in an event handler

that is if the above means that the value is 0x95

----------

## shnyaps

Try unlock hidden options in BIOS.

There is Option to switch GPU.

I like it more than SCM application

http://www.insanelymac.com/forum/screenshots/monthly_04_2015/389cd75795dbef74aec853e4976daede-screen-shot-2015-04-28-at-104339-pm.png

----------

## Zibri

Hello!

On MSI GT72 6QD I can switch the VGA from Linux, from EFI shell and from windows.

It is done by modifying ONE bit in the EC (embedded controller) memory.

You ust find the address yourself by comparing ec memory in inten and nvidia mode.

It changes with the ec firmware version.

on version 1.09 the offset is 0x4C

you can find example sources here: https://github.com/Zibri/MSI-GT7x-VGA-SWITCH

My question for you is this: on my notebook if I dump efivars i get 64 entries but I don't have the SETUP entry...

How to have it?

----------

## Zibri

To find the offset is very easy from linux (or from windows using RW EVERYTHING and reading the EC memory 66/62.

from linux: 

# modprobe nvram

## With Nvidia

# hexdump -C /dev/nvram

00000000  00 00 40 17 01 02 03 7b  02 ff ff 29 a8 69 21 00  |..@....{...).i!.|

00000010  31 31 20 20 49 41 31 1a  20 81 b8 e5 6d 2d f5 61  |11  IA1. ...m-.a|

00000020  09 d8 ff ff 20 43 19 5e  03 e1 2d 2d 63 29 24 21  |.... C.^..--c)$!|

00000030  08 49 00 00 2e 06 e7 c8  20 64 9b 00 00 00 01 00  |.I...... d......|

00000040  00 00 00 00 01 00 00 00  00 00 00 00 00 00 f1 00  |................|

00000050  00 00 00 00 00 00 aa 55  aa 55 4b 00 00 00 00 00  |.......U.UK.....|

00000060  00 00 00 00 00 00 00 80  00 00 00 00 00 00 00 00  |................|

*

00000072

## With Intel

# hexdump -C /dev/nvram

00000000  00 00 40 17 01 02 03 7b  02 ff ff 29 a8 69 21 00  |..@....{...).i!.|

00000010  31 31 20 20 49 41 31 1a  20 81 b8 e5 6d 2d f5 61  |11  IA1. ...m-.a|

00000020  09 d8 ff ff 20 43 19 5e  03 e1 2d 2d 63 29 24 21  |.... C.^..--c)$!|

00000030  08 49 00 00 2e 06 e7 c8  20 64 9b 00 00 00 00 00  |.I...... d......|

00000040  00 00 00 00 01 00 00 00  00 00 00 00 00 00 f1 00  |................|

00000050  00 00 00 00 00 00 aa 55  aa 55 4b 00 00 00 00 00  |.......U.UK.....|

00000060  00 00 00 00 00 00 00 80  00 00 00 00 00 00 00 00  |................|

*

00000072

ONE (in my case offset 0x3e) has 1 bit difference. and that's it.

Note: in the REAL cmos memory that's offset 0x4c because nvram module doesn't show the first 14 (0x0E) bytes of the nvram which contain the RTC

         0x3E + 0x0E = 0x4cLast edited by Zibri on Tue Nov 21, 2017 11:58 am; edited 3 times in total

----------

## Zibri

Also: you are totally on the wrong path in windows.

To switch the vga from windows the safest way is this:

```
    Public Sub SwitchGFX()

        Dim mo As New ManagementObject("\root\WMI:MSI_System.InstanceName=""ACPI\\PNP0C14\\0_4""")

        mo.SetPropertyValue("System", 1)

        mo.Put()

    End Sub

```

 :Very Happy: 

----------

