-2

What is in Linux the equivalent code of this vb.net snipplet:

    Public Sub SwitchGFX() 
' Switches GFX card on MSI Notebooks
' Coded by Zibri http://www.zibri.org
        Dim mo As New ManagementObject("\root\WMI:MSI_System.InstanceName=""ACPI\\PNP0C14\\0_4""")
        mo.SetPropertyValue("System", 1)
        mo.Put()
    End Sub

Or this windows shell command:

wmic /namespace:\\root\wmi path MSI_System.InstanceName="ACPI\\PNP0C14\\0_4" set System=0
wmic /namespace:\\root\wmi path MSI_System.InstanceName="ACPI\\PNP0C14\\0_4" set System=1

P.S. This code switches the VGA from Intel to NVIDIA on a MSI Notebook.

0

2 Answers 2

-1

WMI will most likely not work on Linux as it requires Windows's WMI service. However, this article mentions how you can switch to another GPU via a terminal command (see the bottom of Step 4). So combined with some research in how you can run Linux terminal commands from .NET (the answer appears to be Bash, by the way), I suppose this could be a potential solution:

Public Sub SwitchToNVIDIA()
    Process.Start("/bin/bash", "prime-select nvidia")
End Sub

Public Sub SwitchToIntel()
    Process.Start("/bin/bash", "prime-select intel")
End Sub
Sign up to request clarification or add additional context in comments.

6 Comments

Nope. I can switch graphic card using wmi in WINDOWS (I reversed MSI utility and understood how to do it). I need to to the same in linux and YES: there is a way to access wmi from linux.. look at fwts. What you posted is a dot.net program that runs bash.. I am ON LINUX.
@Zibri : Of course it's a .NET program! Isn't that what you asked for? You can run .NET applications on Linux via Mono!
Linux is not a programming language, so what language do you want it in then? If it wasn't VB.NET you wanted then your question is very unclear.
@Zibri : And why do you so badly want it to be WMI? Is there anything wrong with those two short bash commands?
I will be more clear: that article does not apply to my laptop. prime-select does not work. It switched the videocard in a proprietary way. To do so it uses mapped bios entries in WMI... on windows I have no problems do it programatically because I reversed their software and understood how to do it. On linux there is no way at the moment. The only way would be to use WMI (mapped in linux!) or a direct bios nvram write (which I will probably do). This has nothing to do with VB NET or MONO. Because even having the full .NET on linux, we would not have that WMI entry mapped.
|
-1

Nevermind. I reversed the MSI software and replicated the switch on Linux and in efi shell. Now windows is not needed anymore to switch graphic cards.

I will post everything on my website http://www.zibri.org

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.