summaryrefslogtreecommitdiffstats
path: root/libqdb
Commit message (Collapse)AuthorAgeFilesLines
* CMake: adapt to new CMake APISamuli Piippo2021-06-161-3/+3
| | | | | | | Update dependencies and adapt to the new Qt CMake API. Change-Id: Ib8b52f00da8f2be5f0f8706f091487a109e34848 Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
* Build QDB with CMakeLassi Lehikoinen2021-05-283-33/+33
| | | | | | | | Also some Qt6 related changes. Task-number: QTBUG-86118 Change-Id: Id5bdf646071fcc10415945dfae73b2c66e53f7a7 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Use qMinSamuli Piippo2020-09-111-1/+1
| | | | | | | QByteArray::size() is now qsizetype in Qt6 Change-Id: Ib73c9e08c072ed5de99cb9e43cf14b972350a347 Reviewed-by: Kari Oikarinen <kari.oikarinen@kapsi.fi>
* Add include for QIODeviceSamuli Piippo2020-09-072-0/+2
| | | | | | Change-Id: I0bd1e7de0cf56fc1c6a2594bcb963ead1c03ba4c Reviewed-by: Mikko Gronoff <mikko.gronoff@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Handle both SIGINT and SIGTERM on unixKari Oikarinen2018-09-113-9/+13
| | | | | | | | | Handling SIGTERM allows graceful shutdown when stopped by init script. Task-number: QTBUG-63029 Change-Id: Iac96666895a2a9bf256c6eb7abb528f65a198133 Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Split InterruptSignalHandler implementations by platform to different filesKari Oikarinen2018-09-114-77/+116
| | | | | | | | | Too hard to read if it's all in a single file. Change-Id: I971e83350c04a9f8c75566d18a0f1ec8d6a0fcd0 Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Relicense to Commercial + GPLv3v1.0.0Kari Oikarinen2017-05-0218-143/+287
| | | | | | Task-number: QTBUG-60434 Change-Id: I73740ae66ab565f32df25fa2c98d5cb6c019d666 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Reuse network configurations set on device if possibleKari Oikarinen2017-05-021-0/+32
| | | | | | | | | | | | | | | | | | | | Don't allow reconfiguring the network on the device without a reset in between. It wouldn't lead to a working configuration, since the host has already gotten an IP from the existing configuration at this point. But if the already configured network happens to be free, use it. This allows devices to work keeping the same address even if host qdb is restarted. This doesn't guard against the possibility that the existing configuration conflicts with a network already in place. But telling apart that situation would be too difficult: How to tell whether the network is the device or something else? In that case the user just has to replug the device. Then it will pick an unused subnet. Task-number: QTBUG-59451 Change-Id: I10c948713736dd79442265ac6a590b8a7cf8345a Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Configure DHCP server on device before handshakeKari Oikarinen2017-05-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Change the procedure for a newly detected device: First configure the network and then do the handshake for the device information. The configuring the network part is new and incorporates a new service NetworkConfigurationService. On the device it relies on a script b2qt-gadget-network.sh (or as specified in a command line parameter) which does the actual configuring of the USB network interface. The network configuration to apply is selected from a list of hardcoded candidates from the private use IPv4 ranges available. They are checked against the existing networks on the host and an unused one is picked. On the device the USB interface is configured to use this network and to act as a DHCP server for it. Host will then pick up an IP from this DHCP server automatically. Previous configuration of the host network is thus not necessary and is removed. Task-number: QTBUG-58614 Change-Id: I6a4ed34ef7d5cba9e55e6fa4f07725bb3c00d795 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Fix installation on WindowsKari Oikarinen2017-03-101-4/+2
| | | | | | | | | | | | | | | | | | | | | | | Install targets were gated on unix, so nothing intended was actually installed on Windows. One would be excused to think that there's no need to install a static library that has already been linked with the executable. However, the tests streamtest and servicetest link against the library as well. In Coin they are built in a separate machine and only have the source and the installed components available. Thus not installing the static library means that those tests will fail to find the library. Via qt_parts.prf we included qt_example_installs.prf which created an nmake target that attempted to install the qmake files used in the project. The destination path for installing them was malformed, since it was created by concatenating two absolute Windows paths. Because the path contained ':', it led to an error message "The filename, directory name, or volume label syntax is incorrect.". Change-Id: Idab40e3647de863a7b8ab47ff9b42b8990ed52ae Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Make libqdb a static libraryKari Oikarinen2017-03-103-36/+1
| | | | | | | | | | | | Previously it was a shared library, but the symbols were not exported properly, which meant that trying to use them lead to linker failures when using MSVC. This was previously worked around by including the files a second time, so remove those workarounds. Change-Id: Ieafd066c5a3924573cd5e6e397a0e544a35564b3 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Don't use #include relative from current directoryKari Oikarinen2016-12-221-1/+1
| | | | | | | | Mingw doesn't seem to follow that, so use an #include relative from an explicitly added include path. Change-Id: I0a3cfd20bbb8167756c0c4bff0699fe4affd18b1 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Handle host-device version mismatches forward-compatiblyKari Oikarinen2016-12-223-1/+18
| | | | | | | | | There is no support for multiple versions, but the behavior changes in this commit should allow adding that in the future. Device responds with a new Refuse message, if it does not support the requested version. Change-Id: I8a747654edb1c6efab485808b2692cd9689bd100 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Categorize loggingKari Oikarinen2016-11-232-4/+3
| | | | | | | | Also use qFormatLogMessage so that QT_MESSAGE_PATTERN is taken into account in host server's own log message handler. Change-Id: I2ae6f70021cbe1ce4cd31ed599bbcc5035081b12 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Remove dead files about file transfers and process runningKari Oikarinen2016-11-214-186/+0
| | | | | | | | These should have already been removed in 6e15f80aed27e87e9727568ee8d968641a9ed913, but were overlooked. Change-Id: Ide27b86fe08d8755879f60594ffc482bb3b1e28d Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Handle plugged and unplugged USB devicesKari Oikarinen2016-11-0710-658/+1
| | | | | | | | | | | | | | | | | | Looking for inserted and removed devices is done by polling once a second. libusb hotplug events are not used since they are not supported on Windows and not available in the libusb version in RHEL 7.2. If the IP address is not available for the device on the first check, the device will be checked again after a short delay until the information is complete. In the meanwhile the incomplete information is exposed to the client when asked. Parts that use libusb were moved from libqdb to the host part, since they are only used on the host. Task-number: QTBUG-56067 Change-Id: I0cfbd3659001982609a7d4a77cb1266a7dc6ce8c Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Split host QDB into client and server partsKari Oikarinen2016-11-0711-16/+127
| | | | | | | | | | | | | | | | | | The two parts live in the same qdb binary. They communicate over QLocalSocket. Other users of host QDB functionality (like QtC QDB plugin) are intended to communicate over the local socket also. For now the server only lists the devices when asked for by the client. It can also handle only one client and one request at the same time. Only listing the devices, getting information from them and configuring the host network are necessary according to the current plans for QDB. Hence file transfer and running processes on the device were not converted to new architecture and are removed. Task-number: QTBUG-56067 Change-Id: I1a49d346c755ef00e332c4fcbed2352486728e6a Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Don't use libusb_set_auto_detach_kernel_driver()Kari Oikarinen2016-10-182-1/+9
| | | | | | | | | It is not available in the older libusbx that RHEL ships. Manually implement same logic. Task-number: QTBUG-56066 Change-Id: I3b6f2f8870266fd907780ec45ed0e6cbf5d3aa07 Reviewed-by: Kimmo Ollila <kimmo.ollila@theqtcompany.com>
* Handle multiple USB devicesKari Oikarinen2016-10-189-90/+340
| | | | | | | | | | | | | | | | | | Add a new qdb subcommand "devices". It lists the USB devices that are available and have a QDB interface. Their serial numbers are retrieved from the USB interface description. All the other commands now use --device option to decide which device to connect to. libusb_context is managed in a separate singleton, because managing its lifetime between the DeviceManager and UsbConnection would be awkward otherwise. The library-wide initialization is anyway meant to happen just once and the deinitialization just before quitting the executable. Task-number: QTBUG-54405 Change-Id: I8dd4f759e2e0906e0b9d121eb9f1221ee4de55ca Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Rename test/ folder to tests/ to comply with CIKari Oikarinen2016-09-231-1/+1
| | | | | | | | | Also change the install targets to be under QT_INSTALL_BINS and QT_INSTALL_LIBS. Task-number: QTBUG-56066 Change-Id: Icaf309ebb6e62bbf35df09fd6a72795f64f6f041 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Move operator implementations inside namespaceKari Oikarinen2016-09-231-10/+14
| | | | | | | | | | | | | | In commit 7be7316aeec7eb3e63dde518ae021988c6ad93b6 "Make forward declarations namespace aware" the forward declarations were wrapped with QT_{BEGIN,END}_NAMESPACE. Several of them were forgotten and are wrapped in this commit. The unit tests for QdbMessage still failed with the linker not finding the operator<<(QDataStream &, QdbMessage &). This commit fixes it. Task-number: QTBUG-56066 Change-Id: I1ce9774a6f05f3907e334def40b365fdde32c2bb Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Use pkg-config for libusb-1.0 in UnixKari Oikarinen2016-09-231-6/+8
| | | | | | | | Rather than hard-coded include path, use pkg-config. Also use it in a config.test in order to give a clear error message early. Change-Id: I18da309131e0cc428433efe114c2004c06a15fd0 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Make forward declarations namespace awareKari Oikarinen2016-09-204-5/+16
| | | | | | | | | | | When Qt is built to be located in a namespace, forward declarations of Qt don't work unless they are wrapped inside QT_BEGIN_NAMESPACE and QT_END_NAMESPACE. Overloading the >> operators also need to be wrapped. Change-Id: Ie4e569a1d4f0844c50cc84ecc876160563926ddb Reviewed-by: Kimmo Ollila <kimmo.ollila@theqtcompany.com>
* Add HandshakeService for fetching device informationKari Oikarinen2016-08-291-0/+1
| | | | | | | | | | | | | | | Device serial number and the host-side MAC address the USB NIC presents are fetched from /sys. The paths are hardcoded to the ones that the current script uses. qdb subcommand network now fetches the device information and configures the USB NIC. The serial number is used to name the connection. The previous functionality is still available by giving a MAC address to the network subcommand. Task-number: QTBUG-55433 Change-Id: I812273fd378f093febd917b56bfaa850a3f6f621 Reviewed-by: Kimmo Ollila <kimmo.ollila@theqtcompany.com>
* Introduce version number to the protocolKari Oikarinen2016-08-231-0/+1
| | | | | | | | | | | | | Version number is sent as uint32 in the payload of the initial Connect message. For now Server always responds to the Connect message with the only protocol version that it knows, but also prints a warning if the asked for protocol version was not the same. Connection checks the version in the response and transitions to Connected state only if the version matches. Change-Id: I937af5a7e1f6bb5056efc03777178bed86b451d4 Reviewed-by: Kimmo Ollila <kimmo.ollila@theqtcompany.com>
* Windows host supportKimmo Ollila2016-08-226-31/+85
| | | | | Change-Id: I8d0cd0f0b4790824df4149fb3c40c4ab962b97a0 Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
* Import QDB prototypeKari Oikarinen2016-07-1423-0/+1652
The prototype is capable of: - Running a process on the device - Pushing a file to the device - Pulling a file from the device The device is connected to through USB. There is not yet management of multiple connected devices. Change-Id: Icba20e1d68dafbab9d71f44b86c20efb1df45310 Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>