libthinkpad / dockd

Lenovo ThinkPad Dock Management Daemon. Docs:
http://thinkpads.org/projects/dockd/
Other
131 stars 22 forks source link

Dockd does not automatically switch config while docking/undocking #2

Closed rkubosz closed 6 years ago

rkubosz commented 6 years ago

Hi! I use dockd with Arch Linux and xorg/i3 on Thinkpad T420 with dock 4337. I installed dockd from AUR. Dockd created two configuration files. Systemd unit acpid.service and dockd daemon are running; I detected it with ps -ux | grep dockd. It works pretty nice when I switch modes manually with dockd --set, but daemon does not switch modes automatically.

smclt30p commented 6 years ago

Could you please provide the system journal when docking/undocking?

journalctl -f | grep dockd

rkubosz commented 6 years ago

Tried journalctl -f | grep dockd - there is no output, prompt does not return (I will try run it while docking/undocking, I will provide more info soon). I did journalctl | grep dockd:

Jan 08 15:47:30 rkt420 sudo[3264]: robert : TTY=pts/1 ; PWD=/etc/X11/xorg.conf.d ; USER=root ; COMMAND=/usr/bin/dockd Jan 08 15:47:33 rkt420 sudo[3307]: robert : TTY=pts/1 ; PWD=/etc/X11/xorg.conf.d ; USER=root ; COMMAND=/usr/bin/dockd help Jan 08 15:47:38 rkt420 sudo[3336]: robert : TTY=pts/1 ; PWD=/etc/X11/xorg.conf.d ; USER=root ; COMMAND=/usr/bin/dockd --help Jan 08 15:47:55 rkt420 sudo[3443]: robert : TTY=pts/1 ; PWD=/etc/X11/xorg.conf.d ; USER=root ; COMMAND=/usr/bin/dockd --set docked Jan 08 15:47:56 rkt420 dockd[3444]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 15:47:56 rkt420 dockd[3444]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 15:47:56 rkt420 dockd[3444]: Setting screen size: height: 1080, width: 3520 Jan 08 15:49:47 rkt420 sudo[4268]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --help Jan 08 15:49:56 rkt420 sudo[4349]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --config undocked Jan 08 15:51:35 rkt420 sudo[4923]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --help Jan 08 15:51:39 rkt420 sudo[4973]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --daemon Jan 08 15:51:55 rkt420 sudo[5044]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --set docked Jan 08 15:51:56 rkt420 dockd[5045]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 15:51:56 rkt420 dockd[5045]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 15:51:56 rkt420 dockd[5045]: Setting screen size: height: 1080, width: 3520 Jan 08 16:14:26 rkt420 dockd[1476]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 16:14:26 rkt420 dockd[1476]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 16:14:26 rkt420 dockd[1476]: Setting screen size: height: 1080, width: 3520 Jan 08 16:14:41 rkt420 dockd[1538]: Applying config to 63: mode: 74, outputs: 1, x: 0, y: 0 Jan 08 16:14:41 rkt420 dockd[1538]: Applying config to 64: mode: 0, outputs: 0, x: 0, y: 0 Jan 08 16:14:41 rkt420 dockd[1538]: Setting screen size: height: 900, width: 1600 Jan 08 16:14:46 rkt420 dockd[1538]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 16:14:46 rkt420 dockd[1538]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 16:14:46 rkt420 dockd[1538]: Setting screen size: height: 1080, width: 3520 Jan 08 16:16:55 rkt420 dockd[2153]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 16:16:55 rkt420 dockd[2153]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 16:16:55 rkt420 dockd[2153]: Setting screen size: height: 1080, width: 3520 Jan 08 16:27:52 rkt420 sudo[1692]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --set undocked Jan 08 16:27:53 rkt420 dockd[1702]: Applying config to 63: mode: 74, outputs: 1, x: 0, y: 0 Jan 08 16:27:53 rkt420 dockd[1702]: Applying config to 64: mode: 0, outputs: 0, x: 0, y: 0 Jan 08 16:27:53 rkt420 dockd[1702]: Setting screen size: height: 900, width: 1600 Jan 08 16:28:03 rkt420 sudo[1753]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --write undocked Jan 08 16:28:10 rkt420 sudo[1809]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --config undocked Jan 08 16:29:10 rkt420 sudo[2263]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --config docked Jan 08 16:29:19 rkt420 sudo[2345]: robert : TTY=pts/0 ; PWD=/etc/dockd ; USER=root ; COMMAND=sudoedit docked.conf Jan 08 16:29:41 rkt420 sudo[2468]: robert : TTY=pts/2 ; PWD=/etc/dockd ; USER=root ; COMMAND=sudoedit undocked.conf Jan 08 16:31:28 rkt420 sudo[3252]: robert : TTY=pts/1 ; PWD=/home/robert ; USER=root ; COMMAND=sudoedit /etc/dockd/undocked.conf Jan 08 16:31:52 rkt420 dockd[3409]: Not enough CRT controllers to set config, aborting Jan 08 16:32:00 rkt420 dockd[3464]: Trying to find (HDMI-3) again: (Resource temporarily unavailable) Jan 08 16:32:01 rkt420 dockd[3464]: Trying to find (HDMI-3) again: (Resource temporarily unavailable) Jan 08 16:32:01 rkt420 dockd[3464]: Trying to find (HDMI-3) again: (Resource temporarily unavailable) Jan 08 16:32:02 rkt420 dockd[3464]: Trying to find (HDMI-3) again: (Resource temporarily unavailable) Jan 08 16:32:02 rkt420 dockd[3464]: Trying to find (HDMI-3) again: (Resource temporarily unavailable) Jan 08 16:32:03 rkt420 dockd[3464]: Trying to find (HDMI-3) again: (Resource temporarily unavailable) Jan 08 16:32:03 rkt420 dockd[3464]: Trying to find (HDMI-3) again: (Resource temporarily unavailable) Jan 08 16:32:03 rkt420 dockd[3464]: Trying to find (HDMI-3) again: (Resource temporarily unavailable) Jan 08 16:32:06 rkt420 dockd[3500]: Not enough CRT controllers to set config, aborting Jan 08 16:33:50 rkt420 sudo[4022]: robert : TTY=pts/2 ; PWD=/etc/dockd ; USER=root ; COMMAND=/usr/bin/dockd --config undocked Jan 08 16:33:59 rkt420 sudo[4078]: robert : TTY=pts/2 ; PWD=/etc/dockd ; USER=root ; COMMAND=sudoedit undocked.conf Jan 08 16:34:33 rkt420 dockd[4343]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 16:34:33 rkt420 dockd[4343]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 16:34:33 rkt420 dockd[4343]: Setting screen size: height: 1080, width: 3520 Jan 08 16:34:46 rkt420 dockd[4434]: Applying config to 63: mode: 74, outputs: 1, x: 0, y: 0 Jan 08 16:34:46 rkt420 dockd[4434]: Applying config to 64: mode: 0, outputs: 0, x: 0, y: 0 Jan 08 16:34:46 rkt420 dockd[4434]: Setting screen size: height: 900, width: 1600 Jan 08 16:34:52 rkt420 dockd[4463]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 16:34:53 rkt420 dockd[4463]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 16:34:53 rkt420 dockd[4463]: Setting screen size: height: 1080, width: 3520 Jan 08 16:43:47 rkt420 sudo[4858]: robert : TTY=pts/0 ; PWD=/etc/dockd ; USER=root ; COMMAND=/usr/bin/pacman -S -y -u Jan 08 16:52:55 rkt420 sudo[7229]: robert : TTY=pts/2 ; PWD=/etc/dockd ; USER=root ; COMMAND=/usr/bin/lsusb Jan 08 17:01:25 rkt420 dbus-daemon[418]: [system] Activating via systemd: service name='net.reactivated.Fprint' unit='fprintd.service' requested by ':1.447' (uid=0 pid=9724 comm="sudo -e /etc/dockd/undocked.conf ") Jan 08 17:01:31 rkt420 sudo[9724]: robert : TTY=pts/1 ; PWD=/home/robert ; USER=root ; COMMAND=sudoedit /etc/dockd/undocked.conf Jan 08 17:01:38 rkt420 sudo[9793]: robert : TTY=pts/1 ; PWD=/home/robert ; USER=root ; COMMAND=sudoedit /etc/dockd/undocked.conf Jan 08 17:02:30 rkt420 dbus-daemon[418]: [system] Activating via systemd: service name='net.reactivated.Fprint' unit='fprintd.service' requested by ':1.498' (uid=0 pid=10288 comm="sudo -e /etc/dockd/undocked.conf ") Jan 08 17:02:32 rkt420 sudo[10288]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=sudoedit /etc/dockd/undocked.conf Jan 08 17:09:36 rkt420 dbus-daemon[425]: [system] Activating via systemd: service name='net.reactivated.Fprint' unit='fprintd.service' requested by ':1.65' (uid=0 pid=2010 comm="sudo -e /etc/dockd/undocked.conf ") Jan 08 17:10:04 rkt420 sudo[2092]: robert : TTY=pts/1 ; PWD=/home/robert ; USER=root ; COMMAND=sudoedit /etc/dockd/undocked.conf Jan 08 18:54:14 rkt420 sudo[23112]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=sudoedit /etc/dockd/undocked.conf Jan 08 18:54:51 rkt420 dockd[23490]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 18:54:51 rkt420 dockd[23490]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 18:54:51 rkt420 dockd[23490]: Setting screen size: height: 1080, width: 3520 Jan 08 19:30:41 rkt420 dockd[2244]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 19:30:41 rkt420 dockd[2244]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 19:30:41 rkt420 dockd[2244]: Setting screen size: height: 1080, width: 3520 Jan 08 20:58:22 rkt420 dockd[16739]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 20:58:22 rkt420 dockd[16739]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 20:58:22 rkt420 dockd[16739]: Setting screen size: height: 1080, width: 3520 Jan 08 22:52:06 rkt420 dockd[872]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 22:52:06 rkt420 dockd[872]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 22:52:06 rkt420 dockd[872]: Setting screen size: height: 1080, width: 3520 Jan 08 22:54:28 rkt420 dockd[1793]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 22:54:28 rkt420 dockd[1793]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 22:54:28 rkt420 dockd[1793]: Setting screen size: height: 1080, width: 3520 Jan 08 23:03:36 rkt420 dockd[3112]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 08 23:03:36 rkt420 dockd[3112]: Applying config to 64: mode: 92, outputs: 1, x: 0, y: 0 Jan 08 23:03:36 rkt420 dockd[3112]: Setting screen size: height: 1080, width: 3520 Jan 09 10:30:55 rkt420 dockd[629]: Applying config to 63: mode: 74, outputs: 1, x: 0, y: 0 Jan 09 10:30:55 rkt420 dockd[629]: Applying config to 64: mode: 0, outputs: 0, x: 0, y: 0 Jan 09 10:30:55 rkt420 dockd[629]: Setting screen size: height: 900, width: 1600

