Darrell Anderson 13 years ago
commit 364c969aff

@ -1,4 +1,5 @@
[Conditions] [Conditions]
SUBSYSTEM=block
DRIVER=floppy DRIVER=floppy
[DeviceType] [DeviceType]

File diff suppressed because it is too large Load Diff

@ -23,6 +23,7 @@
#include <tqstring.h> #include <tqstring.h>
#include <tqptrlist.h> #include <tqptrlist.h>
#include <tqstringlist.h> #include <tqstringlist.h>
#include "kiconloader.h"
#include "tdelibs_export.h" #include "tdelibs_export.h"
// udev includes // udev includes
@ -38,15 +39,19 @@
* @author Timothy Pearson * @author Timothy Pearson
*/ */
// Keep readGenericDeviceTypeFromString() in tdehardwaredevices.cpp in sync with this enum // Keep readGenericDeviceTypeFromString(), getFriendlyDeviceTypeStringFromType(), and getDeviceTypeIconFromType() in tdehardwaredevices.cpp in sync with this enum
namespace TDEGenericDeviceType { namespace TDEGenericDeviceType {
enum TDEGenericDeviceType { enum TDEGenericDeviceType {
Root, Root,
CPU, CPU,
GPU, GPU,
RAM, RAM,
Bus,
I2C,
MDIO,
Mainboard, Mainboard,
Disk, Disk,
SCSI,
StorageController, StorageController,
Mouse, Mouse,
Keyboard, Keyboard,
@ -55,19 +60,29 @@ enum TDEGenericDeviceType {
Printer, Printer,
Scanner, Scanner,
Sound, Sound,
VideoCapture,
IEEE1394, IEEE1394,
Camera, Camera,
TextIO, TextIO,
Serial,
Parallel,
Peripheral, Peripheral,
Battery, Battery,
Power, Power,
Dock,
ThermalSensor, ThermalSensor,
ThermalControl, ThermalControl,
Bridge,
Platform,
PNP,
OtherACPI, OtherACPI,
OtherUSB, OtherUSB,
OtherMultimedia,
OtherPeripheral, OtherPeripheral,
OtherSensor, OtherSensor,
Other OtherVirtual,
Other,
Last = Other
}; };
}; };
@ -202,6 +217,14 @@ class TDECORE_EXPORT TDEGenericDevice
*/ */
void setVendorModel(TQString vm); void setVendorModel(TQString vm);
/**
* @return a TQString with a friendly name
*
* While TDE tries very hard to generate and return a friendly name for this device,
* sometimes the best it will be able to do is "Unknown Device [xxxx:yyyy]"
*/
virtual TQString friendlyName();
/** /**
* @return a TQString with the device bus name, if any * @return a TQString with the device bus name, if any
*/ */
@ -270,6 +293,71 @@ class TDECORE_EXPORT TDEGenericDevice
*/ */
TQString &modelID(); TQString &modelID();
/**
* @param a TQString with the model ID, if any
*/
void setModelID(TQString id);
/**
* @return a TQString with the subvendor ID, if any
*/
TQString &subVendorID();
/**
* @param a TQString with the subvendor ID, if any
*/
void setSubVendorID(TQString id);
/**
* @return a TQString with the submodel ID, if any
*/
TQString &subModelID();
/**
* @param a TQString with the submodel ID, if any
*/
void setSubModelID(TQString id);
/**
* @return a TQString with the PCI device class, if any
*/
TQString &PCIClass();
/**
* @param a TQString with the PCI device class, if any
*/
void setPCIClass(TQString cl);
/**
* @return a TQString with the module alias string, if any
*/
TQString &moduleAlias();
/**
* @param a TQString with the module alias string, if any
*/
void setModuleAlias(TQString ma);
/**
* @return a TQString with the device driver, if any
*/
TQString &deviceDriver();
/**
* @param a TQString with the device driver, if any
*/
void setDeviceDriver(TQString dr);
/**
* @return a TQString with the subsystem type, if any
*/
TQString &subsystem();
/**
* @param a TQString with the subsystem type, if any
*/
void setSubsystem(TQString ss);
/** /**
* @param a TDEGenericDevice* with the parent device, if any * @param a TDEGenericDevice* with the parent device, if any
*/ */
@ -281,9 +369,21 @@ class TDECORE_EXPORT TDEGenericDevice
TDEGenericDevice* parentDevice(); TDEGenericDevice* parentDevice();
/** /**
* @param a TQString with the model ID, if any * @return a TQString containing the friendly type name
*/ */
void setModelID(TQString id); virtual TQString friendlyDeviceType();
/**
* @return a TQString containing the device bus ID, if any
*/
TQString busID();
/**
* Get an icon for this device
* @param size a KIcon::StdSizes structure specifying the desired icon size
* @return a TQPixmap containing the icon for the specified type
*/
virtual TQPixmap icon(KIcon::StdSizes size);
private: private:
TDEGenericDeviceType::TDEGenericDeviceType m_deviceType; TDEGenericDeviceType::TDEGenericDeviceType m_deviceType;
@ -296,6 +396,13 @@ class TDECORE_EXPORT TDEGenericDevice
TQString m_uniqueID; TQString m_uniqueID;
TQString m_vendorID; TQString m_vendorID;
TQString m_modelID; TQString m_modelID;
TQString m_subvendorID;
TQString m_submodelID;
TQString m_pciClass;
TQString m_modAlias;
TQString m_deviceDriver;
TQString m_subsystem;
TQString m_friendlyName;
bool m_blacklistedForUpdate; bool m_blacklistedForUpdate;
TDEGenericDevice* m_parentDevice; TDEGenericDevice* m_parentDevice;
@ -470,6 +577,29 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
*/ */
TQString deviceFriendlySize(); TQString deviceFriendlySize();
/**
* Get an icon for this device
* @param size a KIcon::StdSizes structure specifying the desired icon size
* @return a TQPixmap containing the icon for the specified type
*
* This method overrides TDEGenericDevice::icon(KIcon::StdSizes size)
*/
TQPixmap icon(KIcon::StdSizes size);
/**
* @return a TQString with a friendly name
*
* This method overrides TDEGenericDevice::friendlyName()
*/
TQString friendlyName();
/**
* @return a TQString containing the friendly type name
*
* This method overrides TDEGenericDevice::friendlyDeviceType()
*/
TQString friendlyDeviceType();
private: private:
TDEDiskDeviceType::TDEDiskDeviceType m_diskType; TDEDiskDeviceType::TDEDiskDeviceType m_diskType;
TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus; TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus;
@ -484,6 +614,7 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
}; };
typedef TQPtrList<TDEGenericDevice> TDEGenericHardwareList; typedef TQPtrList<TDEGenericDevice> TDEGenericHardwareList;
typedef TQMap<TQString, TQString> TDEDeviceIDMap;
class TQSocketNotifier; class TQSocketNotifier;
@ -545,6 +676,41 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject
*/ */
TDEStorageDevice* findDiskByUID(TQString uid); TDEStorageDevice* findDiskByUID(TQString uid);
/**
* Look up the device in the system PCI database
* @param vendorid a TQString containing the vendor ID in hexadecimal
* @param modelid a TQString containing the model ID in hexadecimal
* @param subvendorid a TQString containing the subvendor ID in hexadecimal
* @param submodelid a TQString containing the submodel ID in hexadecimal
* @return a TQString containing the device name, if found
*/
TQString findPCIDeviceName(TQString vendorid, TQString modelid, TQString subvendorid, TQString submodelid);
/**
* Look up the device in the system USB database
* @param vendorid a TQString containing the vendor ID in hexadecimal
* @param modelid a TQString containing the model ID in hexadecimal
* @param subvendorid a TQString containing the subvendor ID in hexadecimal
* @param submodelid a TQString containing the submodel ID in hexadecimal
* @return a TQString containing the device name, if found
*/
TQString findUSBDeviceName(TQString vendorid, TQString modelid, TQString subvendorid, TQString submodelid);
/**
* Get a friendly string describing a device type
* @param query a TDEGenericDeviceType::TDEGenericDeviceType specifying a device type
* @return a TQString containing the friendly type name
*/
TQString getFriendlyDeviceTypeStringFromType(TDEGenericDeviceType::TDEGenericDeviceType query);
/**
* Get an icon for a device type
* @param query a TDEGenericDeviceType::TDEGenericDeviceType specifying a device type
* @param size a KIcon::StdSizes structure specifying the desired icon size
* @return a TQPixmap containing the icon for the specified type
*/
TQPixmap getDeviceTypeIconFromType(TDEGenericDeviceType::TDEGenericDeviceType query, KIcon::StdSizes size);
signals: signals:
void hardwareAdded(TDEGenericDevice*); void hardwareAdded(TDEGenericDevice*);
void hardwareRemoved(TDEGenericDevice*); void hardwareRemoved(TDEGenericDevice*);
@ -578,6 +744,9 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject
TQStringList m_mountTable; TQStringList m_mountTable;
TDEDeviceIDMap* pci_id_map;
TDEDeviceIDMap* usb_id_map;
friend class TDEGenericDevice; friend class TDEGenericDevice;
friend class TDEStorageDevice; friend class TDEStorageDevice;
}; };

Loading…
Cancel
Save