Exemple #1
0
        public override bool InitializeHardware()
        {
            var adaptersCount = 0;

            AdlApi.AdlGetNumberOfAdapters(ref adaptersCount);

            if (adaptersCount <= 0)
            {
                return(false);
            }

            if (AdlApi.AldAdapterGetInfo(adaptersCount, out var adaptersInfo) != AdlApi.AdlOk)
            {
                return(false);
            }

            for (var i = 0; i < adaptersCount; i++)
            {
                if (string.IsNullOrEmpty(adaptersInfo[i].UDID) || adaptersInfo[i].VendorID != AdlApi.AtiVendorId)
                {
                    continue;
                }

                if (Hardware.Any(hwd => hwd is RadeonGpu && ((RadeonGpu)hwd).IsSameDeviceAs(adaptersInfo[i])))
                {
                    continue;
                }

                var radeonAdapter = new RadeonGpu(adaptersInfo[i]);
                ProcessAdlAdapter(radeonAdapter);
                try {
                    radeonAdapter.InitializeSensors();
                    AddHardware(radeonAdapter);
                } catch (Exception e) {
                    Logger.Error($"Unable to initialize sensors for {radeonAdapter}", e);
                }
            }

            return(true);
        }