Jump to content

Graphics Card device disappearing: Surface Book 2


red0fireus
 Share

Recommended Posts

Hello, I'm a college student, and I have a Surface Book 2. Currently Microsoft has a stick up their ass and Windows Surface Books, after the 1903 windows update, have issues where the graphics card disconnects from the computer for no reason. (They still haven't fixed it)

I have the Surface Book 2 13.5 Inch with a 1050 graphics card.

I was looking for a fix online and decided to code something to try and fix it. I found that if I scan for hardware changes on the Device Manager then the graphics card will reappear. *Face Palm* I went and downloaded Devcon.exe last night and looked for example code online on how to check if a device no longer exists and if it doesn't then do "devcon rescan" and I'm going to assume this works. 

 

If anyone has any better ideas, please post some. I've checked Reddit on how to fix this, and I've installed the Surface Book 2 Drivers. No Luck. Any recommendations would be helpful
Things I've tried:

  • Updating Windows to the Skip Beta version
  • Reinstalling the Drivers multiple times with many different scenarios
  • Checking for Updates (A lot)
  • Uninstalling Software
  • Running software as Administrator
  • Cleaning the Devices Metal connector with Isopropyl alcohol 91% (Someone recommended it on Reddit)
  • Installing the new NVIDIA graphic drivers (this just made it worse)
    • Current Drivers:
      • NVIDIA Update 31.1.10.0
      • NVIDIA Graphics Driver 391.40
  • Uninstalling the Graphic Drivers in Safe Mode with DDU Uninstaller
#include "DeviceAPI.au3"

$DeviceName = "NVIDIA Geforce GTX 1050"
$DeviceClass = "Display adapters"
;$objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2")
;$m_MediaConnectWatcher = $objWMIService.ExecNotificationQuery("SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_DiskDrive'")


Do
ConsoleWrite(@CRLF & "Checking for [" & $DeviceName & "]...")
Sleep(5000)
Until HWDevice_Detect($DeviceName, $DeviceClass) = True

Func HWDevice_Detect($devicename, $classname)
Local $DeviceListed = False
Local $aClasses = _DeviceAPI_GetClassArray()
For $X = 0 to Ubound($aClasses)-1
     If $aClasses[$X][2] = $classname Then
         Local $aDevices = _DeviceAPI_GetDeviceArray($aClasses[$X][0])
         For $Y = 0 to Ubound($aDevices)-1
         If $aDevices[$Y][1] = $devicename Then
             $DeviceListed = True
         EndIf
     Next
     EndIf
Next

If $DeviceListed = True Then
    Sleep(1000)
Else
    Run(@Comspec & " /c " & "devcon rescan")
EndIf
EndFunc

This is the code i found and i tried to edit it but it doesn't work for what i need. It exits after it's true. I need it to constantly scan (and not cause high CPU usage) if that's possible. I was thinking scan every 15min?

Proof of issue: Link Here to Microsoft

Edited by red0fireus
Link to comment
Share on other sites

@red0fireus

Replace the Do...Until loop with a While 1 loop, add an HotKeySet() to exit the script, and an AdLibRegister() before everything (after includes), to run the code every amount of milliseconds.

Something like this:

; #include ...

AdLibRegister("FunctionToRun") ; AdLibRegister runs the function every 250 ms by default

HotKeySet("{ESC}", "ExitScript")

While 1
    Sleep(100)
WEnd

Func ExitScript()
    Exit
EndFunc

Func FunctionToRun()
    ; ...
EndFunc

:)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

#include "DeviceAPI.au3"

$DeviceName = "NVIDIA Geforce GTX 1050"
$classname = "Display adapters"
;$objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2")
;$m_MediaConnectWatcher = $objWMIService.ExecNotificationQuery("SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_DiskDrive'")

AdLibRegister("HWDevice_Detect")

While 1
;   ConsoleWrite(@CRLF & "Checking for [" & $DeviceName & "]...")
   Sleep(5000)
WEnd

Func HWDevice_Detect($devicename, $classname)
   Local $DeviceListed = False
   Local $aClasses = _DeviceAPI_GetClassArray()
   For $X = 0 to Ubound($aClasses)-1
      If $aClasses[$X][2] = $classname Then
         Local $aDevices = _DeviceAPI_GetDeviceArray($aClasses[$X][0])
         For $Y = 0 to Ubound($aDevices)-1
         If $aDevices[$Y][1] = $devicename Then
            $DeviceListed = True
         EndIf
      Next
      EndIf
Next

If $DeviceListed = True Then
   ConsoleWrite("Device active")
   Exit
;   AdlibUnRegister("HWDevice_Detect")
Else
   ConsoleWrite("Device Deactive")
   Exit
;    Run(@Comspec & " /c " & "devcon rescan")
EndIf
EndFunc

I changed it a bit and got it somewhat working. Now the issue is getting it to check correctly and repeatedly. It checks correctly first and then i have to exit or it will switch to deactive

Edited by red0fireus
Link to comment
Share on other sites

#include "DeviceAPI.au3"

$DeviceName = "NVIDIA Geforce GTX 1050"
$classname = "Display adapters"
;$objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2")
;$m_MediaConnectWatcher = $objWMIService.ExecNotificationQuery("SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_DiskDrive'")

AdLibRegister("HWDevice_Detect")

While 1
;   ConsoleWrite(@CRLF & "Checking for [" & $DeviceName & "]...")
   Sleep(5000)
WEnd

Func HWDevice_Detect($devicename, $classname)
   Local $DeviceListed = False
   Local $aClasses = _DeviceAPI_GetClassArray()
   For $X = 0 to Ubound($aClasses)-1
      If $aClasses[$X][2] = $classname Then
         Local $aDevices = _DeviceAPI_GetDeviceArray($aClasses[$X][0])
         For $Y = 0 to Ubound($aDevices)-1
         If $aDevices[$Y][1] = $devicename Then
            $DeviceListed = True
         EndIf
      Next
      EndIf
Next

If $DeviceListed = True Then
   Do
      ConsoleWrite("Device Active")
      sleep(2000)
   Until $DeviceListed = False
;   AdlibUnRegister("HWDevice_Detect")
ElseIf $DeviceListed = False then
   Do
      ConsoleWrite("Device Deactive")
      sleep(2000)
   Until $DeviceListed = True
;    Run(@Comspec & " /c " & "devcon rescan")
EndIf
EndFunc

I got the script working, i just need it to update when it's running. Right now even when the graphics card is connected or disconnected it will still say the same thing.

When I run the script and the device is active and then if I temporarily disconnected the Graphics card, it says graphics card is still active and vise versa

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...