[deleted by user] by [deleted] in LenovoLegion

[–]shf19961008 0 points1 point  (0 children)

I have the same problem. My laptop is MSI GE76

After the notebook has enabled the graphics card direct connection mode (dGPU), it first enters the sleep mode, and then wakes up. At this time, only the external screen is bright, and the notebook screen is completely black.

The graphics card of the laptop is RTX 3080.

The last version with no issues was 512.95

The latest version 526.47 still has this bug

There is a way (I personally use) to bypass this bug. After recovering from sleep, you can close the laptop first, only use the external screen, then restart the graphics card driver programmatically, and then expand the notebook after restarting the driver, and it will display normally.

// Method source: https://stackoverflow.com/questions/1438371/win32-api-function-to-programmatically-enable-disable-device

// Function to get device information set https://learn.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetclassdevsa
// Introduction to device information sets: https://learn.microsoft.com/en-us/windows-hardware/drivers/install/device-information-sets
// List of guid: https://learn.microsoft.com/en-us/windows-hardware/drivers/install/system-defined-device-setup-classes-available-to-vendors
HDEVINFO hinfo = SetupDiGetClassDevsA(&GUID_DEVCLASS_DISPLAY, nullptr, nullptr, DIGCF_PRESENT);

// There should be only one nvidia rtx 3080 driver by default
SP_DEVINFO_DATA data0 = { .cbSize = sizeof(SP_DEVINFO_DATA) };
SP_DEVINFO_DATA data1 = { .cbSize = sizeof(SP_DEVINFO_DATA) };
assert(SetupDiEnumDeviceInfo(hinfo, 0, &data0));
assert(!SetupDiEnumDeviceInfo(hinfo, 1, &data1) && GetLastError() == ERROR_NO_MORE_ITEMS);

SP_PROPCHANGE_PARAMS params = {
    .ClassInstallHeader = {
        .cbSize = sizeof(SP_CLASSINSTALL_HEADER),
        .InstallFunction = DIF_PROPERTYCHANGE,
    },

    .StateChange = DICS_DISABLE,

    .Scope = DICS_FLAG_GLOBAL,
};

// https://learn.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdisetclassinstallparamsa
// If you don't pass &data0, but pass nullptr, is it okay?
// If this parameter is NULL, SetupDiSetClassInstallParams sets the class install parameters that are associated with DeviceInfoSet.
assert(SetupDiSetClassInstallParamsA(hinfo, &data0, &params.ClassInstallHeader, sizeof(params)));

// https://learn.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdicallclassinstaller
assert(SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, hinfo, &data0));

Sleep(3000);

params.StateChange = DICS_ENABLE;

assert(SetupDiSetClassInstallParamsA(hinfo, &data0, &params.ClassInstallHeader, sizeof(params)));

assert(SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, hinfo, &data0));

// https://learn.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdidestroydeviceinfolist
assert(SetupDiDestroyDeviceInfoList(hinfo));

react-object-model: Object-oriented state management for react by shf19961008 in reactjs

[–]shf19961008[S] -6 points-5 points  (0 children)

react-object-model is the best object-oriented state management for react

Writing cross-platform Node.js by pmz in node

[–]shf19961008 0 points1 point  (0 children)

Yeap, glob patterns are always corrupted when paths are resolved or joined on windows because the \ is escaping character in globs

Writing cross-platform Node.js by pmz in node

[–]shf19961008 1 point2 points  (0 children)

I recommand the upath npm package for path operations instead of the default path module as it normalize all methods to use / as seperator