From 5fdf839b35497b5470dc9e27e8503083f0b55266 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 24 Aug 2015 10:35:16 -0500 Subject: Add cryptographic card device type Add hub device type Fix incorrect USB subclass read --- tdecore/tdehw/tdehardwaredevices.cpp | 32 +++++++++++++++++++++++++++++--- tdecore/tdehw/tdehwcommontypes.h | 2 ++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index b0162f6fe..d2fd7e2f3 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -1383,12 +1383,18 @@ TDEGenericDeviceType::TDEGenericDeviceType readGenericDeviceTypeFromString(TQStr else if (query == "Bridge") { ret = TDEGenericDeviceType::Bridge; } + else if (query == "Hub") { + ret = TDEGenericDeviceType::Hub; + } else if (query == "Platform") { ret = TDEGenericDeviceType::Platform; } else if (query == "Cryptography") { ret = TDEGenericDeviceType::Cryptography; } + else if (query == "CryptographicCard") { + ret = TDEGenericDeviceType::CryptographicCard; + } else if (query == "Event") { ret = TDEGenericDeviceType::Event; } @@ -2261,7 +2267,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD TQFile ifaceprotofile(current_path + "/bInterfaceClass"); if (ifaceprotofile.open(IO_ReadOnly)) { TQTextStream stream( &ifaceprotofile ); - usbInterfaceClass = stream.readLine().toUInt(); + usbInterfaceClass = stream.readLine().toUInt(NULL, 16); ifaceprotofile.close(); } } @@ -2271,7 +2277,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD TQFile ifaceprotofile(current_path + "/bInterfaceSubClass"); if (ifaceprotofile.open(IO_ReadOnly)) { TQTextStream stream( &ifaceprotofile ); - usbInterfaceSubClass = stream.readLine().toUInt(); + usbInterfaceSubClass = stream.readLine().toUInt(NULL, 16); ifaceprotofile.close(); } } @@ -2281,10 +2287,18 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD TQFile ifaceprotofile(current_path + "/bInterfaceProtocol"); if (ifaceprotofile.open(IO_ReadOnly)) { TQTextStream stream( &ifaceprotofile ); - usbInterfaceProtocol = stream.readLine().toUInt(); + usbInterfaceProtocol = stream.readLine().toUInt(NULL, 16); ifaceprotofile.close(); } } + if (usbInterfaceClass == 9) { + // Hub + if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Hub); + } + if (usbInterfaceClass == 11) { + // Smart Card Reader + if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::CryptographicCard); + } if ((usbInterfaceClass == 6) && (usbInterfaceSubClass == 1) && (usbInterfaceProtocol == 1)) { // PictBridge if (!device) { @@ -4069,12 +4083,18 @@ TQString TDEHardwareDevices::getFriendlyDeviceTypeStringFromType(TDEGenericDevic else if (query == TDEGenericDeviceType::Bridge) { ret = i18n("Bridge"); } + else if (query == TDEGenericDeviceType::Hub) { + ret = i18n("Hub"); + } else if (query == TDEGenericDeviceType::Platform) { ret = i18n("Platform"); } else if (query == TDEGenericDeviceType::Cryptography) { ret = i18n("Cryptography"); } + else if (query == TDEGenericDeviceType::CryptographicCard) { + ret = i18n("Cryptographic Card"); + } else if (query == TDEGenericDeviceType::Event) { ret = i18n("Platform Event"); } @@ -4224,12 +4244,18 @@ TQPixmap TDEHardwareDevices::getDeviceTypeIconFromType(TDEGenericDeviceType::TDE else if (query == TDEGenericDeviceType::Bridge) { ret = DesktopIcon("kcmpci", size); } + else if (query == TDEGenericDeviceType::Hub) { + ret = DesktopIcon("usb", size); + } else if (query == TDEGenericDeviceType::Platform) { ret = DesktopIcon("preferences-system", size); } else if (query == TDEGenericDeviceType::Cryptography) { ret = DesktopIcon("password", size); } + else if (query == TDEGenericDeviceType::CryptographicCard) { + ret = DesktopIcon("password", size); + } else if (query == TDEGenericDeviceType::Event) { ret = DesktopIcon("preferences-system", size); } diff --git a/tdecore/tdehw/tdehwcommontypes.h b/tdecore/tdehw/tdehwcommontypes.h index 095672669..b560407eb 100644 --- a/tdecore/tdehw/tdehwcommontypes.h +++ b/tdecore/tdehw/tdehwcommontypes.h @@ -60,8 +60,10 @@ enum TDEGenericDeviceType { ThermalControl, BlueTooth, Bridge, + Hub, Platform, Cryptography, + CryptographicCard, Event, Input, PNP, -- cgit v1.2.3