rkubosz commented 6 years ago

I was running journalctl -f | grep dockd while I docked/undocked several times and there was no output.

smclt30p commented 6 years ago

That's the problem. :)

Can you run acpi_listen and verify that there is ACPI events on dock/undock?

rkubosz commented 6 years ago

I executed dockd --daemon in second terminal window. Now it works perfectly. journalctl -f | grep dockd: Jan 09 13:10:53 rkt420 sudo[12908]: robert : TTY=pts/1 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --config undocked Jan 09 13:11:50 rkt420 sudo[13299]: robert : TTY=pts/1 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/dockd --config docked Jan 09 13:12:05 rkt420 dockd[13359]: Applying config to 63: mode: 74, outputs: 1, x: 0, y: 0 Jan 09 13:12:05 rkt420 dockd[13359]: Applying config to 64: mode: 0, outputs: 0, x: 0, y: 0 Jan 09 13:12:05 rkt420 dockd[13359]: Setting screen size: height: 900, width: 1600 Jan 09 13:12:10 rkt420 dockd[13359]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 09 13:12:10 rkt420 dockd[13359]: Applying config to 64: mode: 237, outputs: 1, x: 0, y: 0 Jan 09 13:12:10 rkt420 dockd[13359]: Setting screen size: height: 1080, width: 3520 ^C^C⏎ ~ $ journalctl -f | grep dockd Jan 09 13:14:05 rkt420 dockd[13938]: Applying config to 63: mode: 74, outputs: 1, x: 0, y: 0 Jan 09 13:14:05 rkt420 dockd[13938]: Applying config to 64: mode: 0, outputs: 0, x: 0, y: 0 Jan 09 13:14:05 rkt420 dockd[13938]: Setting screen size: height: 900, width: 1600 Jan 09 13:14:11 rkt420 dockd[13938]: Applying config to 63: mode: 74, outputs: 1, x: 1920, y: 0 Jan 09 13:14:11 rkt420 dockd[13938]: Applying config to 64: mode: 237, outputs: 1, x: 0, y: 0 Jan 09 13:14:11 rkt420 dockd[13938]: Setting screen size: height: 1080, width: 3520

