C
Customizing Runtime Environment
Environment and Input
By default, the basic environment variables and startup options of Boot to Qt applications are set in /etc/default/qt
or /etc/appcontroller.conf
on embedded Linux devices.
You can customize this file if your target device has other input devices in addition to the ones that the Boot to Qt stack is configured for by default.
When you need to configure input devices, see Input in Embedded Linux Devices for more information.
USB input devices, such as keyboards and mice, are automatically recognized. The mouse pointer is shown automatically if a mouse is connected.
However, hotplugging might not work. This means that the input devices, such as a keyboard and mouse, have to be connected at boot time.
Switching to tslib for Resistive Touchscreens
For touchscreens that don't provide modern multitouch capabilities it might be necessary to use the tslib
library instead of relying on direct event device access and the Linux kernel's multitouch protocol. The tslib
library also allows calibration and is more suitable for resistive touchscreens that are often used in an industrial setting.
- To enable
tslib
, add the following lines to/etc/default/qt
on the device:QT_QPA_EGLFS_NO_LIBINPUT=1 QT_QPA_EGLFS_TSLIB=1
Note: The
tslib
plugin provides no multitouch events (QTouchEvent). It only generates mouse events (QMouseEvent). - If necessary, the device can be specified explicitly by setting
TSLIB_TSDEVICE
:TSLIB_TSDEVICE=/dev/input/event1
- The touchscreen calibration can be done with
ts_calibrate
and the calibration file can be used by settingTSLIB_CALIBFILE
:TSLIB_CALIBFILE=/etc/calibration.conf
Booting to a Custom Application
By default, the Boot to Qt Demo Launcher is configured to run on startup.
Follow these steps to have your application launch on boot:
- Go to Projects > Run for the Boot to Qt version you want to customize.
- Under Deployment, select Add Deploy Step > Change default application.
- Re-deploy your project. In Edit mode, select and hold (or right-click) the project and select Deploy, or select (Run).
Your application will now be launched on the next device reboot.
Alternatively, you can also run the following command on the device:
appcontroller --make-default <path>
Where <path>
is the install path of your application binary on the device.
To remove your application from the default startup, run the following command on the device:
appcontroller --remove-default
Configuring the physical screen size for scalable user interfaces
The Boot to Qt Demo Launcher and Qt Quick Controls scale automatically to screens of different sizes, from 7" touchscreens to 60" or larger TVs to ensure readability and touch friendliness. For this, Qt has to know the physical dimensions of the screen. By default it tries to query these values from the framebuffer devices. Many kernel drivers do not provide this information, however.
To override and manually set a desired screen size, go the Launcher Settings view and change the values in the Physical screen size in millimeters boxes. Then tap the reboot button or restart your application. The controls will adjust their sizes based on the new settings.
Switching Between Portrait and Landscape Views
Depending on device screen dimensions and application requirements, it might be desirable to change the default view orientation. The following example shows how to rotate your application in QML:
import QtQuick 2.2 Item { id: root width: 800 height: 1280 // Container element for rotating Rectangle { id: main // Swap the width and height of the root item width: root.height height: root.width anchors.centerIn: parent // Rotate 90 degrees clockwise around transformOrigin rotation: 90 // The rotated content Text { text: qsTr("Hello World") anchors.centerIn: parent } MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } } }
Resizing the SD Card Root Partition
By default, the Boot to Qt image has some extra free space reserved for development purposes, but not all of the extra capacity that the SD card might have is available. The Boot to Qt image includes tools for extending the root partition in the SD card to its full size.
Warning: The tools modify the partition layout which can cause data loss. Don't carry out the following steps if you're unsure or your SD card contains important files.
To resize the partition:
- Resize the partition table for the root partition, which is usually the second partition:
parted -s /dev/mmcblk0 resizepart 2 100%
- Resize the file system on the second partition:
resize2fs /dev/mmcblk0p2
where /dev/mmcblk0
refers to the device node of the SD card, and /dev/mmcblk0p2
to the second partition on that SD card.
Setting Up USB Ethernet on Target Device
USB access to an embedded target device supports two different USB protocols. Use the default protocol RNDIS (Remote Network Driver Interface Specification) when connecting the target device to either a Linux or Windows host. When you want to connect the target device to a macOS host, you need to change the protocol to CDC-ECM (Communications Device Class - Ethernet Control Model). CDC-ECM also works with Linux.
After installing Boot to Qt to your target device, change the protocol as follows:
- Open the following file on the target device:
/etc/default/qdbd
- Find
USB_ETHERNET_PROTOCOL
in the file and set it as follows:- For Windows and Linux:
USB_ETHERNET_PROTOCOL=rndis
- For macOS and Linux:
USB_ETHERNET_PROTOCOL=cdcecm
- For Windows and Linux:
- Connect the target to host with a USB cable. After editing the above file restart the target device.
In case of problems, see Troubleshooting.
Available under certain Qt licenses.
Find out more.