Monitor identifier mismatch after redocking (Thinkpad T470s)
I have a laptop + two monitor setup connected through a Lenovo USB-C docking hub that usually works very well upon bootup. However, after undocking and redocking the laptop, some problems usually arise, this particular one seems to involve identifier mismatches making xrandr unable to configure the displays later on.
It's somewhat hard exactly to pin down the cause of the issue as sometimes it works as it should, sometimes I need to explicitly set crtcs for the two external monitors, sometimes quitting X and relogging works. However, even after relogging the identifiers sometimes seems to not match up with the actual monitor identifiers (particularly if having a different external screen connected in the meantime), making xrandr unable to configure the monitors even though they do work. Example (eDP1 is the laptop screen):
λ xrandr --listmonitors
Monitors: 3
0: +*eDP1 1920/310x1080/170+0+0 eDP1
1: +DP1-1 1920/530x1080/300+1920+0 unknown output 0x47
2: +DP1-2 1920/530x1080/300+3840+0 unknown output 0x4a
However, running xrandr --verbose gives the following for e.g. DP1-1:
DP1-1 connected 1920x1080+1920+0 (0x52) normal (normal left inverted right x axis y axis) 530mm x 300mm
Identifier: 0x45
Timestamp: 192753259
Subpixel: unknown
Gamma: 1.0:1.0:1.0
Brightness: 1.0
Clones: DP1-1 DP1-2 DP1-3
CRTC: 1
CRTCs: 0 1 2
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
link-status: Good
supported: Good, Bad
non-desktop: 0
range: (0, 1)
Same for DP1-2:
DP1-2 connected 1920x1080+3840+0 (0x52) normal (normal left inverted right x axis y axis) 530mm x 300mm
Identifier: 0x48
Timestamp: 192753259
Subpixel: unknown
Gamma: 1.0:1.0:1.0
Brightness: 1.0
Clones: DP1-1 DP1-2 DP1-3
CRTC: 2
CRTCs: 0 1 2
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
link-status: Good
supported: Good, Bad
non-desktop: 0
range: (0, 1)
So if I want to relayout my screens, for example like this, it doesn't work:
λ xrandr --output eDP1 --below DP1-1
xrandr: cannot find output 0x47
In this particular case I had undocked the laptop, had it connected to a different external screen, unplugged the screen and redocked.
Note that the displays do work and I'm able to use them, I'm just unable to configure them. Sometimes they refuse to work at all unless I reboot, but that's a different issue. This is running on Ubuntu 18.10 with a stock kernel using dwm.
λ uname -a
Linux xyz 4.18.0-16-generic #17-Ubuntu SMP Fri Feb 8 00:06:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux