summaryrefslogtreecommitdiff
path: root/src/serialport/qserialportinfo_win.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Refactor QSPI code on WindowsDenis Shienkov2015-10-071-40/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | Current approach with passing of the array's data pointer to a Win API functions when the array is empty has potential danger. Because the data pointer is invalid, and if a Win API function tries to get access to this pointer then this can cause a crash or an UB. Still this does not happens, but nobody guarantees that this will be same in future. It is better to pre-allocate the array with some size (e.g. with the MAX_PATH size). In this case we can pass the data pointer without any problem. Besides, the Win API functions will return result with the first pass if the array size is sufficient; otherwise it returns ERROR_MORE_DATA error code and we can re-allocate the array with required size and to return a result in the second pass. We re-allocate the array with size more than required on some bytes with filling of the array with zeros. This allows us to convert it using QString::fromWCharArray() without specifying a size, and to remove the toStringAndTrimNullCharacter() function. (cherry-picked from 96b9590dbeb20e000d9d9308bee2162b1101a7e0) Change-Id: I5976485286db4097514ea7b3a8adfc9a6a7cea4f Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Fix getting duplicate serial ports with null charactersDenis Shienkov2015-07-101-5/+4
| | | | | | | | | | | | | | | The function toStringAndTrimNullCharacter() deletes only trailing zeroes from right to left direction up to the first non-zero character were meet. This can return the wrong string in case there are the zero characters to the left of the non-zero characters. We should look for the first zero-character from left to right direction, and discard all right part of a string, including the zero-character. (cherry-picked from 84de1b10d242551a51b6c4ce5eda657c4743bc63) Task-number: QTBUG-47127 Change-Id: I4d101b49bbb153bddbe535a920d616b5fef130e9 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Don't use QStringLiteral when QLatin1String is efficient.Debao Zhang2015-04-201-7/+7
| | | | | | | | | For QLatin1String, startsWith/endsWith/append/operator==/... are overloaded, so use QLatin1String instead of QStringLiteral in such cases. (cherry-picked from 7f857db22e0d409aac65e4773bb377796893b624) Change-Id: I92b0a2597f935acb4310c8d717a46b537308ecd9 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Update the licenses and its headersDenis Shienkov2015-02-171-13/+21
| | | | | | | | | | | As this branch is intended for support of Qt4, then expediently to revert the license headers with the same content as in the current Qt4. Besides, are removed the licenses as GPLv2(2.1, 3) as they aren't present in sources of current Qt4. Change-Id: I8bda62ef5f95f362053ad77f5b1666df27795254 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Update copyright headersJani Heikkinen2015-02-161-6/+6
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I35f551de8408a2eb6a0f39df1f09d90c8084a7c0 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Use Q_NULLPTR where it is possibleDenis Shienkov2015-01-061-6/+6
| | | | | Change-Id: I7261a92ea4405c8aeab7670f73e7225ed7e4d9d0 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Allow to use custom devices pathsDenis Shienkov2014-11-271-5/+18
| | | | | | | | | | | | | | | | | | | | | | | QSP incorrectly transforms non-standard device names to their paths and vice-versa (for example, "/home/ttyS0", "//./COM1", and so on). Now this problem is solved: * The transformation code is moved to QSPP. * Added autotests auto/qserialportinfoprivate to testing of conversion algorithm. These tests are private and can be activated with building of QtSerialPort with: qmake "QT_CONFIG+=private_tests warnings_are_errors" \ DEFINES+=QT_BUILD_INTERNAL Tested on Windows 8, Linux, OSX with auto-tests, with on-board and virtual serial ports. Task-number: QTBUG-38639 Change-Id: I43757a7f1390f53ed2b1d70de59c6bfb71892a59 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Fix QSPI::isNull()Denis Shienkov2014-11-211-11/+11
| | | | | | | | | | | The method QSPI::isNull() should return false when QSPI is empty. Tested on Winsows 8 and Linux with on-board, virtual and USB serial ports using Qt5 and then Qt4. Task-number: QTBUG-41262 Change-Id: Ic9e0afc5549311283aef7ec2ed841f5e418b7edf Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-10-141-3/+3
|\ | | | | | | Change-Id: Id7e66059233e8d07ba44cad19048d9cddc68e250
| * Allow for deviceInstanceIdentifier() to return an upper case stringDenis Shienkov2014-10-061-3/+3
| | | | | | | | | | | | Change-Id: I91977b1aa4a8e5bd8321efc5cfda375c9d7deff7 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Update license headers and add new license filesAntti Kokko2014-09-091-18/+10
|/ | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I08685205169cdd4b49a651ed98f36ba1e6c1bb29 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Pass a length of string to QString::fromWCharArrayDenis Shienkov2014-08-011-6/+17
| | | | | | | | | | | | | | | | | | | | Using of the QString::fromWCharArray() we didn't pass length of a string, hoping that all WCHAR strings are terminated by the null-character. But it can lead to the wrong results if the initial WCHAR string has no null character. Therefore it is reasonable to pass length of a string to exclude an error. Besides, to do not break of the algorithm of string comparison it is necessary to return not null-terminated strings. Also now there is no need to initialize of some allocated arrays by zero values. Tested on Windows 7/8 with the on-board, the virtual com0com, the USB FTDI and the PL2303 serial ports, using Qt4 and then Qt5. Change-Id: I382cf8eacf4ab4d21c54de17fcdd6b9fcfa3d02c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Return from the loop if a port name is foundDenis Shienkov2014-07-101-0/+3
| | | | | | | | | | | | | The function devicePortName() search in the Registry the names of ports by names of registry keys. At first looks for value of a key of "PortName", and then of "PortNumber" key. Thus, the first found value shall stop search and do not try to continue. Tested on Windows 7/8 using Qt4 and then Qt5. Change-Id: I98b00ff043a3b08476fec0a57b0d36ce65fc8d63 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Wrap of getting the port properties on WindowsDenis Shienkov2014-07-091-50/+74
| | | | | | | | | | | | | It is reasonable to wrap implementation of getting properties of port from availablePorts() to the separate functions. It is simplifies a code and improves its understanding. Tested on Windows 7/8 with the on-board, virtual com0com, USB FTDI serial ports using Qt4 and then Qt5. Change-Id: I2345fa49b3633960412715b299e068daa8fdcfd0 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Improve the serial number handling on WindowsDenis Shienkov2014-06-301-13/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The standard USB CDC driver (usbser.sys) does not add information of serial number to the device instance identifier of the child devices (serial ports), so our algorithm returns an empty string. But information about a serial number is stored in the device identifier of the parental node. Thus, it is necessary to get this parent identifier, using these recommendations from MSDN: http://msdn.microsoft.com/en-us/library/windows/hardware/ff549417%28v=vs.85%29.aspx For this purpose is used the set of new functions from the "Configuration Manager Functions" family. Therefore it was necessary: * Rewrite the deviceInstanceIdentifier() function. Now this function accepts one DEVINST parameter and returns the corresponding device instance identifier string. * Add the new parentDeviceInstanceNumber() function. This function accepts a DEVINST of the child device and returns a DEVINST of the parent device. Thus, the new algorithm tries to extract a serial number from the current (child) device and in case it is empty, try to extract from the parent. Tested on Windows 7/8 with the Segger JLink device (provides the CDC serial port) using Qt4 (MSVC2010) and then Qt5 (MSVC2012, MinGW). Also are checked other devices for possible regressions: * on-board serial port * com0com virtual serial port * USB FTDI serial port no regressions found. Change-Id: Ic6afc258f45aa374ec77dc0b586d479b5286359f Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Move the WinCE implementation into separate moduleDenis Shienkov2014-05-201-6/+0
| | | | | | | | | | | | | | | | | WinCE implementation was mixed a common code with the Win32 implementation that caused some problems with maintenance. More correct decision is moving a common code which was used in *win.cpp into *wince.cpp module without modifications. Now the Win32 and the WinCE implementation are independent from each other. Tested build with Qt5 on "win32-msvc2012" and then with Qt4 on "wincewm50pocket-msvc2008" configurations. Change-Id: I63f687468beffa9a75b534a4fbe536b854b12210 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add API for querying the serial numberLaszlo Papp2014-03-021-0/+24
| | | | | | | | | | | Thanks go to Massimo Callegari for the initial patch and the request to remind us again. Thanks also go to Denis and Sergey for working on the windows serial number parser. Task-number: QTBUG-31981 Change-Id: I60d882280f481eb99d275e0a9c81da50292b1c61 Reviewed-by: Massimo Callegari <massimocallegari@yahoo.it> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Use QString for device propertiesDenis Shienkov2014-02-121-43/+22
| | | | | | | | | | | | | | | | | | | The device registry property of the SPDRP_HARDWAREID is not used any more. This property was used earlier for parsing of the VID/PID and had the type of the REG_MULTI_SZ which was interpreted as QStringList, see commit: d8dc10efb1714dcfafa6a08e107fd31fc1e3ce0e The current code is using only string based concept, hence changing the interface to QString. Tested on Windows 8 with on-board and virtual com0com serial ports using the cenumerator example. Change-Id: I31e4f85f1b145021c1b34b81ba890553604a0531 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Rename the "descriptor" to handle on WindowsLaszlo Papp2014-02-101-6/+6
| | | | | | | | | | | | | * Windows uses the term handle instead of descriptor. * It is also consistent with the rest how Qt manages it. Conflicts: src/serialport/qserialport_win.cpp Change-Id: I68a672ea2d8e88e26ad5d822b157ccab79a3d2d9 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add enumeration through the SERIALCOMM registry entryDenis Shienkov2014-02-071-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | When using some software that provide an virtual serial ports functionality is impossible to use the Win32 SetupAPI feature to enumerate these serial ports. For example, such software is "Virtual Serial Ports Emulator" from Eterlogic: http://www.eterlogic.com/Products.VSPE.html The only possible simple way to detect these serial ports it to read the registry key HARDWARE\\DEVICEMAP\\SERIALCOMM: http://msdn.microsoft.com/en-us/library/windows/hardware/ff546502%28v=vs.85%29.aspx In this case it is possible to get only a name of the serial port without any additional information. This method is simply addition to the main SetupAPI functionality. Task-number: QTBUG-36526 Change-Id: Ib505aee66b74b6a8ebe16cf88c3060c8267397a0 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add listing of virtual ports from the "AGG Software"Denis Shienkov2014-02-071-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | The current algorithm takes a name of the serial port from the PortName property which is in the Registry. This value is filled out by the Ports class installer automatically: http://msdn.microsoft.com/en-us/library/windows/hardware/ff546514%28v=vs.85%29.aspx But at using the "AGG Software" software this property is absent. Therefore the algorithm ignores these serial ports. The simplest workaround is use of the PortNumber property which identifies a port number for this software. In this case a port name defines indirectly, by adding a port number to the "COM" suffix. This does not influence other serial ports which are defined through PortName property. Tested on Windows XP and Windows 8 with the cenumerator example. Task-number: QTBUG-32774 Change-Id: I8cda3ed992ff80742511a2952d3fb7e8ac6edc81 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add the additional enumeration through Device Interface Class GUIDDenis Shienkov2013-11-301-15/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current "Setup Class GUID" approach ignores the devices which has been created by the drivers with a custom setup GUID's (e.g. Eltima Virtual Serial Port Driver and so on). In this case need to add each new custom GUID to the list. But it is not a good solution and shall be used as a last resort. The good solution is use of the "Device Interface Class GUID" instead of the "Setup Class GUID" because it is the recommended way: http://msdn.microsoft.com/en-us/library/windows/hardware/ff545036%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/windows/hardware/ff545046%28v=vs.85%29.aspx A new approach uses the standard GUID_DEVINTERFACE_COMPORT and GUID_DEVINTERFACE_MODEM GUID's which shall be used for the development of any serial port drivers. Besides requires adding of the additional DIGCF_DEVICEINTERFACE flag for the SetupDiGetClassDevs() function, see MSDN: http://msdn.microsoft.com/en-us/library/windows/hardware/ff551069%28v=vs.85%29.aspx It should be noted that this approach also can ignore some devices with drivers which don't use the recommendation. Earlier already there were attempts to implement this approach but unsuccessful, see more 3bfe998860e0bfd3ce48784188eaa0d58bf86da1 and bcdeb589dd9d3b0ff7270d380d043b1882eefdc0 commits. Thus, it seems effective to use both "Setup Class GUID" and "Device Interface Class GUID" approaches that will complement each other. In this case can be keep only the standard GUID's. 1. Now all GUID classes are in the QUuid form and stored in the constant list of pairs as QPair<uuid, flags>. It allows to avoid the old heritage related to the pure-C coding style. 2. The second "flags" parameter from the pair is the DWORD input parameter for the SetupDiGetClassDevs() function which specify the control options that filter the device information elements. It allows to pass the appropriate flags for the each used approach independently. Tested with the cenumerator example on Windows with Qt4 and then Qt5, no regressions found. Task-number: QTBUG-33313 Change-Id: I478905e8ae4b79b7d967e0727d2e1620ad667177 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
* Remove the unnecessary and noisy comments for the serial port info filesLaszlo Papp2013-11-241-2/+0
| | | | | | | | | | | | | 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>
* Define QStringLiteral when undefined (e.g. Qt 4)Laszlo Papp2013-11-061-5/+5
| | | | | | | | | | | | This will allow us Qt 5 style coding. QLatin1String replaced everywhere where it works for Qt 4 and 5, namely: the direct literal passing. Note that the "standard" typo has also been fixed in this commit as the line had to change anyway, so it is not much of an additional noise. Change-Id: I8b7e4fe5f337441000bd3d8f58db528fdd0e175b Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Windows: acquire identifiers using the SetupDiGetDeviceInstanceId functionDenis Shienkov2013-08-181-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | This decision uses one identification string of the device instead of the list of hardware identifiers. See more detail in MSDN: * http://msdn.microsoft.com/en-us/library/windows/hardware/ff551106%28v=vs.85%29.aspx * http://msdn.microsoft.com/en-us/library/windows/hardware/ff541327%28v=vs.85%29.aspx The device instance ID unambiguously identifies the device in system and contains necessary values of identifiers, that allows to resolve some issues: * we can abandon a patch: https://codereview.qt-project.org/#change,61633 and Task-number: QTBUG-32684 automatically will be resolved * we can apply a patch: https://codereview.qt-project.org/#change,61752 because instance ID also contains the serial number info Checked on Windows 7 and 8 with USB PL2303 converter, USB Modem ZTE MF180, USB Android Modems, USB Motorola CDC ACM device. Change-Id: If3b67b5b34d65de060a0e7682ba426cd94a01fa7 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Windows: Add PCI vendor and device identifier detectionv5.1.1Denis Shienkov2013-07-251-11/+26
| | | | | | | | | | | | | | | | | | | | | The PCI identifiers are different to the USB identifiers, as in: * USB: VID_, PID_ * PCI: VEN_, DEV_ For more info see MSDN: * USB: http://msdn.microsoft.com/en-us/library/windows/hardware/ff553356%28v=vs.85%29.aspx * PCI: http://msdn.microsoft.com/en-us/library/windows/hardware/ff546262%28v=vs.85%29.aspx Therefore, the method availablePorts() skipped processing of PCI prefixes. Now, problem was resolved. Task-number: QTBUG-32018 Change-Id: I098a35a170043b9c58b74cb278e4daff34b1f84e Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Revert "Refactor the Windows port enumeration from GUID classes to ↵Denis Shienkov2013-04-301-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | devinterfaces" This reverts commit 3bfe998860e0bfd3ce48784188eaa0d58bf86da1. Patch with enumerating of devices through interfaces GUID's enters many regressions, breaks universality and complicates realization. For example, it breaks enumeration of CDC ACM devices. Moreover, some devices (like Nokia phones) has incorrect registration in Windows registry so workaround will greatly complicates code. Decision with use of GUID's interfaces was worse than the previous with use of setup GUID's. Thus, was made the decision to roll away changes on really working decision with Setup Class GUID's. Now tested for devices: * built-in serial port * USB/Serial converter on PL2303 chip * USB/Serial converter on FTDI chip * USB/Bluetooth dongle with standard MS bluetooth stack * USB/CDMA Modem ZTE MF180 * Com0com virtual serial ports * Eltima virtual serial ports * Telit virtual serial ports * CDC ACM serial port on Motorola E398 phone * CDC ACM (and modem) serial port on Nokia E95 phone on Windows XP/7/8. Task-number: QTPLAYGROUND-27 Change-Id: Icc893e9e54e51dbf78da2d132dab6db986d94e03 Reviewed-by: Laszlo Papp <lpapp@kde.org>
* Refactor the Windows port enumeration from GUID classes to devinterfacesDenis Shienkov2013-04-201-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Earlier enumeration of devices was made through GUID classes. But MSDN says that this approach became outdated (since Windows 2000), and instead of classes it is necessary to use GUID interfaces. See: * http://msdn.microsoft.com/en-us/library/windows/hardware/ff545036%28v=vs.85%29.aspx * http://msdn.microsoft.com/en-us/library/windows/hardware/ff545046%28v=vs.85%29.aspx Thus there was a changeover of: * GUID_DEVCLASS_PORTS by GUID_DEVINTERFACE_COMPORT * GUID_CLASS_MODEM by GUID_DEVINTERFACE_MODEM Of course, flags for the SetupDiGetClassDevs() function changed also. This approach decided the following: * Use of newer API for enumeration * There is no need GUID classes for non-standard "purely" the virtual devices (like com0com and so forth) * There is no need to check for name "LPT" existence, because GUID_DEVINTERFACE_COMPORT belong only to serial ports devices (instead of GUID_DEVCLASS_PORTS that include serial and parallel ports). It is checked on devices: * Built-in serial ports * USB/Serial converters (PL, FTDI) * USB Bluetooth serial ports (with standard MS stack) * USB modems (ZTE MF180) * Com0com virtual serial ports * Eltima virtual serial ports * Telit virtual serial ports It is checked on OS: Windows XP/Vista/7/8 Change-Id: I9da51d815ac5081a95113659be2b38ebd31275a4 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
* Add accessor methods for checking the availability of the PID/VIDLaszlo Papp2013-03-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As mentioned in the previous change, this is necessary for those end users who would like to explicitly know if the device on the serial port has a valid vendor or/and product identifier. This is now providing a nice and convenient API for having a dedicated boolean method for making this query possible. It is a lot more readable and convenient to use than other alternatives including the extended scope for the integer query method and so forth. It is more explicit and clear about the intention that one checks if the device has a valid identifier. It would be more vague with error codes and so forth. One somewhat reasonable alternative could be this, albeit this is also more inconvenient: a) bool vendorIdentifier(quint16 &vendorIdentifier) const; b) bool productIdentifier(quint16 &vendorIdentifier) const; ... as this would require an additional variable from the user, and this could not be used with ternary operators so easily, et cetera. There are even worse ideas like how the exceptional conversion happens in QString and so forth, but that also requires an explicit variable or zero if one is sure the conversion should succeed. One can pass zero in there, but that is still inconvenient and more than passing nothing, and zero can become unclear what it supposed to present half or one year later. The change has been tested on Linux with Qt4 and Qt5, and cenumerator works as expected. The documentation has been added accodingly. Task-number: QTPLAYGROUND-21 Change-Id: I905708ce0e67307bf89d69e645462486ad869b0c Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Change the return type of the vendor/productIdentifier() APILaszlo Papp2013-03-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API was established with a bit of insanity, namely: it returns raw strings for the 16-bit vendor and product _numbers_. This brings lots of limitations into the system aside from its silly nature, like how to handle lower and upper case hex letters (a-f, A-F) and so forth. Also, it is not clear whether the API should return zero aligned strings, or whether or not to return the leading indicator of the hex format (0x). This is now all being eliminated by switching to the 16-bit unsigned integer use. There are mostly two use cases for the usage of this: a) Comparison or mapping to find the requested port and device This is getting very simple because it will mean a simple 16-bit unsigned integer comparison which is cross-platform by its nature for sure. b) Display the string to the end user This is for instance with an enumerator or terminal emulator application, but in this special case the user can format the output of the integer as wished. Then, it can easily become a cross-platform display. Even customizing is simple enough to provide the native look'n feel without the library forcing one particular type. The documentation is being changed correspondingly. As for the future, if the need even arises, the following methods could be considered for the info provider class (QSerialPortInfo): bool hasVendorIdentifier() const; bool hasProductIdentifier() const; ... both can be added without any issues (i.e. in a binary compatible way). The examples are updated now as well with presenting the usage of the new API. The GUI emulator example got the string management a bit updated to be in line with the console based emulator (cenumerator). In general, it is also a way more reasonable way of putting a string together with so many placeholders. Also, the argument and list management got a bit nicer formatting style per line break. Testing: the change has been tested on Linux with Qt4 and Qt5. Task-number: QTPLAYGROUND-21 Change-Id: I33683061787af94a797685794be9ebcfa90c499a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Remove the QtSerialPort namespace define and hence namespace usageLaszlo Papp2013-02-071-4/+0
| | | | | | | | | | * This is for following the convention in the Qt Project with the rest. * This fixes examples and tests to build now as all of them are broken due to the regression. Change-Id: I3f4d64d97466520aea621da582a64a0d97e32136 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Fix the potential build breaks introduced by a previous commit (regression)Laszlo Papp2013-02-071-0/+4
| | | | | | | | | | | | | This is due to the fact the Qt namespace is not considered which is normally not a problem as it is empty by default. However, using something like "-qtnamespace MyNamespace" when configuring Qt will break the QtSerialPort build completely. This is intended to be a fix for the library, and the examples/tests will be fixed in a separate commit if necessary. Change-Id: Iecd24dc5135c3a9645910754589dfd8bf4942337 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Refactor certain variable names, remove useless comments and so forthLaszlo Papp2013-02-011-11/+11
| | | | | Change-Id: Id8af629c2b488050b8accd4c552e9b0ebf366e32 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Move the file scope variables to function scopeLaszlo Papp2013-01-311-7/+7
| | | | | | Change-Id: I5f706914af079e81c50bf0eb474737ee82f5cdd1 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Avoid the hardcoding of the vid/pid prefix and sizes right in the middleLaszlo Papp2013-01-301-4/+11
| | | | | | Change-Id: Iab4eb668ce23f5b2ee3cc579ee8072ad990dd2c1 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Windows: Fixed VID/PID detectingDenis Shienkov2013-01-281-2/+6
| | | | | | | | | | | Previously for devices that does not have a VID/PID returns a "garbage" because don't check the return value from the QString::indexOf(). Now instead of "garbage" returned empty string, as described in the methods vendorIdentifier() and productIdentifier(). Change-Id: I60f9aea2debd567ec7559e8565beb09d3184db3e Reviewed-by: Thiago Augusto Correa <thiago.correa@gmail.com> Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Make all the file renames and relevant changesLaszlo Papp2013-01-271-0/+220
"git log --follow /path/to/the/file/in/question" can be used, for instance, for the renamed files to get the whole history. Change-Id: I20da087ca88e2c179a6c3232772fa21575e0aa6a Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>