summaryrefslogtreecommitdiffstats
path: root/qdbd
Commit message (Collapse)AuthorAgeFilesLines
* Build QDB with CMakeLassi Lehikoinen2021-05-282-50/+23
| | | | | | | | Also some Qt6 related changes. Task-number: QTBUG-86118 Change-Id: Id5bdf646071fcc10415945dfae73b2c66e53f7a7 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* RNDIS to more generic due to CDCECMRami Potinkara2020-04-014-19/+19
| | | | | | | | | | | USB Ethernet CDC-ECM gadget configuration added. Qt Creator can be connected via USB Ethernet to Mac OS with CDCECM, to Linux with RNDIS or CDCECM and to Windows 10 with RNDIS. Task-number: QTBUG-82530 Change-Id: Icdca6e50f0b94c99900c4789059a96d77807c9d6 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io> Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
* Disable USB gadget when shutting downKari Oikarinen2018-09-111-5/+22
| | | | | | | | | This was previously done by the init script. Move it inside qdbd like the initialization was moved previously. Task-number: QTBUG-63029 Change-Id: I869138acd579f9f3f1f3af1ebf5583e7882296fa Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Add gadget initialization to the qdbd daemonSami Nurmenniemi2018-09-104-0/+52
| | | | | | | | | | | | | | It's not possible to deterministically control timings of gadget initialization from an external script. Moved gadget initialization logic from /usr/bin/qdbd-init.sh to the qdbd USB gadget initialization. This was causing problems when qdbd daemon launch was delayed because of kernel random pool initialization. Done-with: Kari Oikarinen <kari.oikarinen@qt.io> Task-number: QTBUG-63029 Change-Id: Ia403fbe6ebdbc83908bafb023a88fff058efc840 Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Add missing overrideKari Oikarinen2018-09-101-1/+1
| | | | | | Change-Id: Ib52bd2323d060d21056bb58b82c74aeb911a042a Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Log network script outputRainer Keller2018-02-081-3/+19
| | | | | | | | | All calls to network setup scripts and their output are logged for debugging. Change-Id: Iceb323134e91abe478d7f49b755347c37931f67d Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io> Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Fix logging raw messages by defaultKari Oikarinen2017-05-301-2/+2
| | | | | | | | | | | The filter rule handling was not updated when the logging categories were renamed to include qdb. This caused the raw messages to be logged always. Amends 2750685b372b78330a9139a98d084bb7a60e367e. Change-Id: I43d37ea9f81f15efce4eefc4b04c74006ee72348 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Relicense to Commercial + GPLv3v1.0.0Kari Oikarinen2017-05-0225-194/+394
| | | | | | 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-026-32/+162
| | | | | | | | | | | | | | | | | | | | 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>
* Reset network configuration when cable is unpluggedKari Oikarinen2017-05-025-0/+174
| | | | | | | | | | | | | | Read USB function filesystem events from the control endpoint and react to events related to disconnecting by calling the network configuration script to reset. This means that when the cable is plugged in, network is always in a reset state and a stale IP according to the previous configuration won't be returned. Task-number: QTBUG-59450 Change-Id: I4ae77c6a9283941802d7b04b3588dbbb81b7c266 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Configure DHCP server on device before handshakeKari Oikarinen2017-05-027-9/+154
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Make libqdb a static libraryKari Oikarinen2017-03-101-1/+0
| | | | | | | | | | | | 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>
* Use libusb from env variable LIBUSB_PATH on WindowsKari Oikarinen2017-03-101-1/+1
| | | | | | | | | Some places were setting directly the contents of LIBS, which overwrote the libusb configuration, so instead append in those places. (And all the other places for consistency.) Change-Id: I8177a863a8b866f3e19fb5207e73082ea86352c5 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Handle host-device version mismatches forward-compatiblyKari Oikarinen2016-12-222-29/+67
| | | | | | | | | 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>
* Add --version optionKari Oikarinen2016-11-242-0/+4
| | | | | | | | | | | | | | | Derive the version information with git-describe. It will use tags (once they exist) as a reference, but always includes (an abbreviated version) of the SHA1 so that finding the exact version is easy. Also show the used Qt version. A caveat is that since qmake is used, version is only updated after qmake is run and mains are compiled. This should not be a problem for real releases, since they will be built clean. Change-Id: I59e32f99c30a957d624eff0cf04a927328a08212 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Categorize loggingKari Oikarinen2016-11-237-38/+53
| | | | | | | | 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>
* Allow configuring previously hardcoded paths in qdbdKari Oikarinen2016-11-216-12/+135
| | | | | | | | | | | | Instead of hardcoding, allow giving as command line options: - Directory to the USB Function File System endpoints to use - Location of the configfs gadget configuration - Name of the Function File System function that provides RNDIS Task-number: QTBUG-56987 Change-Id: Idebd4888effc6adee7568ef4911141a9bcb40dc4 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Split host QDB into client and server partsKari Oikarinen2016-11-0717-558/+19
| | | | | | | | | | | | | | | | | | 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>
* Fetch device IP address on the USB NICKari Oikarinen2016-10-182-3/+27
| | | | | | | | | | | | | | | | Device IP address is needed by the host for connecting the device with SSH. The interface name for the USB gadget network is fetched from configfs using a hard-coded path that the current development script uses. The IPv4 address on that interface is then determined. When there is no IPv4 address (yet) on the interface, an empty string is returned. Task-number: QTBUG-55435 Change-Id: Ia16daa89d1b28a7f13ec2d8e8fe2131ff5a48c2b 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-235-2/+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>
* Make forward declarations namespace awareKari Oikarinen2016-09-202-2/+6
| | | | | | | | | | | 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-294-0/+106
| | | | | | | | | | | | | | | 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-232-3/+27
| | | | | | | | | | | | | 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>
* Import QDB prototypeKari Oikarinen2016-07-1422-0/+1668
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>