diff options
author | Laszlo Papp <lpapp@kde.org> | 2013-11-23 23:45:36 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-24 20:07:40 +0100 |
commit | 671c23c662e7f7eeaac796517448d12fb019d853 (patch) | |
tree | d3b08ed92ed1b82a6bd06c391b316c3b79b0665b /src/serialport | |
parent | b261bfe1b56ae1ec21d4eb284facb63463c7e948 (diff) | |
download | qtserialport-671c23c662e7f7eeaac796517448d12fb019d853.tar.gz |
Remove the unnecessary and noisy comments for the serial port info files
Comments are noisy, useless, and can get outdated. The only comments that might
make sense to me the ones where we note future tasks, such as TODO (or FIXME).
The code should document itself.
The serial port files need a separate evaluation since a lot of stuff is
inherited from QtCore in there where the comments should probably be kept for
consistency.
Change-Id: I6c759c7138f64546c2c4e27a039667c556a30db9
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/serialport')
-rw-r--r-- | src/serialport/qserialportinfo_mac.cpp | 3 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_symbian.cpp | 21 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_unix.cpp | 43 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_win.cpp | 2 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_wince.cpp | 3 |
5 files changed, 18 insertions, 54 deletions
diff --git a/src/serialport/qserialportinfo_mac.cpp b/src/serialport/qserialportinfo_mac.cpp index af57598..c69a4a3 100644 --- a/src/serialport/qserialportinfo_mac.cpp +++ b/src/serialport/qserialportinfo_mac.cpp @@ -97,7 +97,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() io_registry_entry_t entry = service; - // Find MacOSX-specific properties names. do { if (!device) { @@ -184,7 +183,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() } - // If all matching properties is found, then force break loop. if (matchingPropertiesCounter == propertyCount) break; @@ -194,7 +192,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() (void) ::IOObjectRelease(entry); - // Convert from MacOSX-specific properties to Qt4-specific. if (matchingPropertiesCounter > 0) { QSerialPortInfo serialPortInfo; diff --git a/src/serialport/qserialportinfo_symbian.cpp b/src/serialport/qserialportinfo_symbian.cpp index 5512048..cae00e9 100644 --- a/src/serialport/qserialportinfo_symbian.cpp +++ b/src/serialport/qserialportinfo_symbian.cpp @@ -46,7 +46,6 @@ #include "qserialport_symbian_p.h" #include <e32base.h> -//#include <e32test.h> #include <c32comm.h> #include <f32file.h> @@ -54,23 +53,19 @@ QT_BEGIN_NAMESPACE -// Physical device driver. #ifdef __WINS__ _LIT(KPddName, "ECDRV"); -#else // defined (__EPOC32__) +#else _LIT(KPddName, "EUART"); #endif -// Logical native device driver. _LIT(KLddName,"ECOMM"); -// Modules names. _LIT(KRS232ModuleName , "ECUART"); _LIT(KBluetoothModuleName , "BTCOMM"); _LIT(KInfraRedModuleName , "IRCOMM"); _LIT(KACMModuleName, "ECACM"); -// Return false on error load. static bool loadDevices() { TInt r = KErrNone; @@ -84,16 +79,16 @@ static bool loadDevices() r = User::LoadPhysicalDevice(KPddName); if (r != KErrNone && r != KErrAlreadyExists) - return false; //User::Leave(r); + return false; r = User::LoadLogicalDevice(KLddName); if (r != KErrNone && r != KErrAlreadyExists) - return false; //User::Leave(r); + return false; #ifndef __WINS__ r = StartC32(); if (r != KErrNone && r != KErrAlreadyExists) - return false; //User::Leave(r); + return false; #endif return true; @@ -109,14 +104,13 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() RCommServ server; TInt r = server.Connect(); if (r != KErrNone) - return serialPortInfoList; //User::LeaveIfError(r); + return serialPortInfoList; - TSerialInfo nativeSerialInfo; // Native Symbian OS port info class. + TSerialInfo nativeSerialInfo; QString s("%1::%2"); // FIXME: Get info about RS232 ports. r = server.LoadCommModule(KRS232ModuleName); - //User::LeaveIfError(r); if (r == KErrNone) { r = server.GetPortInfo(KRS232ModuleName, nativeSerialInfo); if (r == KErrNone) { @@ -138,7 +132,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() // FIXME: Get info about Bluetooth ports. r = server.LoadCommModule(KBluetoothModuleName); - //User::LeaveIfError(r); if (r == KErrNone) { r = server.GetPortInfo(KBluetoothModuleName, nativeSerialInfo); if (r == KErrNone) { @@ -160,7 +153,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() // FIXME: Get info about InfraRed ports. r = server.LoadCommModule(KInfraRedModuleName); - //User::LeaveIfError(r); if (r == KErrNone) { r = server.GetPortInfo(KInfraRedModuleName, nativeSerialInfo); if (r == KErrNone) { @@ -182,7 +174,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() // FIXME: Get info about ACM ports. r = server.LoadCommModule(KACMModuleName); - //User::LeaveIfError(r); if (r == KErrNone) { r = server.GetPortInfo(KACMModuleName, nativeSerialInfo); if (r == KErrNone) { diff --git a/src/serialport/qserialportinfo_unix.cpp b/src/serialport/qserialportinfo_unix.cpp index 7013587..5fb110c 100644 --- a/src/serialport/qserialportinfo_unix.cpp +++ b/src/serialport/qserialportinfo_unix.cpp @@ -57,7 +57,7 @@ #include <QtCore/qstringlist.h> #endif -#endif // Q_OS_MAC +#endif QT_BEGIN_NAMESPACE @@ -83,7 +83,7 @@ static QStringList filteredDeviceFilePaths() #elif defined (Q_OS_FREEBSD) << QStringLiteral("cu*"); #else - ; // Here for other *nix OS. + ; #endif QStringList result; @@ -130,11 +130,8 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() QSerialPortInfo serialPortInfo; if (targetPath.contains(QStringLiteral("pnp"))) { - // TODO: Implement me. + // TODO: Obtain more information } else if (targetPath.contains(QStringLiteral("platform"))) { - // Platform 'pseudo' bus for legacy device. - // Skip this devices because this type of subsystem does - // not include a real physical serial device. continue; } else if (targetPath.contains(QStringLiteral("usb"))) { @@ -181,7 +178,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() } while (targetDir.cdUp()); } else { - // unknown types of devices continue; } @@ -216,7 +212,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() #endif QList<QSerialPortInfo> serialPortInfoList; - // White list for devices without a parent static const QString rfcommDeviceName(QStringLiteral("rfcomm")); struct ::udev *udev = ::udev_new(); @@ -254,8 +249,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() QString subsys = QString::fromLatin1(::udev_device_get_subsystem(parentdev)); if (subsys == QStringLiteral("usb-serial") - || subsys == QStringLiteral("usb")) { // USB bus type - // Append this devices and try get additional information about them. + || subsys == QStringLiteral("usb")) { serialPortInfo.d_ptr->description = QString::fromLatin1(::udev_device_get_property_value(dev, "ID_MODEL")).replace(QLatin1Char('_'), QLatin1Char(' ')); serialPortInfo.d_ptr->manufacturer = QString::fromLatin1(::udev_device_get_property_value(dev, @@ -269,27 +263,16 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() QString::fromLatin1(::udev_device_get_property_value(dev, "ID_MODEL_ID")).toInt(&serialPortInfo.d_ptr->hasProductIdentifier, 16); - } else if (subsys == QStringLiteral("pnp")) { // PNP bus type - // Append this device. - // FIXME: How to get additional information about serial devices - // with this subsystem? - } else if (subsys == QStringLiteral("platform")) { // Platform 'pseudo' bus for legacy device. - // Skip this devices because this type of subsystem does - // not include a real physical serial device. + } else if (subsys == QStringLiteral("pnp")) { + // TODO: Obtain more information + } else if (subsys == QStringLiteral("platform")) { continue; - } else { // Others types of subsystems. - // Append this devices because we believe that any other types of - // subsystems provide a real serial devices. For example, for devices - // such as ttyGSx, its driver provide an empty subsystem name, but it - // devices is a real physical serial devices. - // FIXME: How to get additional information about serial devices - // with this subsystems? + } else { + // FIXME: Obtain more information } - } else { // Devices without a parent - if (serialPortInfo.d_ptr->portName.startsWith(rfcommDeviceName)) { // Bluetooth device + } else { + if (serialPortInfo.d_ptr->portName.startsWith(rfcommDeviceName)) { bool ok; - // Check for an unsigned decimal integer at the end of the device name: "rfcomm0", "rfcomm15" - // devices with negative and invalid numbers in the name are rejected int portNumber = serialPortInfo.d_ptr->portName.mid(rfcommDeviceName.length()).toInt(&ok); if (!ok || (portNumber < 0) || (portNumber > 255)) @@ -317,9 +300,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() #endif -#endif // Q_OS_MAC - -// common part +#endif QList<qint32> QSerialPortInfo::standardBaudRates() { diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp index 7eec46a..a584d78 100644 --- a/src/serialport/qserialportinfo_win.cpp +++ b/src/serialport/qserialportinfo_win.cpp @@ -227,8 +227,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() #endif -// common part - QList<qint32> QSerialPortInfo::standardBaudRates() { return QSerialPortPrivate::standardBaudRates(); diff --git a/src/serialport/qserialportinfo_wince.cpp b/src/serialport/qserialportinfo_wince.cpp index 0d0fd0d..27ecb28 100644 --- a/src/serialport/qserialportinfo_wince.cpp +++ b/src/serialport/qserialportinfo_wince.cpp @@ -119,9 +119,6 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() serialPortInfo.d_ptr->description = findDescription(HKEY_LOCAL_MACHINE, QString::fromWCharArray(di.szDeviceKey)); - // Get manufacturer, vendor identifier, product identifier are not - // possible. - serialPortInfoList.append(serialPortInfo); } while (::FindNextDevice(hSearch, &di)); |