Changeset View
Changeset View
Standalone View
Standalone View
src/solid/devices/backends/iokit/iokitblock.cpp
- This file was copied from src/solid/devices/backends/iokit/iokitprocessor.cpp.
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | Copyright 2009 Harald Fernengel <harry@kdevelop.org> | 2 | Copyright 2017 René J.V. Bertin <rjvbertin@gmail.com> | ||
3 | 3 | | |||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public | ||
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either | ||
7 | version 2.1 of the License, or (at your option) version 3, or any | 7 | version 2.1 of the License, or (at your option) version 3, or any | ||
8 | later version accepted by the membership of KDE e.V. (or its | 8 | later version accepted by the membership of KDE e.V. (or its | ||
9 | successor approved by the membership of KDE e.V.), which shall | 9 | successor approved by the membership of KDE e.V.), which shall | ||
10 | act as a proxy defined in Section 6 of version 3 of the license. | 10 | act as a proxy defined in Section 6 of version 3 of the license. | ||
11 | 11 | | |||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | 15 | Lesser General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "iokitprocessor.h" | 21 | #include "iokitblock.h" | ||
22 | #include "iokitdevice.h" | | |||
23 | 22 | | |||
24 | #include <QtCore/qdebug.h> | 23 | #include "iokitdevice.h" | ||
25 | 24 | | |||
26 | using namespace Solid::Backends::IOKit; | 25 | using namespace Solid::Backends::IOKit; | ||
27 | 26 | | |||
28 | Processor::Processor(IOKitDevice *device) | 27 | Block::Block(IOKitDevice *device) | ||
29 | : DeviceInterface(device) | 28 | : DeviceInterface(device) | ||
30 | { | 29 | { | ||
31 | //IOKitDevice parent(device->parentUdi()); | | |||
32 | } | 30 | } | ||
33 | 31 | | |||
34 | Processor::~Processor() | 32 | Block::Block(const IOKitDevice *device) | ||
33 | : DeviceInterface(device) | ||||
35 | { | 34 | { | ||
36 | | ||||
37 | } | 35 | } | ||
38 | 36 | | |||
39 | int Processor::number() const | 37 | Block::~Block() | ||
40 | { | 38 | { | ||
41 | return m_device->property(QLatin1String("IOCPUNumber")).toInt(); | | |||
42 | } | 39 | } | ||
43 | 40 | | |||
44 | int Processor::maxSpeed() const | 41 | int Block::deviceMajor() const | ||
45 | { | 42 | { | ||
46 | return 0; // TODO | 43 | return m_device->property(QLatin1String("BSD Major")).toInt(); | ||
47 | } | 44 | } | ||
48 | 45 | | |||
49 | bool Processor::canChangeFrequency() const | 46 | int Block::deviceMinor() const | ||
50 | { | 47 | { | ||
51 | return false; // TODO | 48 | return m_device->property(QLatin1String("BSD Minor")).toInt(); | ||
52 | } | 49 | } | ||
53 | 50 | | |||
54 | Solid::Processor::InstructionSets Processor::instructionSets() const | 51 | QString Block::device() const | ||
55 | { | 52 | { | ||
56 | return 0; // TODO | 53 | if (m_device->iOKitPropertyExists(QStringLiteral("BSD Name"))) { | ||
54 | return QStringLiteral("/dev/") + m_device->property(QLatin1String("BSD Name")).toString(); | ||||
55 | } | ||||
56 | return QString(); | ||||
57 | } | 57 | } | ||
58 | 58 | |