Maybe there should be an systemd unit with dockd?

smclt30p commented 6 years ago

Hmm, is there the XDG autostart file in /etc/xdg/autostart/dockd.desktop?

rkubosz commented 6 years ago

acpi_listen while docking: ibm/hotkey LEN0068:00 00000080 00004010 battery PNP0C0A:00 00000080 00000001 battery PNP0C0A:00 00000080 00000001 ac_adapter ACPI0003:00 00000080 00000001 ibm/hotkey LEN0068:00 00000080 00006030 thermal_zone LNXTHERM:00 00000081 00000000

acpi_listen while undocking: battery PNP0C0A:00 00000080 00000001 battery PNP0C0A:00 00000080 00000001 ibm/hotkey LEN0068:00 00000080 00004011 ac_adapter ACPI0003:00 00000080 00000000 ibm/hotkey LEN0068:00 00000080 00006030 thermal_zone LNXTHERM:00 00000081 00000000

rkubosz commented 6 years ago

Yes, the file is present. Content of file:

[Desktop Entry] Name=Lenovo ThinkPad Dock Daemon Comment=This handles the dock for Lenovo ThinkPads Icon=system-run Exec=dockd --daemon Terminal=false Type=Application NoDisplay=true NotShowIn=KDE;GNOME;Maybe there should be an systemd unit running

smclt30p commented 6 years ago

@rkubosz A systemd unit is not possible, because a systemd unit needs to run as root and the dock daemon needs to run as non-root to be able to connect to X.

Seems as if i3wm is not XDG-compatible. I will look into it, for now add a exec clause to i3config.

rkubosz commented 6 years ago

Ok that's great :-)