• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
  • tdehw
tdehardwaredevices.h
1/* This file is part of the TDE libraries
2 Copyright (C) 2012-2014 Timothy Pearson <kb9vqf@pearsoncomputing.net>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18#ifndef _TDEHARDWAREDEVICES_H
19#define _TDEHARDWAREDEVICES_H
20
21
22// TDE includes
23#include <tqobject.h>
24#include <tqptrlist.h>
25#include <tqmap.h>
26#include <tqdict.h>
27#include <tqstring.h>
28#include <tqstringlist.h>
29
30#include "tdelibs_export.h"
31#include "kicontheme.h"
32
33#include "tdehwcommontypes.h"
34
35// FIXME delete those headers after complete fixing everything in over modules
36#include "tdegenericdevice.h"
37#include "kiconloader.h"
38extern "C" {
39#include <libudev.h>
40}
41#include <stdio.h>
42#include <stdlib.h>
43#include <locale.h>
44#include <unistd.h>
45#include "tdestoragedevice.h"
46#include "tdecpudevice.h"
47#include "tdebatterydevice.h"
48#include "tdemainspowerdevice.h"
49#include "tdenetworkdevice.h"
50#include "tdebacklightdevice.h"
51#include "tdemonitordevice.h"
52#include "tdesensordevice.h"
53#include "tderootsystemdevice.h"
54#include "tdeeventdevice.h"
55#include "tdeinputdevice.h"
56#include "tdecryptographiccarddevice.h"
57
63struct udev_device;
64
65class KSimpleDirWatch;
66
67class TDEGenericDevice;
68class TDEStorageDevice;
69class TDENetworkDevice;
70class TDEBacklightDevice;
71class TDEMonitorDevice;
72class TDESensorDevice;
73class TDERootSystemDevice;
74class TDEEventDevice;
75class TDEInputDevice;
76class TQSocketNotifier;
77
78typedef TQPtrList<TDEGenericDevice> TDEGenericHardwareList;
79typedef TQMap<TQString, TQString> TDEDeviceIDMap;
80typedef TQDict<TDECPUDevice> TDECPUDeviceCache;
81
82class TDECORE_EXPORT TDEHardwareDevices : public TQObject
83{
84 TQ_OBJECT
85
86 public:
90 TDEHardwareDevices();
91
95 ~TDEHardwareDevices();
96
107 bool queryHardwareInformation();
108
113 TDEGenericHardwareList listAllPhysicalDevices();
114
120 TDEGenericHardwareList listByDeviceClass(TDEGenericDeviceType::TDEGenericDeviceType cl);
121
126 TDEGenericDevice* findBySystemPath(TQString syspath);
127
132 TDEGenericDevice* findByUniqueID(TQString uid);
133
138 TDEGenericDevice* findByDeviceNode(TQString devnode);
139
144 TDEStorageDevice* findDiskByUID(TQString uid);
145
150 TDECPUDevice* findCPUBySystemPath(TQString syspath, bool inCache);
151
160 TQString findPCIDeviceName(TQString vendorid, TQString modelid, TQString subvendorid, TQString submodelid);
161
170 TQString findUSBDeviceName(TQString vendorid, TQString modelid, TQString subvendorid, TQString submodelid);
171
177 TQString findPNPDeviceName(TQString pnpid);
178
184 TQString findMonitorManufacturerName(TQString dpyid);
185
191 TQString getFriendlyDeviceTypeStringFromType(TDEGenericDeviceType::TDEGenericDeviceType query);
192
199 TQPixmap getDeviceTypeIconFromType(TDEGenericDeviceType::TDEGenericDeviceType query, TDEIcon::StdSizes size);
200
205 TDERootSystemDevice* rootSystemDevice();
206
216 void rescanDeviceInformation(TDEGenericDevice* hwdevice, udev_device* dev = NULL, bool regenerateDeviceTree = true);
217
225 void setTriggerlessHardwareUpdatesEnabled(bool enable);
226
234 void setBatteryUpdatesEnabled(bool enable);
235
241 static TQString bytesToFriendlySizeString(double bytes);
242
243 signals:
244 void hardwareAdded(TDEGenericDevice*);
245 void hardwareRemoved(TDEGenericDevice*);
246 void hardwareUpdated(TDEGenericDevice*);
247
253 void eventDeviceKeyPressed(unsigned int keycode, TDEEventDevice* device);
254
255 private slots:
256 void processHotPluggedHardware();
257 void processModifiedMounts();
258 void processModifiedCPUs();
259 void processBatteryDevices();
260 void processStatelessDevices();
261 void processEventDeviceKeyPressed(unsigned int keycode, TDEEventDevice* edevice);
262
263 private:
264 void updateBlacklists(TDEGenericDevice* hwdevice, udev_device* dev);
265
266 private:
267 TDEGenericDevice *classifyUnknownDevice(udev_device* dev, TDEGenericDevice* existingdevice=0, bool force_full_classification=true);
268 TDEGenericDevice *classifyUnknownDeviceByExternalRules(udev_device* dev, TDEGenericDevice* existingdevice=0, bool classifySubDevices=false);
269 void updateExistingDeviceInformation(TDEGenericDevice *device, udev_device *dev=NULL);
270
271 void updateParentDeviceInformation();
272 void updateParentDeviceInformation(TDEGenericDevice* hwdevice);
273
274 void addCoreSystemDevices();
275
280 TQByteArray getEDID(TQString path);
281
286 TQPair<TQString,TQString> getEDIDMonitorName(TQString path);
287
288 struct udev *m_udevStruct;
289 struct udev_monitor *m_udevMonitorStruct;
290 TDEGenericHardwareList m_deviceList;
291 int m_procMountsFd;
292 KSimpleDirWatch* m_cpuWatch;
293 TQTimer* m_cpuWatchTimer;
294 TQTimer* m_batteryWatchTimer;
295 TQTimer* m_deviceWatchTimer;
296
297 TQSocketNotifier* m_devScanNotifier;
298 TQSocketNotifier* m_mountScanNotifier;
299
300 TQMap<TQString, bool> m_mountTable;
301 TQStringList m_cpuInfo;
302
303 TDEDeviceIDMap* pci_id_map;
304 TDEDeviceIDMap* usb_id_map;
305 TDEDeviceIDMap* pnp_id_map;
306 TDEDeviceIDMap* dpy_id_map;
307
308 TDECPUDeviceCache m_cpuByPathCache;
309 TQStringList m_unclassifiedDevices;
310
311 friend class TDEGenericDevice;
312 friend class TDEStorageDevice;
313 friend class TDECPUDevice;
314};
315
316#endif // _TDEHARDWAREDEVICES_H
KSimpleDirWatch
KSimpleDirWatch is a basic copy of KDirWatch but with the TDEIO linking requirement removed.
Definition: ksimpledirwatch.h:67
TDEIcon::StdSizes
StdSizes
These are the standard sizes for icons.
Definition: kicontheme.h:112

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.