2019. március 9., szombat

Configuring a USB DisplayLink monitor on Ubuntu 18.04

This blog post is about my experiences of configuring a USB DisplayLink monitor (Mobile Pixels Duex) under Ubuntu Linux 18.04 with KDE

Installation
--------------
Download and execute the installer from:


The installation was very smooth under Ubuntu 18.04. Since the DisplayLink installer compiles a kernel module, be sure that the kernel headers, dkms, make and g++ packages are installed on your system.

Screen setup
------------------
After connecting Duex, it was switched on, but the display was not configured. The display preferences dialog under KDE System Settings was unable to handle the Duex and the laptop screen changed to full resolution by some reason when Duex was connected. xrandr can configure Duex correctly, two commands can do the trick on command line:

- Optional step to reset back the laptop screen resolution if you use other resolution than the native. Example command:
 xrandr --output eDP1 --mode 1600x900 --primary  
- Set Duex to extended display on the right side of the main screen (check "xrandr --help" for other configurations):
 xrandr --output DVI-I-1-1 --right-of eDP1 --mode 1920x1080 --noprimary  

Disconnecting and reconnecting the Duex any time after this point will be just fine, no other xrandr tweaking is needed, but these xrandr changes are not permanent after every reboot they must be repeated once Duex is connected first time. eDP1 and DVI-I-1-1 might be different on your system. You can check the right IDs with a simple "xrandr" command in command line, it will list all available display connection IDs.

Brightness control
------------------
Duex is very bright by default and it is not possible to change the brightness under Linux because of the lack of support in the DisplayLink driver. Because the brightness value is permanent after it is changed on the device, my workaround was to install the DisplayLink driver in a Windows 10 virtual machine, adjust the brightness to your preference with the ScreenBright application and remove Duex from the virtual machine. Since the brightness change is permanent, the setting remains after disconnecting and reconnecting Duex. It is a dirty workaround, but at least you are not locked to a certain brightness level permanently. The same method works just fine without virtual machines by connecting Duex to a real Windows PC or laptop temporary.

Brightness control (in software)
---------------------------------------
Without changing the backlight of Duex with hardware controls, xorg can apply brightness/gamma values in software to correct the screen. This method does not change the backlight level of the Duex, but it would provide a way to finetune the brightness level. This is not available yet, but at least doable. Modesetting driver used by Displaylink added support for software gamma support in Jan 2018, but this change has not landed in Ubuntu yet:


Software gamma support must be also implemented in the open source parts of the DisplayLink driver. The efforts can be tracked via:


Further tweaking
----------------------
If your laptop has an integrated Watcom touchscreen in your screen, the touch will point the mouse pointer to wrong coordinates if Duex is connected because overall display dimensions changed with the extended screen. You have to map your Wacom device back to the laptop screen once Duex is connected or disconnected with xsetwacom:

 xsetwacom set "Wacom Pen and multitouch sensor Finger touch" MapToOutput eDP1  

The correct wacom device ID can be checked with "xinput" on command line and the correct display ID (eDP1) with "xrandr". These steps can be automated when Duex is connected/disconnected with srandrd (https://github.com/jceb/srandrd). The following script run with srandrd works (correct the display/touchscreen IDs if needed):

 #!/bin/bash  
 case "${SRANDRD_OUTPUT} ${SRANDRD_EVENT}" in  
  "DVI-I-1-1 connected") sleep 5 && xsetwacom set "Wacom Pen and multitouch sensor Finger touch" MapToOutput eDP1 ;;  
  "DVI-I-1-1 disconnected") sleep 5 && xsetwacom set "Wacom Pen and multitouch sensor Finger touch" MapToOutput eDP1 ;;   
 esac  


Nincsenek megjegyzések: