File indexing completed on 2024-04-28 05:36:15

0001 /*  This file is part of the KDE project
0002  *    SPDX-FileCopyrightText: 2016 Jan Grulich <jgrulich@redhat.com>
0003  *
0004  *    SPDX-License-Identifier: LGPL-2.0-only
0005  *
0006  */
0007 
0008 #include "discretegpuhelper.h"
0009 
0010 #include <powerdevil_debug.h>
0011 
0012 #include <QFile>
0013 
0014 #define SWITCHEROO_SYSFS_PATH "/sys/kernel/debug/vgaswitcheroo/switch"
0015 
0016 DiscreteGpuHelper::DiscreteGpuHelper(QObject *parent)
0017     : QObject(parent)
0018 {
0019 }
0020 
0021 ActionReply DiscreteGpuHelper::hasdualgpu(const QVariantMap &args)
0022 {
0023     Q_UNUSED(args);
0024 
0025     ActionReply reply;
0026     reply.addData(QStringLiteral("hasdualgpu"), QFile::exists(SWITCHEROO_SYSFS_PATH));
0027     // qCDebug(POWERDEVIL) << "data contains:" << reply.data()["hasdualgpu"];
0028 
0029     return reply;
0030 }
0031 
0032 KAUTH_HELPER_MAIN("org.kde.powerdevil.discretegpuhelper", DiscreteGpuHelper)
0033 
0034 #include "moc_discretegpuhelper.cpp"