From 671c23c662e7f7eeaac796517448d12fb019d853 Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Sat, 23 Nov 2013 23:45:36 +0000 Subject: 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 --- src/serialport/qserialportinfo_unix.cpp | 43 +++++++++------------------------ 1 file changed, 12 insertions(+), 31 deletions(-) (limited to 'src/serialport/qserialportinfo_unix.cpp') 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 #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::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::availablePorts() } while (targetDir.cdUp()); } else { - // unknown types of devices continue; } @@ -216,7 +212,6 @@ QList QSerialPortInfo::availablePorts() #endif QList 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::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::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::availablePorts() #endif -#endif // Q_OS_MAC - -// common part +#endif QList QSerialPortInfo::standardBaudRates() { -- cgit v1.2.1