diff options
Diffstat (limited to 'tdecore/tdehw')
21 files changed, 592 insertions, 699 deletions
diff --git a/tdecore/tdehw/CMakeLists.txt b/tdecore/tdehw/CMakeLists.txt index d314b055f..1951b0d16 100644 --- a/tdecore/tdehw/CMakeLists.txt +++ b/tdecore/tdehw/CMakeLists.txt @@ -17,7 +17,7 @@ if( NOT DBUS_SYSTEM_BUS ) set( DBUS_SYSTEM_BUS "unix:path=/var/run/dbus/system_bus_socket" CACHE INTERNAL "" FORCE ) endif() -if( WITH_TDEHWLIB_DAEMONS OR WITH_HAL OR WITH_DEVKITPOWER OR WITH_UPOWER OR WITH_UDISKS OR WITH_UDISKS2 OR +if( WITH_TDEHWLIB_DAEMONS OR WITH_DEVKITPOWER OR WITH_UPOWER OR WITH_UDISKS OR WITH_UDISKS2 OR WITH_NETWORK_MANAGER_BACKEND OR WITH_CONSOLEKIT ) list( APPEND TDEHW_CUSTOM_INCLUDE_DIRS ${DBUS_TQT_INCLUDE_DIRS} ) list( APPEND TDEHW_CUSTOM_LIBRARY_DIRS ${DBUS_TQT_LIBRARY_DIRS} ) @@ -28,10 +28,6 @@ if( WITH_TDEHWLIB_DAEMONS ) add_definitions( -DWITH_TDEHWLIB_DAEMONS ) endif( ) -if( WITH_HAL ) - add_definitions( -DWITH_HAL ) -endif( ) - if( WITH_DEVKITPOWER ) add_definitions( -DWITH_DEVKITPOWER ) endif( ) diff --git a/tdecore/tdehw/disksHelper.cpp b/tdecore/tdehw/disksHelper.cpp index 4eb3709ca..c47bc5e04 100644 --- a/tdecore/tdehw/disksHelper.cpp +++ b/tdecore/tdehw/disksHelper.cpp @@ -64,8 +64,41 @@ TQStringVariantMap udisksEjectDrive(TDEStorageDevice *sdevice) { return result; } else { - result["result"] = true; - return result; + // Eject was successful. Check if the media can be powered off and do so in case + TQT_DBusProxy driveInformation("org.freedesktop.UDisks", blockDeviceString, + "org.freedesktop.DBus.Properties", dbusConn); + params.clear(); + params << TQT_DBusData::fromString("org.freedesktop.UDisks.Drive") << TQT_DBusData::fromString("DriveCanDetach"); + TQT_DBusMessage reply = driveInformation.sendWithReply("Get", params, &error); + if (error.isValid()) { + // Error! + result["errStr"] = error.name() + ": " + error.message(); + return result; + } + + if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { + bool canPowerOff = reply[0].toVariant().value.toBool(); + if (!canPowerOff) { + // This drive does not support power off. Just return since the eject operation has finished. + result["result"] = true; + return result; + } + + // Power off the drive! + params.clear(); + TQT_DBusDataMap<TQString> options(TQT_DBusData::Variant); + params << TQT_DBusData::fromStringKeyMap(options); + TQT_DBusMessage reply = driveControl.sendWithReply("DriveDetach", params, &error); + if (error.isValid()) { + // Error! + result["errStr"] = error.name() + ": " + error.message(); + return result; + } + else { + result["result"] = true; + return result; + } + } } } } @@ -193,7 +226,7 @@ TQStringVariantMap udisks2EjectDrive(TDEStorageDevice *sdevice) { TQT_DBusProxy driveInformation("org.freedesktop.UDisks2", driveObjectPath, "org.freedesktop.DBus.Properties", dbusConn); // can eject? - TQValueList<TQT_DBusData> params; + params.clear(); params << TQT_DBusData::fromString("org.freedesktop.UDisks2.Drive") << TQT_DBusData::fromString("Ejectable"); TQT_DBusMessage reply = driveInformation.sendWithReply("Get", params, &error); if (error.isValid()) { @@ -211,7 +244,7 @@ TQStringVariantMap udisks2EjectDrive(TDEStorageDevice *sdevice) { // Eject the drive! TQT_DBusProxy driveControl("org.freedesktop.UDisks2", driveObjectPath, "org.freedesktop.UDisks2.Drive", dbusConn); - TQValueList<TQT_DBusData> params; + params.clear(); TQT_DBusDataMap<TQString> options(TQT_DBusData::Variant); params << TQT_DBusData::fromStringKeyMap(options); TQT_DBusMessage reply = driveControl.sendWithReply("Eject", params, &error); @@ -221,8 +254,39 @@ TQStringVariantMap udisks2EjectDrive(TDEStorageDevice *sdevice) { return result; } else { - result["result"] = true; - return result; + // Eject was successful. Check if the media can be powered off and do so in case + params.clear(); + params << TQT_DBusData::fromString("org.freedesktop.UDisks2.Drive") << TQT_DBusData::fromString("CanPowerOff"); + TQT_DBusMessage reply = driveInformation.sendWithReply("Get", params, &error); + if (error.isValid()) { + // Error! + result["errStr"] = error.name() + ": " + error.message(); + return result; + } + + if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { + bool canPowerOff = reply[0].toVariant().value.toBool(); + if (!canPowerOff) { + // This drive does not support power off. Just return since the eject operation has finished. + result["result"] = true; + return result; + } + + // Power off the drive! + params.clear(); + TQT_DBusDataMap<TQString> options(TQT_DBusData::Variant); + params << TQT_DBusData::fromStringKeyMap(options); + TQT_DBusMessage reply = driveControl.sendWithReply("PowerOff", params, &error); + if (error.isValid()) { + // Error! + result["errStr"] = error.name() + ": " + error.message(); + return result; + } + else { + result["result"] = true; + return result; + } + } } } } diff --git a/tdecore/tdehw/hwlibdata/pnpdev/pnp.ids b/tdecore/tdehw/hwlibdata/pnpdev/pnp.ids index bf4a3ce01..274e042f9 100644 --- a/tdecore/tdehw/hwlibdata/pnpdev/pnp.ids +++ b/tdecore/tdehw/hwlibdata/pnpdev/pnp.ids @@ -1,6 +1,6 @@ # The information provided in this PNP ID to friendly name mapping table was obtained from # multiple public sources, as well as this authoritative publicly accessible file: -# ftp://ftpmicrosoftcom/developr/drg/plug-and-play/devidstxt +# https://stuff.mit.edu/afs/sipb/contrib/doc/specs/protocol/pnp/devids.txt # # This file is provided soley in the interest of cross platform compatibility # It only contains information on certain generic core system devices that cannot be looked up via another method @@ -17,140 +17,332 @@ # # The two digit code yy appears to be a PCI device type code followed by a subtype code and should be parsed as such -PNP0802 Microsoft® Sound System-compatible device - -PNP0000 AT Interrupt Controller -PNP0001 EISA Interrupt Controller -PNP0002 MCA Interrupt Controller -PNP0003 APIC -PNP0004 Cyrix SLiC MP Interrupt Controller - -PNP0100 AT Timer -PNP0101 EISA Timer -PNP0102 MCA Timer -PNP0103 High Precision Event Timer - -PNP0200 AT DMA Controller -PNP0201 EISA DMA Controller -PNP0202 MCA DMA Controller - -PNP0300 IBM PC/XT keyboard controller (83-key) -PNP0301 IBM PC/AT keyboard controller (86-key) -PNP0302 IBM PC/XT keyboard controller (84-key) -PNP0303 IBM Enhanced (101/102-key, PS/2 mouse support) -PNP0304 Olivetti Keyboard (83-key) -PNP0305 Olivetti Keyboard (102-key) -PNP0306 Olivetti Keyboard (86-key) -PNP0307 Microsoft® Windows(R) Keyboard -PNP0308 General Input Device Emulation Interface (GIDEI) legacy -PNP0309 Olivetti Keyboard (A101/102 key) -PNP030A AT&T 302 keyboard -PNP030B Reserved by Microsoft® -PNP0320 Japanese 106-key keyboard A01 -PNP0321 Japanese 101-key keyboard -PNP0322 Japanese AX keyboard -PNP0323 Japanese 106-key keyboard 002/003 -PNP0324 Japanese 106-key keyboard 001 -PNP0325 Japanese Toshiba Desktop keyboard -PNP0326 Japanese Toshiba Laptop keyboard -PNP0327 Japanese Toshiba Notebook keyboard -PNP0340 Korean 84-key keyboard -PNP0341 Korean 86-key keyboard -PNP0342 Korean Enhanced keyboard -PNP0343 Korean Enhanced keyboard 101b -PNP0343 Korean Enhanced keyboard 101c -PNP0344 Korean Enhanced keyboard 103 - -PNP0400 Standard LPT Printer Port -PNP0401 ECP Printer Port - -PNP0500 Standard PC Serial Port -PNP0501 16550A-compatible Serial Port -PNP0502 Multiport Serial Device (non-intelligent 16550) -PNP0510 Generic IRDA-compatible Device -PNP0511 Generic IRDA-compatible Device - -PNP0600 Generic ESDI/IDE/ATA Compatible Hard Disk Controller -PNP0603 Generic IDE supporting Microsoft® Device Bay Specification -PNP0700 PC Standard Floppy Disk Controller -PNP0701 Microsoft® Device Bay Compatible Floppy Controller - -PNP0802 Microsoft® Sound System compatible device - -PNP0900 VGA Compatible Display Controller -PNP09FF Plug and Play Monitor (VESA DDC) - -PNP0A00 ISA Root Bus -PNP0A01 EISA Root Bus -PNP0A02 MCA Root Bus -PNP0A03 PCI Root Bus -PNP0A04 VESA/VL Bus -PNP0A05 Generic ACPI Root Bus -PNP0A06 Generic ACPI Extended-IO Root Bus (EIO Root Bus) -PNP0A08 PCI Express Root Bus - -PNP0800 AT-style Speaker -PNP0B00 AT Real-Time Clock -PNP0C00 Plug and Play BIOS -PNP0C01 System Board -PNP0C02 Plug and Play Motherboard Register Resource -PNP0C03 Plug and Play BIOS Event Notification Interrupt -PNP0C04 Math Coprocessor -PNP0C05 APM BIOS -PNP0C06 Early Plug and Play BIOS -PNP0C07 Early Plug and Play BIOS -PNP0C08 ACPI System Board -PNP0C09 ACPI Embedded Controller -PNP0C0A ACPI Control Method Battery -PNP0C0B ACPI Fan -PNP0C0C ACPI Power Button -PNP0C0D ACPI Lid Switch -PNP0C0E ACPI Sleep Button -PNP0C0F PCI Interrupt Link -PNP0C10 ACPI System Indicator -PNP0C11 ACPI Thermal Zone -PNP0C12 Device Bay Controller -PNP0C13 Plug and Play BIOS - -PNP0E00 Intel 82365-Compatible PCMCIA Controller -PNP0E01 Cirrus Logic CL-PD6720 PCMCIA Controller -PNP0E02 VLSI VL82C146 PCMCIA Controller -PNP0E03 Intel 82365-compatible CardBus controller - -PNP0F00 Microsoft® Bus Mouse -PNP0F01 Microsoft® Serial Mouse -PNP0F02 Microsoft® InPort Mouse -PNP0F03 Microsoft® PS/2-style Mouse -PNP0F04 Mouse Systems Mouse -PNP0F05 Mouse Systems 3-Button Mouse -PNP0F06 Genius Mouse -PNP0F07 Genius Mouse -PNP0F08 Logitech Serial Mouse -PNP0F09 Microsoft® BallPoint Serial Mouse -PNP0F0A Microsoft® Plug and Play Mouse -PNP0F0B Microsoft® Plug and Play BallPoint Mouse -PNP0F0C Microsoft®-compatible Serial Mouse -PNP0F0D Microsoft®-compatible InPort-compatible Mouse -PNP0F0E Microsoft®-compatible PS/2-style Mouse -PNP0F0F Microsoft®-compatible Serial BallPoint-compatible Mouse -PNP0F10 Texas Instruments QuickPort Mouse -PNP0F11 Microsoft®-compatible Bus Mouse -PNP0F12 Logitech PS/2-style Mouse -PNP0F13 PS/2 Port for PS/2-style Mice -PNP0F14 Microsoft® Kids Mouse -PNP0F15 Logitech bus mouse -PNP0F16 Logitech SWIFT device -PNP0F17 Logitech-compatible serial mouse -PNP0F18 Logitech-compatible bus mouse -PNP0F19 Logitech-compatible PS/2-style Mouse -PNP0F1A Logitech-compatible SWIFT Device -PNP0F1B HP Omnibook Mouse -PNP0F1C Compaq LTE Trackball PS/2-style Mouse -PNP0F1D Compaq LTE Trackball Serial Mouse -PNP0F1E Microsoft® Kids Trackball Mouse -PNP0F1F Reserved by Microsoft® Input Device Group -PNP0F20 Reserved by Microsoft® Input Device Group -PNP0F21 Reserved by Microsoft® Input Device Group -PNP0F22 Reserved by Microsoft® Input Device Group -PNP0F23 Reserved by Microsoft® Input Device Group -PNP0FFF Reserved by Microsoft® Systems
\ No newline at end of file +PNP0000 AT Interrupt Controller +PNP0001 EISA Interrupt Controller +PNP0002 MCA Interrupt Controller +PNP0003 APIC +PNP0004 Cyrix SLiC MP interrupt controller + +PNP0100 AT Timer +PNP0101 EISA Timer +PNP0102 MCA Timer + +PNP0200 AT DMA Controller +PNP0201 EISA DMA Controller +PNP0202 MCA DMA Controller + +PNP0300 IBM PC/XT keyboard controller (83-key) +PNP0301 IBM PC/AT keyboard controller (86-key) +PNP0302 IBM PC/XT keyboard controller (84-key) +PNP0303 IBM Enhanced (101/102-key, PS/2 mouse support) +PNP0304 Olivetti Keyboard (83-key) +PNP0305 Olivetti Keyboard (102-key) +PNP0306 Olivetti Keyboard (86-key) +PNP0307 Microsoft Windows(R) Keyboard +PNP0308 General Input Device Emulation Interface (GIDEI) legacy +PNP0309 Olivetti Keyboard (A101/102 key) +PNP030A AT&T 302 keyboard +PNP030B Reserved by Microsoft +PNP0320 Japanese 106-key keyboard A01 +PNP0321 Japanese 101-key keyboard +PNP0322 Japanese AX keyboard +PNP0323 Japanese 106-key keyboard 002/003 +PNP0324 Japanese 106-key keyboard 001 +PNP0325 Japanese Toshiba Desktop keyboard +PNP0326 Japanese Toshiba Laptop keyboard +PNP0327 Japanese Toshiba Notebook keyboard +PNP0340 Korean 84-key keyboard +PNP0341 Korean 86-key keyboard +PNP0342 Korean Enhanced keyboard +PNP0343 Korean Enhanced keyboard 101b +PNP0343 Korean Enhanced keyboard 101c +PNP0344 Korean Enhanced keyboard 103 + +PNP0400 Standard LPT printer port +PNP0401 ECP printer port + +PNP0500 Standard PC COM port +PNP0501 16550A-compatible COM port +PNP0502 Multiport serial device (non-intelligent 16550) +PNP0510 Generic IRDA-compatible device +PNP0511 Generic IRDA-compatible device + +PNP0600 Generic ESDI/IDE/ATA compatible hard disk controller +PNP0601 Plus Hardcard II +PNP0602 Plus Hardcard IIXL/EZ +PNP0603 Generic IDE supporting Microsoft Device Bay Specification +PNP0700 PC standard floppy disk controller +PNP0701 Standard floppy controller supporting MS Device Bay Spec + +PNP0802 Microsoft Sound System compatible device (obsolete, use PNPB0xx instead) +PNP0900 VGA Compatible +PNP0901 Video Seven VRAM/VRAM II/1024i +PNP0902 8514/A Compatible +PNP0903 Trident VGA +PNP0904 Cirrus Logic Laptop VGA +PNP0905 Cirrus Logic VGA +PNP0906 Tseng ET4000 +PNP0907 Western Digital VGA +PNP0908 Western Digital Laptop VGA +PNP0909 S3 Inc. 911/924 +PNP090A ATI Ultra Pro/Plus (Mach 32) +PNP090B ATI Ultra (Mach 8) +PNP090C XGA Compatible +PNP090D ATI VGA Wonder +PNP090E Weitek P9000 Graphics Adapter +PNP090F Oak Technology VGA +PNP0910 Compaq QVision +PNP0911 XGA/2 +PNP0912 Tseng Labs W32/W32i/W32p +PNP0913 S3 Inc. 801/928/964 +PNP0914 Cirrus Logic 5429/5434 (memory mapped) +PNP0915 Compaq Advanced VGA (AVGA) +PNP0916 ATI Ultra Pro Turbo (Mach64) +PNP0917 Reserved by Microsoft +PNP0918 Matrox MGA +PNP0919 Compaq QVision 2000 +PNP091A Tseng W128 +PNP0930 Chips & Technologies Super VGA +PNP0931 Chips & Technologies Accelerator +PNP0940 NCR 77c22e Super VGA +PNP0941 NCR 77c32blt +PNP09FF Plug and Play Monitors (VESA DDC) + +PNP0A00 ISA Bus +PNP0A01 EISA Bus +PNP0A02 MCA Bus +PNP0A03 PCI Bus +PNP0A04 VESA/VL Bus +PNP0A05 Generic ACPI Bus +PNP0A06 Generic ACPI Extended-IO Bus (EIO bus) + +PNP0800 AT-style speaker sound +PNP0B00 AT Real-Time Clock +PNP0C00 Plug and Play BIOS (only created by the root enumerator) +PNP0C01 System Board +PNP0C02 General ID for reserving resources required by Plug and Play motherboard registers. (Not specific to a particular device.) +PNP0C03 Plug and Play BIOS Event Notification Interrupt +PNP0C04 Math Coprocessor +PNP0C05 APM BIOS (Version independent) +PNP0C06 Reserved for identification of early Plug and Play BIOS implementation. +PNP0C07 Reserved for identification of early Plug and Play BIOS implementation. +PNP0C08 ACPI system board hardware +PNP0C09 ACPI Embedded Controller +PNP0C0A ACPI Control Method Battery +PNP0C0B ACPI Fan +PNP0C0C ACPI power button device +PNP0C0D ACPI lid device +PNP0C0E ACPI sleep button device +PNP0C0F PCI interrupt link device +PNP0C10 ACPI system indicator device +PNP0C11 ACPI thermal zone +PNP0C12 Device Bay Controller +PNP0C13 Plug and Play BIOS (used when ACPI mode cannot be used) + +PNP0E00 Intel 82365-Compatible PCMCIA Controller +PNP0E01 Cirrus Logic CL-PD6720 PCMCIA Controller +PNP0E02 VLSI VL82C146 PCMCIA Controller +PNP0E03 Intel 82365-compatible CardBus controller + +PNP0F00 Microsoft Bus Mouse +PNP0F01 Microsoft Serial Mouse +PNP0F02 Microsoft InPort Mouse +PNP0F03 Microsoft PS/2-style Mouse +PNP0F04 Mouse Systems Mouse +PNP0F05 Mouse Systems 3-Button Mouse (COM2) +PNP0F06 Genius Mouse (COM1) +PNP0F07 Genius Mouse (COM2) +PNP0F08 Logitech Serial Mouse +PNP0F09 Microsoft BallPoint Serial Mouse +PNP0F0A Microsoft Plug and Play Mouse +PNP0F0B Microsoft Plug and Play BallPoint Mouse +PNP0F0C Microsoft-compatible Serial Mouse +PNP0F0D Microsoft-compatible InPort-compatible Mouse +PNP0F0E Microsoft-compatible PS/2-style Mouse +PNP0F0F Microsoft-compatible Serial BallPoint-compatible Mouse +PNP0F10 Texas Instruments QuickPort Mouse +PNP0F11 Microsoft-compatible Bus Mouse +PNP0F12 Logitech PS/2-style Mouse +PNP0F13 PS/2 Port for PS/2-style Mice +PNP0F14 Microsoft Kids Mouse +PNP0F15 Logitech bus mouse +PNP0F16 Logitech SWIFT device +PNP0F17 Logitech-compatible serial mouse +PNP0F18 Logitech-compatible bus mouse +PNP0F19 Logitech-compatible PS/2-style Mouse +PNP0F1A Logitech-compatible SWIFT Device +PNP0F1B HP Omnibook Mouse +PNP0F1C Compaq LTE Trackball PS/2-style Mouse +PNP0F1D Compaq LTE Trackball Serial Mouse +PNP0F1E Microsoft Kids Trackball Mouse +PNP0F1F Reserved by Microsoft Input Device Group +PNP0F20 Reserved by Microsoft Input Device Group +PNP0F21 Reserved by Microsoft Input Device Group +PNP0F22 Reserved by Microsoft Input Device Group +PNP0F23 Reserved by Microsoft Input Device Group +PNP0FFF Reserved by Microsoft Systems + +PNP8001 Novell/Anthem NE3200 +PNP8004 Compaq NE3200 +PNP8006 Intel EtherExpress/32 +PNP8008 HP EtherTwist EISA LAN Adapter/32 (HP27248A) +PNP8065 Ungermann-Bass NIUps or NIUps/EOTP +PNP8072 DEC (DE211) EtherWorks MC/TP +PNP8073 DEC (DE212) EtherWorks MC/TP_BNC +PNP8078 DCA 10 Mb MCA +PNP8074 HP MC LAN Adapter/16 TP (PC27246) +PNP80c9 IBM Token Ring +PNP80ca IBM Token Ring II +PNP80cb IBM Token Ring II/Short +PNP80cc IBM Token Ring 4/16Mbs +PNP80d3 Novell/Anthem NE1000 +PNP80d4 Novell/Anthem NE2000 +PNP80d5 NE1000 Compatible +PNP80d6 NE2000 Compatible +PNP80d7 Novell/Anthem NE1500T +PNP80d8 Novell/Anthem NE2100 +PNP80dd SMC ARCNETPC +PNP80de SMC ARCNET PC100, PC200 +PNP80df SMC ARCNET PC110, PC210, PC250 +PNP80e0 SMC ARCNET PC130/E +PNP80e1 SMC ARCNET PC120, PC220, PC260 +PNP80e2 SMC ARCNET PC270/E +PNP80e5 SMC ARCNET PC600W, PC650W +PNP80e7 DEC DEPCA +PNP80e8 DEC (DE100) EtherWorks LC +PNP80e9 DEC (DE200) EtherWorks Turbo +PNP80ea DEC (DE101) EtherWorks LC/TP +PNP80eb DEC (DE201) EtherWorks Turbo/TP +PNP80ec DEC (DE202) EtherWorks Turbo/TP_BNC +PNP80ed DEC (DE102) EtherWorks LC/TP_BNC +PNP80ee DEC EE101 (Built-In) +PNP80ef DECpc 433 WS (Built-In) +PNP80f1 3Com EtherLink Plus +PNP80f3 3Com EtherLink II or IITP (8 or 16-bit) +PNP80f4 3Com TokenLink +PNP80f6 3Com EtherLink 16 +PNP80f7 3Com EtherLink III +PNP80f8 3Com Generic Etherlink Plug and Play Device +PNP80fb Thomas Conrad TC6045 +PNP80fc Thomas Conrad TC6042 +PNP80fd Thomas Conrad TC6142 +PNP80fe Thomas Conrad TC6145 +PNP80ff Thomas Conrad TC6242 +PNP8100 Thomas Conrad TC6245 +PNP8105 DCA 10 MB +PNP8106 DCA 10 MB Fiber Optic +PNP8107 DCA 10 MB Twisted Pair +PNP8113 Racal NI6510 +PNP811C Ungermann-Bass NIUpc +PNP8120 Ungermann-Bass NIUpc/EOTP +PNP8123 SMC StarCard PLUS (WD/8003S) +PNP8124 SMC StarCard PLUS With On Board Hub (WD/8003SH) +PNP8125 SMC EtherCard PLUS (WD/8003E) +PNP8126 SMC EtherCard PLUS With Boot ROM Socket (WD/8003EBT) +PNP8127 SMC EtherCard PLUS With Boot ROM Socket (WD/8003EB) +PNP8128 SMC EtherCard PLUS TP (WD/8003WT) +PNP812a SMC EtherCard PLUS 16 With Boot ROM Socket (WD/8013EBT) +PNP812d Intel EtherExpress 16 or 16TP +PNP812f Intel TokenExpress 16/4 +PNP8130 Intel TokenExpress MCA 16/4 +PNP8132 Intel EtherExpress 16 (MCA) +PNP8137 Artisoft AE-1 +PNP8138 Artisoft AE-2 or AE-3 +PNP8141 Amplicard AC 210/XT +PNP8142 Amplicard AC 210/AT +PNP814b Everex SpeedLink /PC16 (EV2027) +PNP8155 HP PC LAN Adapter/8 TP (HP27245) +PNP8156 HP PC LAN Adapter/16 TP (HP27247A) +PNP8157 HP PC LAN Adapter/8 TL (HP27250) +PNP8158 HP PC LAN Adapter/16 TP Plus (HP27247B) +PNP8159 HP PC LAN Adapter/16 TL Plus (HP27252) +PNP815f National Semiconductor Ethernode *16AT +PNP8160 National Semiconductor AT/LANTIC EtherNODE 16-AT3 +PNP816a NCR Token-Ring 4 Mbs ISA +PNP816d NCR Token-Ring 16/4 Mbs ISA +PNP8191 Olicom 16/4 Token-Ring Adapter +PNP81c3 SMC EtherCard PLUS Elite (WD/8003EP) +PNP81c4 SMC EtherCard PLUS 10T (WD/8003W) +PNP81c5 SMC EtherCard PLUS Elite 16 (WD/8013EP) +PNP81c6 SMC EtherCard PLUS Elite 16T (WD/8013W) +PNP81c7 SMC EtherCard PLUS Elite 16 Combo (WD/8013EW or 8013EWC) +PNP81c8 SMC EtherElite Ultra 16 +PNP81e4 Pure Data PDI9025-32 (Token Ring) +PNP81e6 Pure Data PDI508+ (ArcNet) +PNP81e7 Pure Data PDI516+ (ArcNet) +PNP81eb Proteon Token Ring (P1390) +PNP81ec Proteon Token Ring (P1392) +PNP81ed Proteon ISA Token Ring (1340) +PNP81ee Proteon ISA Token Ring (1342) +PNP81ef Proteon ISA Token Ring (1346) +PNP81f0 Proteon ISA Token Ring (1347) +PNP81ff Cabletron E2000 Series DNI +PNP8200 Cabletron E2100 Series DNI +PNP8209 Zenith Data Systems Z-Note +PNP820a Zenith Data Systems NE2000-Compatible +PNP8213 Xircom Pocket Ethernet II +PNP8214 Xircom Pocket Ethernet I +PNP821d RadiSys EXM-10 +PNP8227 SMC 3000 Series +PNP8228 SMC 91C2 controller +PNP8231 Advanced Micro Devices AM2100/AM1500T +PNP8263 Tulip NCC-16 +PNP8277 Exos 105 +PNP828A Intel '595 based Ethernet +PNP828B TI2000-style Token Ring +PNP828C AMD PCNet Family cards +PNP828D AMD PCNet32 (VL version) +PNP8294 IrDA Infrared NDIS driver (Microsoft-supplied) +PNP82bd IBM PCMCIA-NIC +PNP82C2 Xircom CE10 +PNP82C3 Xircom CEM2 +PNP8321 DEC Ethernet (All Types) +PNP8323 SMC EtherCard (All Types except 8013/A) +PNP8324 ARCNET Compatible +PNP8326 Thomas Conrad (All Arcnet Types) +PNP8327 IBM Token Ring (All Types) +PNP8385 Remote Network Access Driver +PNP8387 RNA Point-to-point Protocol Driver +PNP8388 Reserved for Microsoft Networking components +PNP8389 Peer IrLAN infrared driver (Microsoft-supplied) +PNP8390 Generic network adapter + +PNPA002 Future Domain 16-700 compatible controller +PNPA003 Panasonic proprietary CD-ROM adapter (SBPro/SB16) +PNPA01B Trantor 128 SCSI Controller +PNPA01D Trantor T160 SCSI Controller +PNPA01E Trantor T338 Parallel SCSI controller +PNPA01F Trantor T348 Parallel SCSI controller +PNPA020 Trantor Media Vision SCSI controller +PNPA022 Always IN-2000 SCSI controller +PNPA02B Sony proprietary CD-ROM controller +PNPA02D Trantor T13b 8-bit SCSI controller +PNPA02F Trantor T358 Parallel SCSI controller +PNPA030 Mitsumi LU-005 Single Speed CD-ROM controller + drive +PNPA031 Mitsumi FX-001 Single Speed CD-ROM controller + drive +PNPA032 Mitsumi FX-001 Double Speed CD-ROM controller + drive + +PNPB000 Sound Blaster 1.5 sound device +PNPB001 Sound Blaster 2.0 sound device +PNPB002 Sound Blaster Pro sound device +PNPB003 Sound Blaster 16 sound device +PNPB004 Thunderboard-compatible sound device +PNPB005 Adlib-compatible FM synthesizer device +PNPB006 MPU401 compatible +PNPB007 Microsoft Windows Sound System-compatible sound device +PNPB008 Compaq Business Audio +PNPB009 Plug and Play Microsoft Windows Sound System Device +PNPB00A MediaVision Pro Audio Spectrum (Trantor SCSI enabled, Thunder Chip Disabled) +PNPB00B MediaVision Pro Audio 3D +PNPB00C MusicQuest MQX-32M +PNPB00D MediaVision Pro Audio Spectrum Basic (No Trantor SCSI, Thunder Chip Enabled) +PNPB00E MediaVision Pro Audio Spectrum (Trantor SCSI enabled, Thunder Chip Enabled) +PNPB00F MediaVision Jazz-16 chipset (OEM Versions) +PNPB010 Auravision VxP500 chipset - Orchid Videola +PNPB018 MediaVision Pro Audio Spectrum 8-bit +PNPB019 MediaVision Pro Audio Spectrum Basic (no Trantor SCSI, Thunder chip Disabled) +PNPB020 Yamaha OPL3-compatible FM synthesizer device +PNPB02F Joystick/Game port + +PNPC000 Compaq 14400 Modem (TBD) +PNPC001 Compaq 2400/9600 Modem (TBD) diff --git a/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/CMakeLists.txt b/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/CMakeLists.txt index c420c5e75..db3beef98 100644 --- a/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/CMakeLists.txt +++ b/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/CMakeLists.txt @@ -32,13 +32,6 @@ function( add_dbus_xml option basename classname namespace xmlfile ) add_custom_command( OUTPUT ${basename}.cpp ${basename}.h COMMAND ${DBUSXML2QT3_EXECUTABLE} -${option} ${basename} ${classname} -N ${namespace} ${INTROSPECTIONPATH}/${xmlfile} 2>/dev/null DEPENDS ${INTROSPECTIONPATH}/${xmlfile} ) - if( "${option}" STREQUAL "p" ) - add_custom_command( OUTPUT ${basename}.moc - COMMAND ${TMOC_EXECUTABLE} ${basename}.h -o ${basename}.moc - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${basename}.h ) - set_property( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${basename}.cpp APPEND - PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${basename}.moc ) - endif( ) endfunction( ) add_dbus_xml( p networkmanagerproxy NetworkManagerProxy DBus nm-manager.xml ) @@ -61,7 +54,7 @@ add_dbus_xml( p connectionsettings ConnectionSettingsInterface DBus nm-settings- # build the library -tde_add_library( tdenm_dbus STATIC_PIC +tde_add_library( tdenm_dbus STATIC_PIC AUTOMOC SOURCES networkmanagerproxy.cpp networkmanagerpppproxy.cpp deviceproxy.cpp bluetoothproxy.cpp olpcmeshproxy.cpp ethernetproxy.cpp diff --git a/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp b/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp index 3e8ef6daa..754fd31b8 100644 --- a/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp +++ b/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp @@ -1259,23 +1259,23 @@ TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TDE } // Connect global signals - connect(d->m_networkManagerProxy, SIGNAL(StateChanged(TQ_UINT32)), d, SLOT(internalProcessGlobalStateChanged(TQ_UINT32))); + connect(d->m_networkManagerProxy, TQ_SIGNAL(StateChanged(TQ_UINT32)), d, TQ_SLOT(internalProcessGlobalStateChanged(TQ_UINT32))); // Connect VPN signals if (d->m_vpnProxy) { - connect(d->m_vpnProxy, SIGNAL(StateChanged(TQ_UINT32)), d, SLOT(internalProcessVPNStateChanged(TQ_UINT32))); - connect(d->m_vpnProxy, SIGNAL(LoginBanner(const TQString&)), d, SLOT(internalProcessVPNLoginBanner(const TQString&))); - connect(d->m_vpnProxy, SIGNAL(Failure(TQ_UINT32)), d, SLOT(internalProcessVPNFailure(TQ_UINT32))); + connect(d->m_vpnProxy, TQ_SIGNAL(StateChanged(TQ_UINT32)), d, TQ_SLOT(internalProcessVPNStateChanged(TQ_UINT32))); + connect(d->m_vpnProxy, TQ_SIGNAL(LoginBanner(const TQString&)), d, TQ_SLOT(internalProcessVPNLoginBanner(const TQString&))); + connect(d->m_vpnProxy, TQ_SIGNAL(Failure(TQ_UINT32)), d, TQ_SLOT(internalProcessVPNFailure(TQ_UINT32))); } // Connect local signals if (d->m_networkDeviceProxy) { - connect(d->m_networkDeviceProxy, SIGNAL(StateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32)), d, SLOT(internalProcessDeviceStateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32))); + connect(d->m_networkDeviceProxy, TQ_SIGNAL(StateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32)), d, TQ_SLOT(internalProcessDeviceStateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32))); } if (d->m_wiFiDeviceProxy) { - connect(d->m_wiFiDeviceProxy, SIGNAL(AccessPointAdded(const TQT_DBusObjectPath&)), d, SLOT(internalProcessWiFiAccessPointAdded(const TQT_DBusObjectPath&))); - connect(d->m_wiFiDeviceProxy, SIGNAL(AccessPointRemoved(const TQT_DBusObjectPath&)), d, SLOT(internalProcessWiFiAccessPointRemoved(const TQT_DBusObjectPath&))); - connect(d->m_wiFiDeviceProxy, SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), d, SLOT(internalProcessWiFiPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&))); + connect(d->m_wiFiDeviceProxy, TQ_SIGNAL(AccessPointAdded(const TQT_DBusObjectPath&)), d, TQ_SLOT(internalProcessWiFiAccessPointAdded(const TQT_DBusObjectPath&))); + connect(d->m_wiFiDeviceProxy, TQ_SIGNAL(AccessPointRemoved(const TQT_DBusObjectPath&)), d, TQ_SLOT(internalProcessWiFiAccessPointRemoved(const TQT_DBusObjectPath&))); + connect(d->m_wiFiDeviceProxy, TQ_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), d, TQ_SLOT(internalProcessWiFiPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&))); } // Create public lists @@ -1510,7 +1510,7 @@ void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiAccessPoin // Set up monitoring object DBus::AccessPointProxy* apProxy = new DBus::AccessPointProxy(NM_DBUS_SERVICE, dbuspath); apProxy->setConnection(TQT_DBusConnection::systemBus()); - connect(apProxy, SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, SLOT(internalProcessAPPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&))); + connect(apProxy, TQ_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQ_SLOT(internalProcessAPPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&))); m_accessPointProxyList[dbuspath] = (apProxy); // Notify client applications @@ -1599,7 +1599,7 @@ TDENetworkConnectionType::TDENetworkConnectionType TDENetworkConnectionManager_B // Obtain connection settings from the path specified DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, dbusPath); connectionSettings.setConnection(TQT_DBusConnection::systemBus()); - connect(&connectionSettings, SIGNAL(GetSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&)), d, SLOT(processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&))); + connect(&connectionSettings, TQ_SIGNAL(GetSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&)), d, TQ_SLOT(processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&))); int asyncCallID; ret = connectionSettings.GetSettingsAsync(asyncCallID, error); if (ret && error.isValid()) { @@ -1928,8 +1928,8 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() { // Obtain connection settings from the path specified DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, (*it)); connectionSettings.setConnection(TQT_DBusConnection::systemBus()); - connect(&connectionSettings, SIGNAL(GetSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&)), d, SLOT(processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&))); - connect(&connectionSettings, SIGNAL(AsyncErrorResponseDetected(int, const TQT_DBusError)), d, SLOT(processConnectionSettingsAsyncError(int, const TQT_DBusError))); + connect(&connectionSettings, TQ_SIGNAL(GetSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&)), d, TQ_SLOT(processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&))); + connect(&connectionSettings, TQ_SIGNAL(AsyncErrorResponseDetected(int, const TQT_DBusError)), d, TQ_SLOT(processConnectionSettingsAsyncError(int, const TQT_DBusError))); int asyncCallID; ret = connectionSettings.GetSettingsAsync(asyncCallID, error); if (ret && error.isValid()) { @@ -3055,7 +3055,7 @@ bool TDENetworkConnectionManager_BackendNM::loadConnectionSecretsForGroup(TQStri // Obtain connection secrets from the path specified DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, existingConnection); connectionSettings.setConnection(TQT_DBusConnection::systemBus()); - connect(&connectionSettings, SIGNAL(GetSecretsAsyncReply(int, const TQT_DBusDataMap<TQString>&)), d, SLOT(processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&))); + connect(&connectionSettings, TQ_SIGNAL(GetSecretsAsyncReply(int, const TQT_DBusDataMap<TQString>&)), d, TQ_SLOT(processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&))); int asyncCallID; ret = connectionSettings.GetSecretsAsync(asyncCallID, group, error); if (ret && error.isValid()) { @@ -3260,7 +3260,7 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* // Obtain connection settings from the path specified DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, existingConnection); connectionSettings.setConnection(TQT_DBusConnection::systemBus()); - connect(&connectionSettings, SIGNAL(GetSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&)), d, SLOT(processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&))); + connect(&connectionSettings, TQ_SIGNAL(GetSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&)), d, TQ_SLOT(processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&))); int asyncCallID; ret = connectionSettings.GetSettingsAsync(asyncCallID, error); if (ret && error.isValid()) { @@ -4492,7 +4492,7 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* // Save connection settings to the path specified DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, existingConnection); connectionSettings.setConnection(TQT_DBusConnection::systemBus()); - connect(&connectionSettings, SIGNAL(UpdateAsyncReply(int)), d, SLOT(processConnectionSettingsUpdateAsyncReply(int))); + connect(&connectionSettings, TQ_SIGNAL(UpdateAsyncReply(int)), d, TQ_SLOT(processConnectionSettingsUpdateAsyncReply(int))); int asyncCallID; ret = connectionSettings.UpdateAsync(asyncCallID, connectionSettingsMap, error); if (ret && error.isValid()) { @@ -4526,8 +4526,8 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* printf("[network-manager comm debug] Creating new connection\n"); fflush(stdout); #endif // DEBUG_NETWORK_MANAGER_COMMUNICATIONS // Create new connection - connect(d->m_networkManagerSettings, SIGNAL(AddConnectionAsyncReply(int, const TQT_DBusObjectPath&)), d, SLOT(processAddConnectionAsyncReply(int, const TQT_DBusObjectPath&))); - connect(d->m_networkManagerSettings, SIGNAL(AsyncErrorResponseDetected(int, const TQT_DBusError)), d, SLOT(processAddConnectionAsyncError(int, const TQT_DBusError))); + connect(d->m_networkManagerSettings, TQ_SIGNAL(AddConnectionAsyncReply(int, const TQT_DBusObjectPath&)), d, TQ_SLOT(processAddConnectionAsyncReply(int, const TQT_DBusObjectPath&))); + connect(d->m_networkManagerSettings, TQ_SIGNAL(AsyncErrorResponseDetected(int, const TQT_DBusError)), d, TQ_SLOT(processAddConnectionAsyncError(int, const TQT_DBusError))); int asyncCallID; ret = d->m_networkManagerSettings->AddConnectionAsync(asyncCallID, connectionSettingsMap, error); if (ret && error.isValid()) { @@ -4580,7 +4580,7 @@ bool TDENetworkConnectionManager_BackendNM::deleteConnection(TQString uuid) { // Obtain connection secrets from the path specified DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, existingConnection); connectionSettings.setConnection(TQT_DBusConnection::systemBus()); - connect(&connectionSettings, SIGNAL(DeleteAsyncReply(int)), d, SLOT(processConnectionSettingsUpdateAsyncReply(int))); + connect(&connectionSettings, TQ_SIGNAL(DeleteAsyncReply(int)), d, TQ_SLOT(processConnectionSettingsUpdateAsyncReply(int))); int asyncCallID; ret = connectionSettings.DeleteAsync(asyncCallID, error); if (ret && error.isValid()) { @@ -4804,8 +4804,8 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag return checkConnectionStatus(uuid); #else // USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS #ifdef WAIT_FOR_OPERATION_BEFORE_RETURNING - connect(d->m_networkManagerProxy, SIGNAL(ActivateConnectionAsyncReply(int, const TQT_DBusObjectPath&)), d, SLOT(processAddConnectionAsyncReply(int, const TQT_DBusObjectPath&))); - connect(d->m_networkManagerProxy, SIGNAL(AsyncErrorResponseDetected(int, const TQT_DBusError)), d, SLOT(processAddConnectionAsyncError(int, const TQT_DBusError))); + connect(d->m_networkManagerProxy, TQ_SIGNAL(ActivateConnectionAsyncReply(int, const TQT_DBusObjectPath&)), d, TQ_SLOT(processAddConnectionAsyncReply(int, const TQT_DBusObjectPath&))); + connect(d->m_networkManagerProxy, TQ_SIGNAL(AsyncErrorResponseDetected(int, const TQT_DBusError)), d, TQ_SLOT(processAddConnectionAsyncError(int, const TQT_DBusError))); #endif // WAIT_FOR_OPERATION_BEFORE_RETURNING int asyncCallID; ret = d->m_networkManagerProxy->ActivateConnectionAsync(asyncCallID, existingConnection, TQT_DBusObjectPath(d->m_dbusDeviceString.ascii()), TQT_DBusObjectPath("/"), error); @@ -5000,7 +5000,7 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag return checkConnectionStatus(uuid); #else // USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS #ifdef WAIT_FOR_OPERATION_BEFORE_RETURNING - connect(d->m_networkManagerProxy, SIGNAL(DeactivateConnectionAsyncReply(int)), d, SLOT(processConnectionSettingsUpdateAsyncReply(int))); + connect(d->m_networkManagerProxy, TQ_SIGNAL(DeactivateConnectionAsyncReply(int)), d, TQ_SLOT(processConnectionSettingsUpdateAsyncReply(int))); #endif // WAIT_FOR_OPERATION_BEFORE_RETURNING int asyncCallID; ret = d->m_networkManagerProxy->DeactivateConnectionAsync(asyncCallID, existingConnection, error); @@ -5441,7 +5441,7 @@ TDENetworkConnectionManager_BackendNMPrivate::TDENetworkConnectionManager_Backen // Set up global signal handler m_dbusSignalConnection = new TQT_DBusConnection(TQT_DBusConnection::systemBus()); m_dbusSignalReceiver = new TDENetworkConnectionManager_BackendNM_DBusSignalReceiver(this); - m_dbusSignalConnection->connect(m_dbusSignalReceiver, TQT_SLOT(dbusSignal(const TQT_DBusMessage&))); + m_dbusSignalConnection->connect(m_dbusSignalReceiver, TQ_SLOT(dbusSignal(const TQT_DBusMessage&))); } TDENetworkConnectionManager_BackendNMPrivate::~TDENetworkConnectionManager_BackendNMPrivate() { diff --git a/tdecore/tdehw/networkbackends/network-manager/network-manager.h b/tdecore/tdehw/networkbackends/network-manager/network-manager.h index f14e4992e..8af99e846 100644 --- a/tdecore/tdehw/networkbackends/network-manager/network-manager.h +++ b/tdecore/tdehw/networkbackends/network-manager/network-manager.h @@ -211,7 +211,7 @@ class TDENetworkConnectionManager_BackendNMPrivate; class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkConnectionManager { - Q_OBJECT + TQ_OBJECT public: TDENetworkConnectionManager_BackendNM(TDENetworkDevice* networkDevice); diff --git a/tdecore/tdehw/networkbackends/network-manager/network-manager_p.h b/tdecore/tdehw/networkbackends/network-manager/network-manager_p.h index 61ce31329..43cafda25 100644 --- a/tdecore/tdehw/networkbackends/network-manager/network-manager_p.h +++ b/tdecore/tdehw/networkbackends/network-manager/network-manager_p.h @@ -71,7 +71,7 @@ class TDENetworkConnectionManager_BackendNMPrivate; class TDENetworkConnectionManager_BackendNM_DBusSignalReceiver : public TQObject { - Q_OBJECT + TQ_OBJECT public: TDENetworkConnectionManager_BackendNM_DBusSignalReceiver(TDENetworkConnectionManager_BackendNMPrivate*); @@ -86,7 +86,7 @@ class TDENetworkConnectionManager_BackendNM_DBusSignalReceiver : public TQObject class TDENetworkConnectionManager_BackendNMPrivate : public TQObject { - Q_OBJECT + TQ_OBJECT public: TDENetworkConnectionManager_BackendNMPrivate(TDENetworkConnectionManager_BackendNM*); diff --git a/tdecore/tdehw/tdecpudevice.cpp b/tdecore/tdehw/tdecpudevice.cpp index 40b9ad6e2..6715000a0 100644 --- a/tdecore/tdehw/tdecpudevice.cpp +++ b/tdecore/tdehw/tdecpudevice.cpp @@ -30,13 +30,13 @@ #include "config.h" // uPower -#if defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_HAL) +#if defined(WITH_TDEHWLIB_DAEMONS) #include <tqdbusdata.h> #include <tqdbusmessage.h> #include <tqdbusproxy.h> #include <tqdbusvariant.h> #include <tqdbusconnection.h> -#endif // defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_HAL) +#endif TDECPUDevice::TDECPUDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { @@ -151,23 +151,6 @@ bool TDECPUDevice::canSetGovernor() { } #endif // WITH_TDEHWLIB_DAEMONS -#ifdef WITH_HAL - { - TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if (dbusConn.isConnected()) { - TQT_DBusMessage msg = TQT_DBusMessage::methodCall( - "org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.CPUFreq", - "GetCPUFreqGovernor"); - TQT_DBusMessage reply = dbusConn.sendWithReply(msg); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - return true; - } - } - } -#endif // WITH_HAL - return false; } @@ -201,24 +184,6 @@ void TDECPUDevice::setGovernor(TQString gv) { } #endif // WITH_TDEHWLIB_DAEMONS -#ifdef WITH_HAL - if ( !setGovernorDone ) { - TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if (dbusConn.isConnected()) { - TQT_DBusProxy cpuFreqControl("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device.CPUFreq", dbusConn); - if (cpuFreqControl.canSend()) { - // set CPU governor - TQValueList<TQT_DBusData> params; - params << TQT_DBusData::fromString(gv.lower()); - TQT_DBusMessage reply = cpuFreqControl.sendWithReply("SetCPUFreqGovernor", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - setGovernorDone = true; - } - } - } - } -#endif // WITH_HAL - // Force update of the device information object if ( setGovernorDone ) { TDEGlobal::hardwareDevices()->processModifiedCPUs(); diff --git a/tdecore/tdehw/tdecryptographiccarddevice.cpp b/tdecore/tdehw/tdecryptographiccarddevice.cpp index c593d2ab6..4d9eeaab3 100644 --- a/tdecore/tdehw/tdecryptographiccarddevice.cpp +++ b/tdecore/tdehw/tdecryptographiccarddevice.cpp @@ -509,9 +509,9 @@ void TDECryptographicCardDevice::enableCardMonitoring(bool enable) { m_watcherObject->cardDevice = this; m_watcherObject->moveToThread(m_watcherThread); - TQObject::connect(m_watcherObject, SIGNAL(statusChanged(TQString,TQString)), this, SLOT(cardStatusChanged(TQString,TQString))); - TQObject::connect(m_watcherObject, SIGNAL(pinRequested(TQString)), this, SLOT(workerRequestedPin(TQString))); - TQTimer::singleShot(0, m_watcherObject, SLOT(run())); + TQObject::connect(m_watcherObject, TQ_SIGNAL(statusChanged(TQString,TQString)), this, TQ_SLOT(cardStatusChanged(TQString,TQString))); + TQObject::connect(m_watcherObject, TQ_SIGNAL(pinRequested(TQString)), this, TQ_SLOT(workerRequestedPin(TQString))); + TQTimer::singleShot(0, m_watcherObject, TQ_SLOT(run())); m_watcherThread->start(); } diff --git a/tdecore/tdehw/tdecryptographiccarddevice.h b/tdecore/tdehw/tdecryptographiccarddevice.h index 0907322d7..8b3bd211a 100644 --- a/tdecore/tdehw/tdecryptographiccarddevice.h +++ b/tdecore/tdehw/tdecryptographiccarddevice.h @@ -38,7 +38,7 @@ typedef TQValueListIterator<X509*> X509CertificatePtrListIterator; class TDECORE_EXPORT TDECryptographicCardDevice : public TDEGenericDevice { - Q_OBJECT + TQ_OBJECT public: /** diff --git a/tdecore/tdehw/tdeeventdevice.cpp b/tdecore/tdehw/tdeeventdevice.cpp index c528a42db..3223e80e7 100644 --- a/tdecore/tdehw/tdeeventdevice.cpp +++ b/tdecore/tdehw/tdeeventdevice.cpp @@ -349,7 +349,7 @@ void TDEEventDevice::internalStartMonitoring(TDEHardwareDevices* hwmanager) { if (eventType() != TDEEventDeviceType::Unknown) { if (m_fd >= 0) { m_eventNotifier = new TQSocketNotifier(m_fd, TQSocketNotifier::Read, this); - connect( m_eventNotifier, TQT_SIGNAL(activated(int)), this, TQT_SLOT(eventReceived()) ); + connect( m_eventNotifier, TQ_SIGNAL(activated(int)), this, TQ_SLOT(eventReceived()) ); m_monitorActive = true; } } @@ -357,7 +357,7 @@ void TDEEventDevice::internalStartMonitoring(TDEHardwareDevices* hwmanager) { // get initial state of switches internalReadProvidedSwitches(); internalReadActiveSwitches(); - connect( this, TQT_SIGNAL(keyPressed(unsigned int, TDEEventDevice*)), hwmanager, TQT_SLOT(processEventDeviceKeyPressed(unsigned int, TDEEventDevice*)) ); + connect( this, TQ_SIGNAL(keyPressed(unsigned int, TDEEventDevice*)), hwmanager, TQ_SLOT(processEventDeviceKeyPressed(unsigned int, TDEEventDevice*)) ); } } } @@ -387,9 +387,9 @@ void TDEEventDevice::processActiveSwitches() { } void TDEEventDevice::connectNotify( const char* signal ) { - if( !m_monitorActive && qstrcmp( signal, TQT_SIGNAL(switchChanged())) == 0 ) { + if( !m_monitorActive && qstrcmp( signal, TQ_SIGNAL(switchChanged())) == 0 ) { m_watchTimer = new TQTimer(this); - connect( m_watchTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(processActiveSwitches()) ); + connect( m_watchTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(processActiveSwitches()) ); m_watchTimer->start( 2500, false ); m_monitorActive = true; diff --git a/tdecore/tdehw/tdeeventdevice.h b/tdecore/tdehw/tdeeventdevice.h index 64130508c..a1f1af6a6 100644 --- a/tdecore/tdehw/tdeeventdevice.h +++ b/tdecore/tdehw/tdeeventdevice.h @@ -79,7 +79,7 @@ class TQSocketNotifier; class TDECORE_EXPORT TDEEventDevice : public TDEGenericDevice { - Q_OBJECT + TQ_OBJECT public: /** diff --git a/tdecore/tdehw/tdegenericdevice.h b/tdecore/tdehw/tdegenericdevice.h index 91e9ac79e..53804cf96 100644 --- a/tdecore/tdehw/tdegenericdevice.h +++ b/tdecore/tdehw/tdegenericdevice.h @@ -30,7 +30,7 @@ class TDECORE_EXPORT TDEGenericDevice : public TQObject { - Q_OBJECT + TQ_OBJECT public: /** diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index 441db942d..59db6d0ae 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,11 +107,24 @@ 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() + TDE_EXPORT TDEHardwareDevices* create_tdeHardwareDevices() { return new TDEHardwareDevices(); } @@ -151,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 @@ -173,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 @@ -195,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(); } } @@ -281,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) { @@ -389,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; @@ -402,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") { @@ -412,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; } } @@ -452,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) @@ -467,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()); } } } @@ -863,7 +868,6 @@ void TDEHardwareDevices::processModifiedCPUs() { if (hwdevice) { // Signal new information available emit hardwareUpdated(hwdevice); - emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID()); } } } @@ -890,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); @@ -916,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()); } } } @@ -940,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 @@ -966,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) { @@ -2182,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") { @@ -2216,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") { @@ -2482,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; } @@ -2543,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); @@ -2765,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") && @@ -2797,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; } @@ -2888,6 +2825,8 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice *devic } sdevice->internalSetDiskLabel(disklabel); + sdevice->internalUpdateMountPath(); + sdevice->internalUpdateMappedName(); } } @@ -2985,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) { @@ -2996,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) { @@ -3689,8 +3628,6 @@ bool TDEHardwareDevices::queryHardwareInformation() { // Update parent/child tables for all devices updateParentDeviceInformation(); - emit hardwareEvent(TDEHardwareEvent::HardwareListModified, TQString()); - return true; } @@ -3800,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"; } @@ -3910,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"; } diff --git a/tdecore/tdehw/tdehardwaredevices.h b/tdecore/tdehw/tdehardwaredevices.h index 6d9b63ea6..4e4259dfc 100644 --- a/tdecore/tdehw/tdehardwaredevices.h +++ b/tdecore/tdehw/tdehardwaredevices.h @@ -81,7 +81,7 @@ typedef TQDict<TDECPUDevice> TDECPUDeviceCache; class TDECORE_EXPORT TDEHardwareDevices : public TQObject { - Q_OBJECT + TQ_OBJECT public: /** @@ -207,19 +207,13 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject /** * Rescan a hardware device to look for changes * WARNING: This method can be very expensive. Use with caution! - * @param hwdevice TDEGenericDevice* with the device to rescan - */ - void rescanDeviceInformation(TDEGenericDevice* hwdevice); - - /** - * Rescan a hardware device to look for changes - * WARNING: This method can be very expensive. Use with caution! * The computational expense can be reduced somewhat if the device tree structure * has not changed by calling this method with regenerateDeviceTree = false. * @param hwdevice TDEGenericDevice* with the device to rescan + * @param dev udev_device* with the udev device to rescan * @param regenerateDeviceTree true to update parent/child links in device tree */ - void rescanDeviceInformation(TDEGenericDevice* hwdevice, bool regenerateDeviceTree); + void rescanDeviceInformation(TDEGenericDevice* hwdevice, udev_device* dev = NULL, bool regenerateDeviceTree = true); /** * Enable or disable automatic state updates of triggerless hardware devices @@ -238,7 +232,7 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject * @param enable a bool specifiying whether or not automatic updates should be enabled */ void setBatteryUpdatesEnabled(bool enable); - + /** * Convert a byte count to human readable form * @param bytes a double containing the number of bytes @@ -250,8 +244,6 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject void hardwareAdded(TDEGenericDevice*); void hardwareRemoved(TDEGenericDevice*); void hardwareUpdated(TDEGenericDevice*); - void mountTableModified(); - void hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString uuid); /** * @param keycode the code of the key that was pressed/released diff --git a/tdecore/tdehw/tdehwcommontypes.h b/tdecore/tdehw/tdehwcommontypes.h index bc4eaeecf..e26de1996 100644 --- a/tdecore/tdehw/tdehwcommontypes.h +++ b/tdecore/tdehw/tdehwcommontypes.h @@ -91,16 +91,4 @@ enum TDEDisplayPowerLevel { }; }; -namespace TDEHardwareEvent { -enum TDEHardwareEvent { - HardwareListModified, - MountTableModified, - HardwareAdded, - HardwareRemoved, - HardwareUpdated, - Other, - Last = Other -}; -}; - #endif // _TDEHWCOMMON_H diff --git a/tdecore/tdehw/tdenetworkconnections.cpp b/tdecore/tdehw/tdenetworkconnections.cpp index 0cf1823a1..9a273cebb 100644 --- a/tdecore/tdehw/tdenetworkconnections.cpp +++ b/tdecore/tdehw/tdenetworkconnections.cpp @@ -41,7 +41,7 @@ /*================================================================================================*/ extern "C" { - KDE_EXPORT TDEGlobalNetworkManager* create_tdeGlobalNetworkManager() + TDE_EXPORT TDEGlobalNetworkManager* create_tdeGlobalNetworkManager() { return new TDEGlobalNetworkManager(); } @@ -707,7 +707,7 @@ TDEWiFiConnection::~TDEWiFiConnection() { TDENetworkConnectionManager::TDENetworkConnectionManager(TDENetworkDevice *networkDevice) : TQObject(), m_connectionList(NULL), m_hwNeighborList(NULL), m_networkDevice(networkDevice), m_prevConnectionStatus(TDENetworkGlobalManagerFlags::Unknown) { m_emissionTimer = new TQTimer(); - connect(m_emissionTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(emitQueuedSignals())); + connect(m_emissionTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(emitQueuedSignals())); if (!m_emissionTimer->isActive()) m_emissionTimer->start(0, true); } @@ -962,9 +962,9 @@ TDEGlobalNetworkManager::TDEGlobalNetworkManager() : m_internalConnectionManager m_internalConnectionManager = new TDENetworkConnectionManager_BackendNM(NULL); #endif // WITH_NETWORK_MANAGER_BACKEND if (m_internalConnectionManager) { - connect(m_internalConnectionManager, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); - connect(m_internalConnectionManager, SIGNAL(vpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString)), this, SIGNAL(vpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString))); - connect(m_internalConnectionManager, SIGNAL(networkManagementEvent(TDENetworkGlobalEventType::TDENetworkGlobalEventType)), this, SIGNAL(networkManagementEvent(TDENetworkGlobalEventType::TDENetworkGlobalEventType))); + connect(m_internalConnectionManager, TQ_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQ_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); + connect(m_internalConnectionManager, TQ_SIGNAL(vpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString)), this, TQ_SIGNAL(vpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString))); + connect(m_internalConnectionManager, TQ_SIGNAL(networkManagementEvent(TDENetworkGlobalEventType::TDENetworkGlobalEventType)), this, TQ_SIGNAL(networkManagementEvent(TDENetworkGlobalEventType::TDENetworkGlobalEventType))); } } @@ -1104,9 +1104,14 @@ TDENetworkWiFiAPInfo* TDEGlobalNetworkManager::findAccessPointByBSSID(TDEMACAddr TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(*it); if (dev) { TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); - TDENetworkWiFiAPInfo* candidate = deviceConnMan->findAccessPointByBSSID(bssid); - if (candidate) { - ret = candidate; + if (deviceConnMan) + { + TDENetworkWiFiAPInfo* candidate = deviceConnMan->findAccessPointByBSSID(bssid); + if (candidate) + { + ret = candidate; + break; + } } } } diff --git a/tdecore/tdehw/tdenetworkconnections.h b/tdecore/tdehw/tdenetworkconnections.h index 806c162a8..aa44e8edb 100644 --- a/tdecore/tdehw/tdenetworkconnections.h +++ b/tdecore/tdehw/tdenetworkconnections.h @@ -1015,7 +1015,7 @@ class TQTimer; class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject { - Q_OBJECT + TQ_OBJECT public: /** @@ -1364,7 +1364,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject { - Q_OBJECT + TQ_OBJECT public: /** diff --git a/tdecore/tdehw/tderootsystemdevice.cpp b/tdecore/tdehw/tderootsystemdevice.cpp index 741751581..4fe075831 100644 --- a/tdecore/tdehw/tderootsystemdevice.cpp +++ b/tdecore/tdehw/tderootsystemdevice.cpp @@ -32,13 +32,13 @@ #include "config.h" -#if defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER) || defined(WITH_HAL) || defined(WITH_CONSOLEKIT) +#if defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER) || defined(WITH_CONSOLEKIT) #include <tqdbusdata.h> #include <tqdbusmessage.h> #include <tqdbusproxy.h> #include <tqdbusvariant.h> #include <tqdbusconnection.h> -#endif // defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER) || defined(WITH_HAL) || defined(WITH_CONSOLEKIT) +#endif TDERootSystemDevice::TDERootSystemDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { m_hibernationSpace = -1; @@ -247,32 +247,6 @@ bool TDERootSystemDevice::canSuspend() { } #endif// WITH_DEVKITPOWER -#ifdef WITH_HAL - { - TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if (dbusConn.isConnected()) { - TQT_DBusProxy halProperties("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device", dbusConn); - if (halProperties.canSend()) { - // can suspend? - TQValueList<TQT_DBusData> params; - TQT_DBusMessage reply; - params.clear(); - params << TQT_DBusData::fromString("power_management.can_suspend"); - reply = halProperties.sendWithReply("GetPropertyBoolean", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - return reply[0].toBool(); - } - params.clear(); - params << TQT_DBusData::fromString("power_management.can_suspend_to_ram"); - reply = halProperties.sendWithReply("GetPropertyBoolean", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - return reply[0].toBool(); - } - } - } - } -#endif // WITH_HAL - #ifdef WITH_TDEHWLIB_DAEMONS { TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); @@ -362,32 +336,6 @@ bool TDERootSystemDevice::canHibernate() { } #endif// WITH_DEVKITPOWER -#ifdef WITH_HAL - { - TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if (dbusConn.isConnected()) { - TQT_DBusProxy halProperties("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device", dbusConn); - if (halProperties.canSend()) { - // can hibernate? - TQValueList<TQT_DBusData> params; - TQT_DBusMessage reply; - params.clear(); - params << TQT_DBusData::fromString("power_management.can_hibernate"); - reply = halProperties.sendWithReply("GetPropertyBoolean", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - return reply[0].toBool(); - } - params.clear(); - params << TQT_DBusData::fromString("power_management.can_suspend_to_disk"); - reply = halProperties.sendWithReply("GetPropertyBoolean", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - return reply[0].toBool(); - } - } - } - } -#endif // WITH_HAL - #ifdef WITH_TDEHWLIB_DAEMONS { TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); @@ -444,26 +392,6 @@ bool TDERootSystemDevice::canHybridSuspend() { // No support "hybrid suspend" in org.freedesktop.UPower // No support "hybrid suspend" in org.freedesktop.DeviceKit.Power -#ifdef WITH_HAL - { - TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if (dbusConn.isConnected()) { - TQT_DBusProxy halProperties("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device", dbusConn); - if (halProperties.canSend()) { - // can hybrid suspend? - TQValueList<TQT_DBusData> params; - TQT_DBusMessage reply; - params.clear(); - params << TQT_DBusData::fromString("power_management.can_suspend_hybrid"); - reply = halProperties.sendWithReply("GetPropertyBoolean", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - return reply[0].toBool(); - } - } - } - } -#endif // WITH_HAL - #ifdef WITH_TDEHWLIB_DAEMONS { TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); @@ -794,53 +722,6 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState } #endif // WITH_DEVKITPOWER -#ifdef WITH_HAL - { - // No support for "freeze" in org.freedesktop.Hal - TQT_DBusConnection dbusConn; - dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if ( dbusConn.isConnected() ) { - if (ps == TDESystemPowerState::Suspend) { - TQT_DBusProxy halPowerManagement( - "org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", - dbusConn); - TQValueList<TQT_DBusData> params; - params << TQT_DBusData::fromInt32(0); - TQT_DBusMessage reply = halPowerManagement.sendWithReply("Suspend", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage) { - return true; - } - } - else if (ps == TDESystemPowerState::Hibernate) { - TQT_DBusMessage msg = TQT_DBusMessage::methodCall( - "org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", - "Hibernate"); - TQT_DBusMessage reply = dbusConn.sendWithReply(msg); - if (reply.type() == TQT_DBusMessage::ReplyMessage) { - return true; - } - } - else if (ps == TDESystemPowerState::HybridSuspend) { - TQT_DBusProxy halPowerManagement( - "org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", - dbusConn); - TQValueList<TQT_DBusData> params; - params << TQT_DBusData::fromInt32(0); - TQT_DBusMessage reply = halPowerManagement.sendWithReply("SuspendHybrid", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage) { - return true; - } - } - } - } -#endif // WITH_HAL - #ifdef WITH_TDEHWLIB_DAEMONS { TQT_DBusConnection dbusConn; diff --git a/tdecore/tdehw/tdestoragedevice.cpp b/tdecore/tdehw/tdestoragedevice.cpp index 60ea51912..df5f90ab7 100644 --- a/tdecore/tdehw/tdestoragedevice.cpp +++ b/tdecore/tdehw/tdestoragedevice.cpp @@ -43,11 +43,9 @@ #if defined(WITH_CRYPTSETUP) #ifdef CRYPTSETUP_OLD_API #define class cryptsetup_class - #define CRYPT_SLOT_INVALID INVALID - #define CRYPT_SLOT_INACTIVE INACTIVE - #define CRYPT_SLOT_ACTIVE ACTIVE - #define CRYPT_SLOT_BUSY BUSY - #define CRYPT_SLOT_ACTIVE_LAST ACTIVE + #define CRYPT_SLOT_INACTIVE SLOT_INACTIVE + #define CRYPT_SLOT_ACTIVE SLOT_ACTIVE + #define CRYPT_SLOT_ACTIVE_LAST SLOT_ACTIVE_LAST #include <libcryptsetup.h> #undef class #else @@ -73,7 +71,7 @@ TQString TDEStorageDevice::mappedName() { return m_mappedName; } -void TDEStorageDevice::updateMappedName() { +void TDEStorageDevice::internalUpdateMappedName() { // Get the device mapped name if present m_mappedName = TQString::null; TQString dmnodename = systemPath(); @@ -331,20 +329,19 @@ TQStringVariantMap TDEStorageDevice::ejectDrive() { TQStringVariantMap result; TQStringVariantMap ejectResult; + // If the device is mounted, try unmounting it first + if (!mountPath().isEmpty()) { + unmountDevice(); + } + #ifdef WITH_UDISKS2 if (!(TDEGlobal::dirs()->findExe("udisksctl").isEmpty())) { ejectResult = udisks2EjectDrive(this); if (ejectResult["result"].toBool()) { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = true; return result; } else { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["errStr"] = ejectResult["errStr"]; result["result"] = false; return result; @@ -355,16 +352,10 @@ TQStringVariantMap TDEStorageDevice::ejectDrive() { if (!(TDEGlobal::dirs()->findExe("udisks").isEmpty())) { ejectResult = udisksEjectDrive(this); if (ejectResult["result"].toBool()) { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = true; return result; } else { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["errStr"] = ejectResult["errStr"]; result["result"] = false; return result; @@ -382,9 +373,6 @@ TQStringVariantMap TDEStorageDevice::ejectDrive() { eject_output = ts.read(); int retcode = pclose(exepipe); if (retcode == 0) { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = true; return result; } @@ -395,9 +383,6 @@ TQStringVariantMap TDEStorageDevice::ejectDrive() { } } - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = false; return result; } @@ -519,7 +504,7 @@ TQString TDEStorageDevice::friendlyName() { TQString label = diskLabel(); if (label.isNull()) { if (deviceSize() > 0) { - if (checkDiskStatus(TDEDiskDeviceStatus::Hotpluggable)) { + if (checkDiskStatus(TDEDiskDeviceStatus::Removable)) { label = i18n("%1 Removable Device").arg(deviceFriendlySize()); } else { @@ -576,7 +561,7 @@ TQString TDEStorageDevice::friendlyDeviceType() { if (isDiskOfType(TDEDiskDeviceType::HDD)) { ret = i18n("Hard Disk Drive"); - if (checkDiskStatus(TDEDiskDeviceStatus::Hotpluggable)) { + if (checkDiskStatus(TDEDiskDeviceStatus::Removable)) { ret = i18n("Removable Storage"); } if (isDiskOfType(TDEDiskDeviceType::CompactFlash)) { @@ -647,7 +632,7 @@ TQPixmap TDEStorageDevice::icon(TDEIcon::StdSizes size) { if (isDiskOfType(TDEDiskDeviceType::HDD)) { ret = DesktopIcon("drive-harddisk" + mountString, size); - if (checkDiskStatus(TDEDiskDeviceStatus::Hotpluggable)) { + if (checkDiskStatus(TDEDiskDeviceStatus::Removable)) { ret = DesktopIcon("media-flash-usb" + mountString, size); } if (isDiskOfType(TDEDiskDeviceType::CompactFlash)) { @@ -697,7 +682,13 @@ TQString TDEStorageDevice::deviceFriendlySize() { return TDEHardwareDevices::bytesToFriendlySizeString(deviceSize()); } -TQString TDEStorageDevice::mountPath() { +TQString TDEStorageDevice::mountPath() +{ + return m_mountPath; +} + +void TDEStorageDevice::internalUpdateMountPath() +{ // See if this device node is mounted // This requires parsing /proc/mounts, looking for deviceNode() @@ -705,8 +696,10 @@ TQString TDEStorageDevice::mountPath() { // It likes to advertise mounts as /dev/mapper/<something>, // where <something> is listed in <system path>/dm/name - // First, ensure that all device information (mainly holders/slaves) is accurate - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); + // Assumed all device information (mainly holders/slaves) is accurate + // prior to the call + + m_mountPath = TQString::null; TQStringList lines; TQFile file( "/proc/mounts" ); @@ -719,29 +712,15 @@ TQString TDEStorageDevice::mountPath() { TQString testNode = *mountInfo.at(0); // Check for match if ((testNode == deviceNode()) || (testNode == mappedName()) || (testNode == ("/dev/disk/by-uuid/" + diskUUID()))) { - TQString ret = *mountInfo.at(1); - ret.replace("\\040", " "); - return ret; + m_mountPath = *mountInfo.at(1); + m_mountPath.replace("\\040", " "); + file.close(); + return; } lines += line; } file.close(); } - - // While this device is not directly mounted, it could concievably be mounted via the Device Mapper - // If so, try to retrieve the mount path... - TQStringList slaveDeviceList = holdingDevices(); - for ( TQStringList::Iterator slavedevit = slaveDeviceList.begin(); slavedevit != slaveDeviceList.end(); ++slavedevit ) { - // Try to locate this device path in the TDE device tree - TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); - TDEGenericDevice *hwdevice = hwdevices->findBySystemPath(*slavedevit); - if ((hwdevice) && (hwdevice->type() == TDEGenericDeviceType::Disk)) { - TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice); - return sdevice->mountPath(); - } - } - - return TQString::null; } TQStringVariantMap TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOptions mountOptions) { @@ -825,7 +804,6 @@ TQStringVariantMap TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageM mountResult = udisks2MountDrive(devNode, fileSystemType, optionString); if (mountResult["result"].toBool()) { // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["mountPath"] = mountPath(); result["result"] = true; @@ -833,7 +811,6 @@ TQStringVariantMap TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageM } else if (mountResult["retcode"].toInt() == -1) { // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["errStr"] = mountResult["errStr"]; result["result"] = false; @@ -847,7 +824,6 @@ TQStringVariantMap TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageM mountResult = udisksMountDrive(devNode, fileSystemType, udisksOptions); if (mountResult["result"].toBool()) { // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["mountPath"] = mountPath(); result["result"] = true; @@ -855,7 +831,6 @@ TQStringVariantMap TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageM } else if (mountResult["retcode"].toInt() == -1) { // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["errStr"] = mountResult["errStr"]; result["result"] = false; @@ -945,7 +920,6 @@ TQStringVariantMap TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageM } // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["mountPath"] = mountPath(); result["result"] = !mountPath().isEmpty(); @@ -956,13 +930,13 @@ TQStringVariantMap TDEStorageDevice::unmountDevice() { TQStringVariantMap result; // Check if device is already unmounted - TQString mountpoint = mountPath(); - if (mountpoint.isEmpty()) { + TQString mountpath = mountPath(); + if (mountpath.isEmpty()) { result["result"] = true; return result; } - mountpoint.replace("'", "'\\''"); + mountpath.replace("'", "'\\''"); TQString devNode = deviceNode(); TQString command = TQString::null; TQStringVariantMap unmountResult; @@ -972,14 +946,12 @@ TQStringVariantMap TDEStorageDevice::unmountDevice() { unmountResult = udisks2UnmountDrive(devNode, TQString::null); if (unmountResult["result"].toBool()) { // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = true; return result; } else if (unmountResult["retcode"].toInt() == -1) { // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["errStr"] = unmountResult["errStr"]; result["result"] = false; @@ -993,14 +965,12 @@ TQStringVariantMap TDEStorageDevice::unmountDevice() { unmountResult = udisksUnmountDrive(devNode, TQStringList()); if (unmountResult["result"].toBool()) { // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = true; return result; } else if (unmountResult["retcode"].toInt() == -1) { // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["errStr"] = unmountResult["errStr"]; result["result"] = false; @@ -1012,13 +982,13 @@ TQStringVariantMap TDEStorageDevice::unmountDevice() { // The UDISKS v1 DBUS service was either not available or was unusable // Use 'udevil' command, if available if (!TDEGlobal::dirs()->findExe("udevil").isEmpty()) { - command = TQString("udevil umount '%1' 2>&1").arg(mountpoint); + command = TQString("udevil umount '%1' 2>&1").arg(mountpath); } #endif // If no other method was found, use 'pmount' command if available if(command.isEmpty() && !TDEGlobal::dirs()->findExe("pumount").isEmpty()) { - command = TQString("pumount '%1' 2>&1").arg(mountpoint); + command = TQString("pumount '%1' 2>&1").arg(mountpath); } if(command.isEmpty()) { @@ -1035,7 +1005,6 @@ TQStringVariantMap TDEStorageDevice::unmountDevice() { int retcode = pclose(exepipe); if (retcode == 0) { // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = true; return result; @@ -1047,7 +1016,6 @@ TQStringVariantMap TDEStorageDevice::unmountDevice() { } // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = false; return result; @@ -1057,14 +1025,6 @@ TQStringVariantMap TDEStorageDevice::unlockDevice(const TQString &passphrase) { TQStringVariantMap result; - // Check if device is already mounted - TQString mountpath = mountPath(); - if (!mountpath.isEmpty()) { - result["unlockedDevice"] = mountpath; - result["result"] = true; - return result; - } - TQString devNode = deviceNode(); devNode.replace("'", "'\\''"); @@ -1074,17 +1034,11 @@ TQStringVariantMap TDEStorageDevice::unlockDevice(const TQString &passphrase) // Try to use UDISKS v2 via DBUS, if available unlockResult = udisks2UnlockDrive(devNode, passphrase); if (unlockResult["result"].toBool()) { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["unlockedDevice"] = unlockResult["unlockedDevice"]; result["result"] = true; return result; } else if (unlockResult["retcode"].toInt() == -1) { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["errStr"] = unlockResult["errStr"]; result["result"] = false; return result; @@ -1115,9 +1069,6 @@ TQStringVariantMap TDEStorageDevice::unlockDevice(const TQString &passphrase) delete ts; int retcode = pclose(exepipe); if (retcode == 0) { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = true; } else { @@ -1139,14 +1090,6 @@ TQStringVariantMap TDEStorageDevice::lockDevice() { TQStringVariantMap result; - // Check if device is mounted - TQString mountpath = mountPath(); - if (!mountpath.isEmpty()) { - result["errStr"] = i18n("The device is currently mounted and cannot be locked."); - result["result"] = false; - return result; - } - TQString devNode = deviceNode(); devNode.replace("'", "'\\''"); @@ -1156,16 +1099,10 @@ TQStringVariantMap TDEStorageDevice::lockDevice() // Try to use UDISKS v2 via DBUS, if available lockResult = udisks2LockDrive(devNode); if (lockResult["result"].toBool()) { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = true; return result; } else if (lockResult["retcode"].toInt() == -1) { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["errStr"] = lockResult["errStr"]; result["result"] = false; return result; @@ -1182,9 +1119,6 @@ TQStringVariantMap TDEStorageDevice::lockDevice() delete ts; int retcode = pclose(exepipe); if (retcode == 0) { - // Update internal mount data - TDEGlobal::hardwareDevices()->rescanDeviceInformation(this); - TDEGlobal::hardwareDevices()->processModifiedMounts(); result["result"] = true; } else { @@ -1202,57 +1136,4 @@ TQStringVariantMap TDEStorageDevice::lockDevice() return result; } -TQString TDEStorageDevice::determineFileSystemType(TQString path) { - TQStringList mountTable; - TQString prevPath = path; - dev_t prevDev = 0; - int pos; - struct stat directory_info; - if (path.startsWith("/")) { - stat(path.local8Bit(), &directory_info); - prevDev = directory_info.st_dev; - // Walk the directory tree up to the root, checking for any change in st_dev - // If a change is found, the previous value of path is the mount point itself - while (path != "/") { - pos = path.findRev("/", -1, true); - if (pos < 0) { - break; - } - path = path.mid(0, pos); - if (path == "") { - path = "/"; - } - stat(path.local8Bit(), &directory_info); - if (directory_info.st_dev != prevDev) { - break; - } - prevPath = path; - prevDev = directory_info.st_dev; - } - } - - // Read in mount table - mountTable.clear(); - TQFile file( "/proc/mounts" ); - if ( file.open( IO_ReadOnly ) ) { - TQTextStream stream( &file ); - while ( !stream.atEnd() ) { - mountTable.append(stream.readLine()); - } - file.close(); - } - - // Parse mount table - TQStringList::Iterator it; - for ( it = mountTable.begin(); it != mountTable.end(); ++it ) { - TQStringList mountInfo = TQStringList::split(" ", (*it), true); - if ((*mountInfo.at(1)) == prevPath) { - return (*mountInfo.at(2)); - } - } - - // Unknown file system type - return TQString::null; -} - #include "tdestoragedevice.moc" diff --git a/tdecore/tdehw/tdestoragedevice.h b/tdecore/tdehw/tdestoragedevice.h index 61ef6daad..891b31573 100644 --- a/tdecore/tdehw/tdestoragedevice.h +++ b/tdecore/tdehw/tdestoragedevice.h @@ -22,6 +22,7 @@ #include "tdegenericdevice.h" #include "tqvariant.h" +#include "kdemacros.h" struct crypt_device; @@ -107,7 +108,7 @@ enum TDEDiskDeviceStatus { UsedByDevice = 0x00000010, UsesDevice = 0x00000020, ContainsFilesystem = 0x00000040, - Hotpluggable = 0x00000080, + // Do not use 0x00000080, it was `Hotpluggable` up to the R14.1.x series Hidden = 0x00000100, Other = 0x80000000 }; @@ -199,11 +200,6 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice TQString mappedName(); /** - * Find and store the alternative mapped name of a mapped device - */ - void updateMappedName(); - - /** * @return an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags */ TDEDiskDeviceType::TDEDiskDeviceType diskType(); @@ -350,13 +346,6 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice TQStringVariantMap ejectDrive(); /** - * @param path Full path to arbitrary file or directory - * @return TQString with type of file system containing the given file, - * or TQString::null if file system type unknown - */ - static TQString determineFileSystemType(TQString path); - - /** * Set the unlock password to use in subsequent LUKS operations * @see cryptClearOperationsUnlockPassword * @@ -501,6 +490,16 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice */ void internalGetLUKSKeySlotStatus(); + /** + * Find and store the alternative mapped name of a mapped device + */ + void internalUpdateMappedName(); + + /** + * Find and store the mount point of the device, if any + */ + void internalUpdateMountPath(); + private: TQString m_mappedName; // Alternative name for a mapped device TDEDiskDeviceType::TDEDiskDeviceType m_diskType; |