Commit 225ae398 authored by Tobias C. Berner's avatar Tobias C. Berner Committed by Adriaan de Groot
Browse files

kcm_pci: add support for pciconf for FreeBSD

Summary:
* add search module for pciconf binary
* prefer pciconf over lspci if found (maybe add an option to override?)
* add backend.h containing 'pciconv -lv' respectively 'lscpi -v'

Test Plan:

Reviewers: #freebsd

Subscribers:
parent c74b4539
......@@ -4,6 +4,20 @@
find_package(lspci)
set_package_properties(lspci PROPERTIES TYPE RUNTIME)
find_package(pciconf)
set_package_properties(pciconf PROPERTIES TYPE RUNTIME)
if(pciconf_FOUND)
set(PCI_BACKEND pciconf)
set(PCI_BACKEND_ARGUMENTS "-lv")
else()
set(PCI_BACKEND lspci)
set(PCI_BACKEND_ARGUMENTS "-v")
endif()
configure_file(kcm_pci.json.cmake kcm_pci.json)
configure_file(backend.h.cmake backend.h)
add_definitions(-DTRANSLATION_DOMAIN=\"kcm_pci\")
add_library(kcm_pci MODULE main.cpp)
......
#cmakedefine PCI_BACKEND "@PCI_BACKEND@"
#cmakedefine PCI_BACKEND_ARGUMENTS "@PCI_BACKEND_ARGUMENTS@"
......@@ -125,7 +125,7 @@
"Name[zh_CN]": "PCI",
"Name[zh_TW]": "PCI"
},
"TryExec": "lspci",
"TryExec": "@PCI_BACKEND@",
"X-KDE-KInfoCenter-Category": "device_information",
"X-KDE-Keywords": "PCI,PCI-Devices,PCI-Bus,System Information",
"X-KDE-Keywords[ar]": "PCI,أجهزة PCI,PCI-Bus,معلومات النّظام",
......
/*
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
SPDX-FileCopyrightText: 2021 Harald Sitter <sitter@kde.org>
SPDX-FileCopyrightText: 2022 Tobias C. Berner <tcberner@FreeBSD.org>
*/
#include <KAboutData>
......@@ -10,6 +11,8 @@
#include <CommandOutputContext.h>
#include "backend.h"
class KCMXServer : public KQuickAddons::ConfigModule
{
Q_OBJECT
......@@ -17,7 +20,7 @@ public:
explicit KCMXServer(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: ConfigModule(parent, data, args)
{
auto outputContext = new CommandOutputContext(QStringLiteral("lspci"), {QStringLiteral("-v")}, parent);
auto outputContext = new CommandOutputContext(QStringLiteral(PCI_BACKEND), {QStringLiteral(PCI_BACKEND_ARGUMENTS)}, parent);
qmlRegisterSingletonInstance("org.kde.kinfocenter.pci.private", 1, 0, "InfoOutputContext", outputContext);
auto *about = new KAboutData(QStringLiteral("kcm_pci"), i18nc("@label kcm name", "PCI"), QStringLiteral("1.0"), QString(), KAboutLicense::GPL);
......
# This module defines the following variables:
#
# pciconf_FOUND - true if found
# pciconf_PATH - path to the bin (only when found)
#
# SPDX-License-Identifier: BSD-2-Clause
# SPDX-FileCopyrightText: 2022 Tobias C. Berner <tcberner@FreeBSD.org>
include(ProgramFinder)
program_finder(pciconf)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment