summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehw/tdehardwaredevices.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdecore/tdehw/tdehardwaredevices.cpp')
-rw-r--r--tdecore/tdehw/tdehardwaredevices.cpp244
1 files changed, 94 insertions, 150 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp
index 28a0f44d2..f54b1e138 100644
--- a/tdecore/tdehw/tdehardwaredevices.cpp
+++ b/tdecore/tdehw/tdehardwaredevices.cpp
@@ -89,22 +89,13 @@ timespec diff(timespec start, timespec end)
return temp;
}
-// BEGIN BLOCK
-// Copied from include/linux/genhd.h
-#define GENHD_FL_REMOVABLE 1
-#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4
-#define GENHD_FL_CD 8
-#define GENHD_FL_UP 16
-#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
-#define GENHD_FL_EXT_DEVT 64
-#define GENHD_FL_NATIVE_CAPACITY 128
-#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256
-// END BLOCK
-
// NOTE TO DEVELOPERS
// This command will greatly help when attempting to find properties to distinguish one device from another
// udevadm info --query=all --path=/sys/....
+// Some local utility functions and constants
+namespace {
+
// This routine is courtsey of an answer on "Stack Overflow"
// It takes an LSB-first int and makes it an MSB-first int (or vice versa)
unsigned int reverse_bits(unsigned int x)
@@ -116,9 +107,29 @@ unsigned int reverse_bits(unsigned int x)
return((x >> 16) | (x << 16));
}
+// Read the content of a file that supposed to contain a single line
+TQString readLineFile(TQString fname) {
+ TQFile file( fname );
+ if ( file.open( IO_ReadOnly ) ) {
+ TQTextStream stream( &file );
+ return stream.readLine();
+ } else {
+ return TQString::null;
+ }
+}
+
+} // namespace
+
// Helper function implemented in tdestoragedevice.cpp
TQString decodeHexEncoding(TQString str);
+extern "C" {
+ KDE_EXPORT TDEHardwareDevices* create_tdeHardwareDevices()
+ {
+ return new TDEHardwareDevices();
+ }
+}
+
TDEHardwareDevices::TDEHardwareDevices() {
// Initialize members
pci_id_map = 0;
@@ -144,7 +155,7 @@ TDEHardwareDevices::TDEHardwareDevices() {
int udevmonitorfd = udev_monitor_get_fd(m_udevMonitorStruct);
if (udevmonitorfd >= 0) {
m_devScanNotifier = new TQSocketNotifier(udevmonitorfd, TQSocketNotifier::Read, this);
- connect( m_devScanNotifier, TQT_SIGNAL(activated(int)), this, TQT_SLOT(processHotPluggedHardware()) );
+ connect( m_devScanNotifier, TQ_SIGNAL(activated(int)), this, TQ_SLOT(processHotPluggedHardware()) );
}
// Read in the current mount table
@@ -166,7 +177,7 @@ TDEHardwareDevices::TDEHardwareDevices() {
m_procMountsFd = open("/proc/mounts", O_RDONLY, 0);
if (m_procMountsFd >= 0) {
m_mountScanNotifier = new TQSocketNotifier(m_procMountsFd, TQSocketNotifier::Exception, this);
- connect( m_mountScanNotifier, TQT_SIGNAL(activated(int)), this, TQT_SLOT(processModifiedMounts()) );
+ connect( m_mountScanNotifier, TQ_SIGNAL(activated(int)), this, TQ_SLOT(processModifiedMounts()) );
}
// Read in the current cpu information
@@ -188,22 +199,22 @@ TDEHardwareDevices::TDEHardwareDevices() {
// Monitor for changed cpu information
// Watched directories are set up during the initial CPU scan
m_cpuWatch = new KSimpleDirWatch(this);
- connect( m_cpuWatch, TQT_SIGNAL(dirty(const TQString &)), this, TQT_SLOT(processModifiedCPUs()) );
+ connect( m_cpuWatch, TQ_SIGNAL(dirty(const TQString &)), this, TQ_SLOT(processModifiedCPUs()) );
#else
m_cpuWatchTimer = new TQTimer(this);
- connect( m_cpuWatchTimer, SIGNAL(timeout()), this, SLOT(processModifiedCPUs()) );
+ connect( m_cpuWatchTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(processModifiedCPUs()) );
#endif
// Some devices do not receive update signals from udev
// These devices must be polled, and a good polling interval is 1 second
m_deviceWatchTimer = new TQTimer(this);
- connect( m_deviceWatchTimer, SIGNAL(timeout()), this, SLOT(processStatelessDevices()) );
+ connect( m_deviceWatchTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(processStatelessDevices()) );
// Special case for battery and power supply polling (longer delay, 5 seconds)
m_batteryWatchTimer = new TQTimer(this);
- connect( m_batteryWatchTimer, SIGNAL(timeout()), this, SLOT(processBatteryDevices()) );
+ connect( m_batteryWatchTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(processBatteryDevices()) );
- // Update internal device information
+ // Update internal device information.
queryHardwareInformation();
}
}
@@ -274,18 +285,21 @@ void TDEHardwareDevices::setBatteryUpdatesEnabled(bool enable) {
}
}
-void TDEHardwareDevices::rescanDeviceInformation(TDEGenericDevice* hwdevice) {
- rescanDeviceInformation(hwdevice, true);
-}
-
-void TDEHardwareDevices::rescanDeviceInformation(TDEGenericDevice* hwdevice, bool regenerateDeviceTree) {
- struct udev_device *dev;
- dev = udev_device_new_from_syspath(m_udevStruct, hwdevice->systemPath().ascii());
- updateExistingDeviceInformation(hwdevice);
+void TDEHardwareDevices::rescanDeviceInformation(TDEGenericDevice* hwdevice, udev_device* dev, bool regenerateDeviceTree) {
+ bool toUnref = false;
+ if (!dev)
+ {
+ dev = udev_device_new_from_syspath(m_udevStruct, hwdevice->systemPath().ascii());
+ toUnref = true;
+ }
+ updateExistingDeviceInformation(hwdevice, dev);
if (regenerateDeviceTree) {
updateParentDeviceInformation(hwdevice); // Update parent/child tables for this device
}
- udev_device_unref(dev);
+ if (toUnref)
+ {
+ udev_device_unref(dev);
+ }
}
TDEGenericDevice* TDEHardwareDevices::findBySystemPath(TQString syspath) {
@@ -382,8 +396,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
TDEGenericDevice *device = classifyUnknownDevice(dev);
// Make sure this device is not a duplicate
- TDEGenericDevice *hwdevice;
- for (hwdevice = m_deviceList.first(); hwdevice; hwdevice = m_deviceList.next()) {
+ for (TDEGenericDevice *hwdevice = m_deviceList.first(); hwdevice; hwdevice = m_deviceList.next()) {
if (hwdevice->systemPath() == device->systemPath()) {
delete device;
device = 0;
@@ -395,7 +408,18 @@ void TDEHardwareDevices::processHotPluggedHardware() {
m_deviceList.append(device);
updateParentDeviceInformation(device); // Update parent/child tables for this device
emit hardwareAdded(device);
- emit hardwareEvent(TDEHardwareEvent::HardwareAdded, device->uniqueID());
+ if (device->type() == TDEGenericDeviceType::Disk) {
+ // Make sure slave status is also updated
+ TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
+ TQStringList slavedevices = sdevice->slaveDevices();
+ for (TQStringList::Iterator slaveit = slavedevices.begin(); slaveit != slavedevices.end(); ++slaveit) {
+ TDEGenericDevice* slavedevice = findBySystemPath(*slaveit);
+ if (slavedevice && slavedevice->type() == TDEGenericDeviceType::Disk) {
+ rescanDeviceInformation(slavedevice);
+ emit hardwareUpdated(slavedevice);
+ }
+ }
+ }
}
}
else if (actionevent == "remove") {
@@ -405,34 +429,25 @@ void TDEHardwareDevices::processHotPluggedHardware() {
TDEGenericDevice *hwdevice;
for (hwdevice = m_deviceList.first(); hwdevice; hwdevice = m_deviceList.next()) {
if (hwdevice->systemPath() == systempath) {
- // Temporarily disable auto-deletion to ensure object validity when calling the Removed events below
- m_deviceList.setAutoDelete(false);
-
- // If the device is a storage device and has a slave, update it as well
+ // Make sure slave status is also updated
if (hwdevice->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice);
TQStringList slavedevices = sdevice->slaveDevices();
- m_deviceList.remove(hwdevice);
- for ( TQStringList::Iterator slaveit = slavedevices.begin(); slaveit != slavedevices.end(); ++slaveit ) {
+ for (TQStringList::Iterator slaveit = slavedevices.begin(); slaveit != slavedevices.end(); ++slaveit) {
TDEGenericDevice* slavedevice = findBySystemPath(*slaveit);
- if (slavedevice) {
+ if (slavedevice && slavedevice->type() == TDEGenericDeviceType::Disk) {
rescanDeviceInformation(slavedevice);
emit hardwareUpdated(slavedevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, slavedevice->uniqueID());
}
}
}
- else {
- m_deviceList.remove(hwdevice);
- }
-
- emit hardwareRemoved(hwdevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareRemoved, hwdevice->uniqueID());
-
- // Reenable auto-deletion and delete the removed device object
- m_deviceList.setAutoDelete(true);
- delete hwdevice;
+ rescanDeviceInformation(hwdevice, dev);
+ if (m_deviceList.find(hwdevice) != -1 && m_deviceList.take())
+ {
+ emit hardwareRemoved(hwdevice);
+ delete hwdevice;
+ }
break;
}
}
@@ -445,10 +460,8 @@ void TDEHardwareDevices::processHotPluggedHardware() {
for (hwdevice = m_deviceList.first(); hwdevice; hwdevice = m_deviceList.next()) {
if (hwdevice->systemPath() == systempath) {
if (!hwdevice->blacklistedForUpdate()) {
- classifyUnknownDevice(dev, hwdevice, false);
- updateParentDeviceInformation(hwdevice); // Update parent/child tables for this device
+ rescanDeviceInformation(hwdevice, dev);
emit hardwareUpdated(hwdevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
}
}
else if ((hwdevice->type() == TDEGenericDeviceType::Monitor)
@@ -460,7 +473,6 @@ void TDEHardwareDevices::processHotPluggedHardware() {
udev_device_unref(slavedev);
updateParentDeviceInformation(hwdevice); // Update parent/child tables for this device
emit hardwareUpdated(hwdevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
}
}
}
@@ -856,7 +868,6 @@ void TDEHardwareDevices::processModifiedCPUs() {
if (hwdevice) {
// Signal new information available
emit hardwareUpdated(hwdevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
}
}
}
@@ -883,10 +894,11 @@ void TDEHardwareDevices::processStatelessDevices() {
// We can't use m_deviceList directly as m_deviceList can only have one iterator active against it at any given time
TDEGenericHardwareList devList = listAllPhysicalDevices();
for ( hwdevice = devList.first(); hwdevice; hwdevice = devList.next() ) {
- if ((hwdevice->type() == TDEGenericDeviceType::RootSystem) || (hwdevice->type() == TDEGenericDeviceType::Network) || (hwdevice->type() == TDEGenericDeviceType::OtherSensor) || (hwdevice->type() == TDEGenericDeviceType::Event) || (hwdevice->type() == TDEGenericDeviceType::Battery) || (hwdevice->type() == TDEGenericDeviceType::PowerSupply)) {
- rescanDeviceInformation(hwdevice, false);
+ if ((hwdevice->type() == TDEGenericDeviceType::RootSystem) || (hwdevice->type() == TDEGenericDeviceType::Network) ||
+ (hwdevice->type() == TDEGenericDeviceType::OtherSensor) || (hwdevice->type() == TDEGenericDeviceType::Event) ||
+ (hwdevice->type() == TDEGenericDeviceType::Battery) || (hwdevice->type() == TDEGenericDeviceType::PowerSupply)) {
+ rescanDeviceInformation(hwdevice, NULL, false);
emit hardwareUpdated(hwdevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
#ifdef STATELESSPROFILING
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2);
printf("TDEHardwareDevices::processStatelessDevices() : '%s' finished at %u [%u]\n", (hwdevice->name()).ascii(), time2.tv_nsec, diff(time1,time2).tv_nsec);
@@ -909,17 +921,15 @@ void TDEHardwareDevices::processBatteryDevices() {
TDEGenericHardwareList devList = listAllPhysicalDevices();
for ( hwdevice = devList.first(); hwdevice; hwdevice = devList.next() ) {
if (hwdevice->type() == TDEGenericDeviceType::Battery) {
- rescanDeviceInformation(hwdevice, false);
+ rescanDeviceInformation(hwdevice, NULL, false);
emit hardwareUpdated(hwdevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
}
else if (hwdevice->type() == TDEGenericDeviceType::PowerSupply) {
TDEMainsPowerDevice *pdevice = dynamic_cast<TDEMainsPowerDevice*>(hwdevice);
int previousOnlineState = pdevice->online();
- rescanDeviceInformation(hwdevice, false);
+ rescanDeviceInformation(hwdevice, NULL, false);
if (pdevice->online() != previousOnlineState) {
emit hardwareUpdated(hwdevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
}
}
}
@@ -933,7 +943,6 @@ void TDEHardwareDevices::processEventDeviceKeyPressed(unsigned int keycode, TDEE
void TDEHardwareDevices::processModifiedMounts() {
// Detect what changed between the old mount table and the new one,
// and emit appropriate events
-
TQMap<TQString, bool> deletedEntries = m_mountTable;
// Read in the new mount table
@@ -959,52 +968,28 @@ void TDEHardwareDevices::processModifiedMounts() {
}
}
+ // Added devices
TQMap<TQString, bool>::Iterator it;
for ( it = addedEntries.begin(); it != addedEntries.end(); ++it ) {
- TQStringList mountInfo = TQStringList::split(" ", it.key(), true);
// Try to find a device that matches the altered node
+ TQStringList mountInfo = TQStringList::split(" ", it.key(), true);
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
- if (hwdevice) {
+ if (hwdevice && hwdevice->type() == TDEGenericDeviceType::Disk) {
+ rescanDeviceInformation(hwdevice);
emit hardwareUpdated(hwdevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
- // If the device is a storage device and has a slave, update it as well
- if (hwdevice->type() == TDEGenericDeviceType::Disk) {
- TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice);
- TQStringList slavedevices = sdevice->slaveDevices();
- for ( TQStringList::Iterator slaveit = slavedevices.begin(); slaveit != slavedevices.end(); ++slaveit ) {
- TDEGenericDevice* slavedevice = findBySystemPath(*slaveit);
- if (slavedevice) {
- emit hardwareUpdated(slavedevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, slavedevice->uniqueID());
- }
- }
- }
}
}
+
+ // Removed devices
for ( it = deletedEntries.begin(); it != deletedEntries.end(); ++it ) {
- TQStringList mountInfo = TQStringList::split(" ", it.key(), true);
// Try to find a device that matches the altered node
+ TQStringList mountInfo = TQStringList::split(" ", it.key(), true);
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
- if (hwdevice) {
+ if (hwdevice && hwdevice->type() == TDEGenericDeviceType::Disk) {
+ rescanDeviceInformation(hwdevice);
emit hardwareUpdated(hwdevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
- // If the device is a storage device and has a slave, update it as well
- if (hwdevice->type() == TDEGenericDeviceType::Disk) {
- TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice);
- TQStringList slavedevices = sdevice->slaveDevices();
- for ( TQStringList::Iterator slaveit = slavedevices.begin(); slaveit != slavedevices.end(); ++slaveit ) {
- TDEGenericDevice* slavedevice = findBySystemPath(*slaveit);
- if (slavedevice) {
- emit hardwareUpdated(slavedevice);
- emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, slavedevice->uniqueID());
- }
- }
- }
}
}
-
- emit mountTableModified();
- emit hardwareEvent(TDEHardwareEvent::MountTableModified, TQString());
}
TDEDiskDeviceType::TDEDiskDeviceType classifyDiskType(udev_device* dev, const TQString devicenode, const TQString devicebus, const TQString disktypestring, const TQString systempath, const TQString devicevendor, const TQString devicemodel, const TQString filesystemtype, const TQString devicedriver) {
@@ -2175,7 +2160,8 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (devicesubsystem == "nd") {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::RAM);
}
- if (devicesubsystem == "ptp") {
+ if (devicesubsystem == "ptp"
+ || (devicesubsystem == "rtc")) {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Timekeeping);
}
if (devicesubsystem == "leds") {
@@ -2209,8 +2195,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (devicesubsystem == "mmc") {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Platform);
}
- if ((devicesubsystem == "event_source")
- || (devicesubsystem == "rtc")) {
+ if (devicesubsystem == "event_source") {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Mainboard);
}
if (devicesubsystem == "bsg") {
@@ -2475,12 +2460,6 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
udev_device_unref(dev);
}
- // Get the device mapped name if present
- TDEStorageDevice *sdevice = dynamic_cast<TDEStorageDevice*>(device);
- if (sdevice) {
- sdevice->updateMappedName();
- }
-
return device;
}
@@ -2536,36 +2515,6 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice *devic
sdevice->internalSetFileSystemName("pictbridge");
}
else {
- bool removable = false;
- bool hotpluggable = false;
-
- // We can get the removable flag, but we have no idea if the device has the ability to notify on media insertion/removal
- // If there is no such notification possible, then we should not set the removable flag
- // udev can be such an amazing pain at times
- // It exports a /capabilities node with no info on what the bits actually mean
- // This information is very poorly documented as a set of #defines in include/linux/genhd.h
- // We are specifically interested in GENHD_FL_REMOVABLE and GENHD_FL_MEDIA_CHANGE_NOTIFY
- // The "removable" flag should also really be renamed to "hotpluggable", as that is far more precise...
- TQString capabilitynodename = systempath;
- capabilitynodename.append("/capability");
- TQFile capabilityfile( capabilitynodename );
- unsigned int capabilities = 0;
- if ( capabilityfile.open( IO_ReadOnly ) ) {
- TQTextStream stream( &capabilityfile );
- TQString capabilitystring;
- capabilitystring = stream.readLine();
- capabilities = capabilitystring.toUInt();
- capabilityfile.close();
- }
- if (capabilities & GENHD_FL_REMOVABLE) {
- // FIXME
- // For added fun this is not always true; i.e. GENHD_FL_REMOVABLE can be set when the device cannot be hotplugged (floppy drives).
- hotpluggable = true;
- }
- if (capabilities & GENHD_FL_MEDIA_CHANGE_NOTIFY) {
- removable = true;
- }
-
// See if any other devices are exclusively using this device, such as the Device Mapper
TQStringList holdingDeviceNodes;
TQString holdersnodename = udev_device_get_syspath(dev);
@@ -2758,21 +2707,16 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice *devic
}
}
- if (removable) {
+ if (readLineFile( systempath + "/removable" ).toUInt()) {
diskstatus = diskstatus | TDEDiskDeviceStatus::Removable;
}
- if (hotpluggable) {
- diskstatus = diskstatus | TDEDiskDeviceStatus::Hotpluggable;
- }
// Force removable flag for flash disks
// udev reports disks as non-removable for card readers on PCI controllers
- if (((disktype & TDEDiskDeviceType::CompactFlash)
+ else if ((disktype & TDEDiskDeviceType::CompactFlash)
|| (disktype & TDEDiskDeviceType::MemoryStick)
|| (disktype & TDEDiskDeviceType::SmartMedia)
- || (disktype & TDEDiskDeviceType::SDMMC))
- && !(diskstatus & TDEDiskDeviceStatus::Removable)
- && !(diskstatus & TDEDiskDeviceStatus::Hotpluggable)) {
- diskstatus = diskstatus | TDEDiskDeviceStatus::Hotpluggable;
+ || (disktype & TDEDiskDeviceType::SDMMC)) {
+ diskstatus = diskstatus | TDEDiskDeviceStatus::Removable;
}
if ((!filesystemtype.isEmpty()) && (filesystemtype.upper() != "CRYPTO_LUKS") &&
@@ -2790,7 +2734,7 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice *devic
// type string too. For example for LUKS disk, ID_TYPE is null and DEVTYPE is "disk"
diskstatus = diskstatus & ~TDEDiskDeviceStatus::Mountable;
}
- if (removable) {
+ if ( diskstatus & TDEDiskDeviceStatus::Removable ) {
if (sdevice->mediaInserted()) {
diskstatus = diskstatus | TDEDiskDeviceStatus::Inserted;
}
@@ -2881,6 +2825,8 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice *devic
}
sdevice->internalSetDiskLabel(disklabel);
+ sdevice->internalUpdateMountPath();
+ sdevice->internalUpdateMappedName();
}
}
@@ -2978,7 +2924,7 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice *devic
ndevice->internalSetIpV6Netmask(address);
}
}
- s = getnameinfo(ifa->ifa_ifu.ifu_broadaddr, (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
+ s = ifa->ifa_ifu.ifu_broadaddr ? getnameinfo(ifa->ifa_ifu.ifu_broadaddr, (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) : EAI_NONAME;
if (s == 0) {
TQString address(host);
if (family == AF_INET) {
@@ -2989,7 +2935,7 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice *devic
ndevice->internalSetIpV6Broadcast(address);
}
}
- s = getnameinfo(ifa->ifa_ifu.ifu_dstaddr, (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
+ s = ifa->ifa_ifu.ifu_dstaddr ? getnameinfo(ifa->ifa_ifu.ifu_dstaddr, (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) : EAI_NONAME;
if (s == 0) {
TQString address(host);
if (family == AF_INET) {
@@ -3682,8 +3628,6 @@ bool TDEHardwareDevices::queryHardwareInformation() {
// Update parent/child tables for all devices
updateParentDeviceInformation();
- emit hardwareEvent(TDEHardwareEvent::HardwareListModified, TQString());
-
return true;
}
@@ -3793,7 +3737,7 @@ TQString TDEHardwareDevices::findPCIDeviceName(TQString vendorid, TQString model
if (!pci_id_map) {
pci_id_map = new TDEDeviceIDMap;
- TQString database_filename = "/usr/share/pci.ids";
+ TQString database_filename = "/usr/share/hwdata/pci.ids";
if (!TQFile::exists(database_filename)) {
database_filename = "/usr/share/misc/pci.ids";
}
@@ -3903,7 +3847,7 @@ TQString TDEHardwareDevices::findUSBDeviceName(TQString vendorid, TQString model
if (!usb_id_map) {
usb_id_map = new TDEDeviceIDMap;
- TQString database_filename = "/usr/share/usb.ids";
+ TQString database_filename = "/usr/share/hwdata/usb.ids";
if (!TQFile::exists(database_filename)) {
database_filename = "/usr/share/misc/usb.ids";
}