libthinkpad / dockd

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

config file write loop & segfault #9

Closed v0d closed 4 years ago

v0d commented 6 years ago

On Arch w/ Kernel: 4.16.9-1-ARCH, after installing via AUR (resulting in dockd 1.21 (libthinkpad 2.6) ), there is a kind of loop when trying to write the config file:

[jo@kowloon ~]$ sudo dockd --config docked
config file written to /etc/dockd/docked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
[...]

this goes on forever until Ctrl-C.

files are written: in /etc/dockd/

-rw-r--r--  1 root root  366 May 21 22:02 docked.conf
-rw-r--r--  1 root root  222 Jan 19 12:35 dock.hook
-rw-r--r--  1 root root    0 May 21 22:02 undocked.conf
-rw-r--r--  1 root root  224 Jan 19 12:31 undock.hook

it only seems to happen, when trying to write undocked.conf:

$ sudo dockd --config undocked
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf
config file written to /etc/dockd/undocked.conf

start of daemon creates error message:

$ dockd --daemon
Connect failed: No such file or directory

journalctl -f reveals a segfault:


May 21 22:10:50 kowloon kernel: dockd[20948]: segfault at 0 ip 000055efbbd389f8 sp 00007ffc5d2233d8 error 4 in dockd[55efbbd36000+6000]
May 21 22:10:50 kowloon systemd[1]: Created slice system-systemd\x2dcoredump.slice.
May 21 22:10:50 kowloon systemd[1]: Started Process Core Dump (PID 20949/UID 0).
May 21 22:10:50 kowloon systemd-coredump[20950]: 
smclt30p commented 6 years ago

Do you have acpid running?

v0d commented 6 years ago

my bad - starting acpid helps to get rid of the error Connect failed: No such file or directory but the file write loop persists.

smclt30p commented 6 years ago

Are you inside X or outside?

smclt30p commented 6 years ago

And what ThinkPad model?

v0d commented 6 years ago

20HGS0A600 ThinkPad T470s the dock is the ultra dock

v0d commented 6 years ago

when trying to set the saved config, e.g by: $ dockd --set undocked the daemon loops with

May 21 22:44:35 kowloon dockd[1531]: Not enough CRT controllers to set config, aborting
May 21 22:44:35 kowloon dockd[1531]: Not enough CRT controllers to set config, aborting
May 21 22:44:35 kowloon dockd[1531]: Not enough CRT controllers to set config, aborting
[...]

i am inside X (Xorg)

smclt30p commented 6 years ago

Can you post the output of xrandr and the contents of the files in /etc/dockd?

v0d commented 6 years ago
]$ xrandr
Screen 0: minimum 8 x 8, current 5520 x 1080, maximum 32767 x 32767
eDP1 connected primary (normal left inverted right x axis y axis)
   2560x1440     60.05 +  59.95  
   1920x1440     60.00  
   1856x1392     60.01  
   1792x1344     60.01  
   2048x1152     60.00    59.90    59.91  
   1920x1200     59.88    59.95  
   1920x1080     59.96    60.00    59.93  
   1600x1200     60.00  
   1680x1050     59.95    59.88  
   1400x1050     59.98  
   1600x900      60.00    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1368x768      60.00    59.88    59.85  
   1280x800      59.81    59.91  
   1280x720      59.86    60.00    59.74  
   1024x768      60.00  
   1024x576      60.00    59.90    59.82  
   960x540       60.00    59.63    59.82  
   800x600       60.32    56.25  
   864x486       60.00    59.92    59.57  
   640x480       59.94  
   720x405       59.51    60.00    58.99  
   640x360       59.84    59.32    60.00  
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP2-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 510mm x 290mm
   1920x1080     60.00*+  50.00    59.94  
   1680x1050     59.88  
   1280x1024     60.02  
   1280x960      60.00  
   1152x864      59.97  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       60.00    59.94  
DP2-2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 480mm x 270mm
   1920x1080     60.00*+  50.00    59.94  
   1680x1050     59.88  
   1400x1050     59.95  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x800      59.91  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    60.00    59.94  
   720x400       70.08  
DP2-3 connected 1680x1050+3840+0 (normal left inverted right x axis y axis) 470mm x 300mm
   1680x1050     59.88*+  59.95  
   1280x1024     75.02    60.02  
   1440x900      74.98    59.89  
   1280x960      60.00  
   1152x864      75.00  
   1024x768      75.03    60.00  
   832x624       74.55  
   800x600       75.00    60.32    56.25  
   640x480       75.00    59.94  
   720x400       70.08  
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
smclt30p commented 6 years ago

Also the files in /etc/dockd/

v0d commented 6 years ago

somehow the settings vanished. recreated:

$ cat /etc/dockd/undocked.conf 
[Screen]
height=1440
width=2560
mm_height=380
mm_width=675

[CRTC]
crtc=63
x=0
y=0
rotation=1
mode=2560x1440
outputs_len=1
outputs_0=eDP1

[CRTC]
crtc=64
x=1920
y=0
rotation=1
mode=None
outputs_len=0

[CRTC]
crtc=65
x=3840
y=0
rotation=1
mode=None
outputs_len=0

[CRTC]
crtc=66
x=0
y=0
rotation=1
mode=None
outputs_len=0

[jo@kowloon ~]$ cat /etc/dockd/docked.conf 
[Screen]
height=1080
width=5520
mm_height=285
mm_width=1456

[CRTC]
crtc=63
x=0
y=0
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=DP2-2

[CRTC]
crtc=64
x=1920
y=0
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=DP2-1

[CRTC]
crtc=65
x=3840
y=0
rotation=1
mode=1680x1050
outputs_len=1
outputs_0=DP2-3

[CRTC]
crtc=66
x=0
y=0
rotation=1
mode=None
outputs_len=0

now the configs get applied, again with this loop:

config applied from /etc/dockd/undocked.conf
config applied from /etc/dockd/undocked.conf
config applied from /etc/dockd/undocked.conf
config applied from /etc/dockd/undocked.conf
config applied from /etc/dockd/undocked.conf
[...]

respecively:

config applied from /etc/dockd/docked.conf

but: it is not appling the settings correctly e.g. when moving from undocked->docked; screen is flickering heavily and external screens stays black.

smclt30p commented 6 years ago

Any errors in the kernel log? If you see a crash in the kernel log this is probably #3.

v0d commented 6 years ago

no errors in the kernel log (apart from the segfaults of dockd, which are probably initiated by my ctrl-c)

smclt30p commented 6 years ago

Well that makes this a whole lot interesting. Mind posting the syslog?

v0d commented 6 years ago

i dont have access to it now - but will post tomorrow. It seems, dockd tries successfully to trigger the xrandr modifications - but is at the same time somewhow stuck in this loop, which triggers the adjustment over and over again

smclt30p commented 6 years ago

I think I got it. It was a simple comparing bug that I never experiended because x > x evaluates to false. The dock might be having a DisplayPort dongle or something that causes a higher number of CRT Controllers, and the bug checks if there are more controllers than configs, but it should be the other way around.

Try this branch: https://github.com/libthinkpad/dockd/tree/github-issue-9 Stupidly simple changeset: https://github.com/libthinkpad/dockd/commit/6f0c22a21dc7ee3484ab17d077dcbc634d58d2ed

v0d commented 6 years ago

I really would like to help, but I am not very familiar with creating an arch package based on a git branch

smclt30p commented 6 years ago

Run these:

git clone https://github.com/libthinkpad/dockd.git github-issue-9
cd github-issue-9
cmake .
make
./dockd [COMMAND]
v0d commented 6 years ago

thanks - I can now sucessfully do: ./dockd --set docked ./dockd --set undocked ./dockd --config docked ./dockd --config undocked

./dockd --daemon does not show any error, but it also not triggering anything when putting the machine the dock or removing it.

acpi log during the testing (may/will contain irrelevant lines)

May 22 15:36:45 kowloon root[14850]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:36:45 kowloon root[14852]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:36:45 kowloon root[14854]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:36:45 kowloon root[14856]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:38:42 kowloon root[15480]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:38:42 kowloon root[15482]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:38:42 kowloon root[15484]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:38:42 kowloon root[15486]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:39:28 kowloon root[15897]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:39:28 kowloon root[15899]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:39:28 kowloon root[15901]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:39:28 kowloon root[15903]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:39:28 kowloon root[15905]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:39:28 kowloon root[15907]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:39:28 kowloon root[15909]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:39:28 kowloon root[15911]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:40:22 kowloon root[16190]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:40:22 kowloon root[16192]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:40:23 kowloon root[16195]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:40:23 kowloon root[16197]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:40:27 kowloon root[16245]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:27 kowloon root[16272]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:28 kowloon root[16296]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:28 kowloon root[16320]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:28 kowloon root[16344]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:28 kowloon root[16368]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:29 kowloon root[16392]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:29 kowloon root[16416]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:29 kowloon root[16440]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:29 kowloon root[16464]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:30 kowloon root[16488]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:30 kowloon root[16512]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:30 kowloon root[16536]: ACPI group/action undefined: video/brightnessup / BRTUP
May 22 15:40:56 kowloon root[16688]: ACPI action undefined: PNP0C0A:00
May 22 15:40:56 kowloon root[16691]: ACPI group/action undefined: jack/headphone / HEADPHONE
May 22 15:40:57 kowloon root[16791]: ACPI action undefined: ACPI0003:00
May 22 15:40:57 kowloon root[16794]: ACPI group/action undefined: ibm/hotkey / LEN0268:00
May 22 15:40:57 kowloon root[16797]: ACPI group/action undefined: thermal_zone / LNXTHERM:00
May 22 15:40:59 kowloon root[16801]: ACPI action undefined: PNP0C0A:00
May 22 15:40:59 kowloon root[16805]: ACPI action undefined: PNP0C0A:01
May 22 15:41:06 kowloon root[16843]: ACPI group/action undefined: jack/headphone / HEADPHONE
May 22 15:41:07 kowloon root[16909]: ACPI action undefined: PNP0C0A:00
May 22 15:41:08 kowloon root[16916]: ACPI action undefined: ACPI0003:00
May 22 15:41:08 kowloon root[16920]: ACPI group/action undefined: ibm/hotkey / LEN0268:00
May 22 15:41:08 kowloon root[16923]: ACPI group/action undefined: thermal_zone / LNXTHERM:00
May 22 15:41:41 kowloon root[17170]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:41:41 kowloon root[17172]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:41:41 kowloon root[17174]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:41:41 kowloon root[17176]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:42:25 kowloon root[17395]: ACPI action undefined: PNP0C0A:00
May 22 15:42:25 kowloon root[17404]: ACPI group/action undefined: jack/headphone / HEADPHONE
May 22 15:42:26 kowloon root[17464]: ACPI action undefined: ACPI0003:00
May 22 15:42:26 kowloon root[17466]: ACPI group/action undefined: ibm/hotkey / LEN0268:00
May 22 15:42:26 kowloon root[17468]: ACPI group/action undefined: thermal_zone / LNXTHERM:00
May 22 15:42:40 kowloon root[17602]: ACPI action undefined: PNP0C0A:00
May 22 15:42:40 kowloon root[17604]: ACPI group/action undefined: jack/headphone / HEADPHONE
May 22 15:42:41 kowloon root[17608]: ACPI action undefined: ACPI0003:00
May 22 15:42:41 kowloon root[17611]: ACPI group/action undefined: ibm/hotkey / LEN0268:00
May 22 15:42:41 kowloon root[17613]: ACPI group/action undefined: thermal_zone / LNXTHERM:00
May 22 15:43:07 kowloon root[17880]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:43:07 kowloon root[17882]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:43:07 kowloon root[17884]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:43:07 kowloon root[17886]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:43:07 kowloon root[17888]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:43:07 kowloon root[17890]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:43:07 kowloon root[17892]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:43:07 kowloon root[17894]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:43:53 kowloon root[18113]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:43:53 kowloon root[18115]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:43:53 kowloon root[18117]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:43:53 kowloon root[18119]: ACPI group/action undefined: jack/videoout / VIDEOOUT
smclt30p commented 6 years ago

Nice, we fixed most of the issues. What kind of dock do you use?

v0d commented 6 years ago

ThinkPad Ultra Dock - 90 W (EU) P/N: 40A20090EU

v0d commented 6 years ago

Here are journal logs with comments

-- Logs begin at Tue 2018-05-22 08:22:43 CEST. --
May 22 15:52:02 kowloon dockd[20957]: Applying config to   63: mode:   77, outputs:    1, x:    0, y:    0
May 22 15:52:03 kowloon kernel: [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.
May 22 15:52:03 kowloon root[20959]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:52:03 kowloon root[20961]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:52:03 kowloon dockd[20957]: Applying config to   64: mode:   77, outputs:    1, x: 1920, y:    0
May 22 15:52:03 kowloon root[20963]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:52:03 kowloon root[20965]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:52:03 kowloon dockd[20957]: Applying config to   65: mode:  428, outputs:    1, x: 3840, y:    0
May 22 15:52:03 kowloon dockd[20957]: Applying config to   66: mode:    0, outputs:    0, x:    0, y:    0
May 22 15:52:03 kowloon dockd[20957]: Setting screen size: height: 1080, width: 5520

---- STATUS: In Dock
---  Now setting to 'undocked' to be able to see something, after I undock the machine

May 22 15:53:22 kowloon dockd[21376]: Applying config to   63: mode:  414, outputs:    1, x:    0, y:    0
May 22 15:53:22 kowloon root[21378]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:53:22 kowloon root[21380]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:53:22 kowloon kernel: [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.
May 22 15:53:22 kowloon dockd[21376]: Applying config to   64: mode:    0, outputs:    0, x: 1920, y:    0
May 22 15:53:22 kowloon root[21392]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:53:22 kowloon root[21394]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:53:23 kowloon kernel: [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.
May 22 15:53:23 kowloon dockd[21376]: Applying config to   65: mode:    0, outputs:    0, x: 3840, y:    0
May 22 15:53:23 kowloon dockd[21376]: Applying config to   66: mode:    0, outputs:    0, x:    0, y:    0
May 22 15:53:23 kowloon dockd[21376]: Setting screen size: height: 1440, width: 2560

---- now REALLY undocking the machine

May 22 15:53:49 kowloon kernel: usb 1-4: USB disconnect, device number 18
May 22 15:53:49 kowloon kernel: usb 1-4.4: USB disconnect, device number 19
May 22 15:53:49 kowloon kernel: usb 1-4.4.1: USB disconnect, device number 20
May 22 15:53:49 kowloon acpid[382]: input device has been disconnected, fd 8
May 22 15:53:49 kowloon kernel: usb 2-4: USB disconnect, device number 7
May 22 15:53:49 kowloon root[21549]: ACPI action undefined: PNP0C0A:00
May 22 15:53:49 kowloon root[21551]: ACPI group/action undefined: jack/headphone / HEADPHONE
May 22 15:53:49 kowloon acpid[382]: input device has been disconnected, fd 9
May 22 15:53:49 kowloon kernel: usb 1-4.4.2: USB disconnect, device number 21
May 22 15:53:49 kowloon dhcpcd[20934]: eth0: carrier lost
May 22 15:53:49 kowloon kernel: e1000e: eth0 NIC Link is Down
May 22 15:53:49 kowloon dhcpcd[20934]: eth0: deleting route to 192.168.0.0/24
May 22 15:53:49 kowloon dhcpcd[20934]: eth0: deleting default route via 192.168.0.1
May 22 15:53:50 kowloon root[21610]: ACPI action undefined: ACPI0003:00
May 22 15:53:50 kowloon kernel: thinkpad_acpi: EC reports that Thermal Table has changed
May 22 15:53:50 kowloon root[21612]: ACPI group/action undefined: ibm/hotkey / LEN0268:00
May 22 15:53:50 kowloon root[21614]: ACPI group/action undefined: thermal_zone / LNXTHERM:00
May 22 15:53:50 kowloon ifplugd[378]: Link beat lost.
May 22 15:53:56 kowloon ifplugd[378]: Executing '/etc/ifplugd/netctl.action eth0 down'.
May 22 15:53:56 kowloon ifplugd[378]: client: Stopping network profile 'eth0-arch_usb'...
May 22 15:53:56 kowloon dhcpcd[21633]: sending signal TERM to pid 20934
May 22 15:53:56 kowloon dhcpcd[21633]: waiting for pid 20934 to exit
May 22 15:53:56 kowloon dhcpcd[20934]: received SIGTERM, stopping
May 22 15:53:56 kowloon dhcpcd[20934]: eth0: removing interface
May 22 15:53:56 kowloon dhcpcd[20934]: dhcpcd exited
May 22 15:53:57 kowloon kernel: e1000e: eth0 NIC Link is Down
May 22 15:53:57 kowloon ifplugd[378]: client: Stopped network profile 'eth0-arch_usb'
May 22 15:53:57 kowloon ifplugd[378]: Program executed successfully.
 May 22 15:53:57 kowloon kernel: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready                                                                         

--- now putting it back in

May 22 15:54:17 kowloon root[21756]: ACPI group/action undefined: jack/headphone / HEADPHONE
May 22 15:54:17 kowloon root[21802]: ACPI action undefined: PNP0C0A:00
May 22 15:54:18 kowloon kernel: usb 2-4: new SuperSpeed USB device number 8 using xhci_hcd
May 22 15:54:18 kowloon kernel: usb 2-4: New USB device found, idVendor=17ef, idProduct=1010
May 22 15:54:18 kowloon kernel: usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
May 22 15:54:18 kowloon kernel: usb 2-4: Product: Lenovo ThinkPad Dock   
May 22 15:54:18 kowloon kernel: usb 2-4: Manufacturer: LENOVO                 
May 22 15:54:18 kowloon kernel: hub 2-4:1.0: USB hub found
May 22 15:54:18 kowloon kernel: hub 2-4:1.0: 4 ports detected
May 22 15:54:18 kowloon kernel: usb 1-4: new high-speed USB device number 22 using xhci_hcd
May 22 15:54:18 kowloon root[21806]: ACPI action undefined: ACPI0003:00
May 22 15:54:18 kowloon kernel: thinkpad_acpi: EC reports that Thermal Table has changed
May 22 15:54:18 kowloon root[21808]: ACPI group/action undefined: ibm/hotkey / LEN0268:00
May 22 15:54:18 kowloon root[21810]: ACPI group/action undefined: thermal_zone / LNXTHERM:00
May 22 15:54:18 kowloon kernel: usb 1-4: New USB device found, idVendor=17ef, idProduct=1010
May 22 15:54:18 kowloon kernel: usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
May 22 15:54:18 kowloon kernel: usb 1-4: Product: Lenovo ThinkPad Dock   
May 22 15:54:18 kowloon kernel: usb 1-4: Manufacturer: LENOVO                 
May 22 15:54:18 kowloon kernel: hub 1-4:1.0: USB hub found
May 22 15:54:18 kowloon kernel: hub 1-4:1.0: 4 ports detected
May 22 15:54:18 kowloon kernel: usb 1-4.4: new high-speed USB device number 23 using xhci_hcd
May 22 15:54:18 kowloon kernel: usb 1-4.4: New USB device found, idVendor=17ef, idProduct=100f
May 22 15:54:18 kowloon kernel: usb 1-4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May 22 15:54:18 kowloon kernel: usb 1-4.4: Product: Lenovo ThinkPad Dock
May 22 15:54:18 kowloon kernel: usb 1-4.4: Manufacturer: Lenovo
May 22 15:54:18 kowloon kernel: usb 1-4.4: SerialNumber: Rev1.2
May 22 15:54:18 kowloon kernel: hub 1-4.4:1.0: USB hub found
May 22 15:54:18 kowloon kernel: hub 1-4.4:1.0: 3 ports detected
May 22 15:54:19 kowloon kernel: usb 1-4.4.1: new full-speed USB device number 24 using xhci_hcd
May 22 15:54:19 kowloon kernel: usb 1-4.4.1: New USB device found, idVendor=04d9, idProduct=0192
May 22 15:54:19 kowloon kernel: usb 1-4.4.1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
May 22 15:54:19 kowloon kernel: usb 1-4.4.1: Product: USB-HID Keyboard
May 22 15:54:19 kowloon kernel: input: USB-HID Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.0/0003:04D9:0192.0012/input/input34
May 22 15:54:19 kowloon kernel: hid-generic 0003:04D9:0192.0012: input,hidraw0: USB HID v1.11 Keyboard [USB-HID Keyboard] on usb-0000:00:14.0-4.4.1/input0
May 22 15:54:19 kowloon kernel: hid-generic 0003:04D9:0192.0013: hiddev0,hidraw1: USB HID v1.11 Device [USB-HID Keyboard] on usb-0000:00:14.0-4.4.1/input1
May 22 15:54:19 kowloon kernel: input: USB-HID Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.2/0003:04D9:0192.0014/input/input35
May 22 15:54:19 kowloon kernel: hid-generic 0003:04D9:0192.0014: input,hidraw2: USB HID v1.11 Keyboard [USB-HID Keyboard] on usb-0000:00:14.0-4.4.1/input2
May 22 15:54:19 kowloon systemd-logind[380]: Watching system buttons on /dev/input/event4 (USB-HID Keyboard)
May 22 15:54:19 kowloon systemd-logind[380]: Watching system buttons on /dev/input/event5 (USB-HID Keyboard)
May 22 15:54:19 kowloon kernel: usb 1-4.4.2: new low-speed USB device number 25 using xhci_hcd
May 22 15:54:19 kowloon kernel: usb 1-4.4.2: New USB device found, idVendor=045e, idProduct=0040
May 22 15:54:19 kowloon kernel: usb 1-4.4.2: New USB device strings: Mfr=1, Product=3, SerialNumber=0
May 22 15:54:19 kowloon kernel: usb 1-4.4.2: Product: Microsoft 3-Button Mouse with IntelliEye(TM)
May 22 15:54:19 kowloon kernel: usb 1-4.4.2: Manufacturer: Microsoft
May 22 15:54:19 kowloon kernel: input: Microsoft Microsoft 3-Button Mouse with IntelliEye(TM) as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.2/1-4.4.2:1.0/0003:045E:0040.0015/input/input36
May 22 15:54:19 kowloon kernel: hid-generic 0003:045E:0040.0015: input,hidraw3: USB HID v1.10 Mouse [Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)] on usb-0000:00:14.0-4.4.2/input0
May 22 15:54:19 kowloon kernel: e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
May 22 15:54:19 kowloon kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
May 22 15:54:20 kowloon ifplugd[378]: Link beat detected.
May 22 15:54:21 kowloon ifplugd[378]: Executing '/etc/ifplugd/netctl.action eth0 up'.
May 22 15:54:21 kowloon ifplugd[378]: client: Starting network profile 'eth0-arch_usb'...
May 22 15:54:21 kowloon dhcpcd[21839]: DUID 00:01:00:01:22:87:17:b0:c8:5b:76:fb:b6:c3
May 22 15:54:21 kowloon dhcpcd[21839]: eth0: IAID 76:fb:b6:c3
May 22 15:54:21 kowloon dhcpcd[21839]: eth0: rebinding lease of 192.168.0.234
May 22 15:54:21 kowloon dhcpcd[21839]: eth0: probing address 192.168.0.234/24
May 22 15:54:26 kowloon dhcpcd[21839]: eth0: leased 192.168.0.234 for 86400 seconds
May 22 15:54:26 kowloon dhcpcd[21839]: eth0: adding route to 192.168.0.0/24
May 22 15:54:26 kowloon dhcpcd[21839]: eth0: adding default route via 192.168.0.1
May 22 15:54:26 kowloon dhcpcd[21839]: forked to background, child pid 21902
May 22 15:54:26 kowloon ifplugd[378]: client: Started network profile 'eth0-arch_usb'
May 22 15:54:26 kowloon ifplugd[378]: Program executed successfully.

--- screen did not change,
--- now /dockd --set docked

May 22 15:54:54 kowloon dockd[22073]: Applying config to   63: mode:   77, outputs:    1, x:    0, y:    0
May 22 15:54:54 kowloon kernel: [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.
May 22 15:54:54 kowloon root[22075]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:54:54 kowloon root[22077]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:54:54 kowloon dockd[22073]: Applying config to   64: mode:   77, outputs:    1, x: 1920, y:    0
May 22 15:54:54 kowloon root[22079]: ACPI group/action undefined: jack/lineout / LINEOUT
May 22 15:54:54 kowloon root[22081]: ACPI group/action undefined: jack/videoout / VIDEOOUT
May 22 15:54:54 kowloon dockd[22073]: Applying config to   65: mode:  428, outputs:    1, x: 3840, y:    0
May 22 15:54:54 kowloon dockd[22073]: Applying config to   66: mode:    0, outputs:    0, x:    0, y:    0
May 22 15:54:54 kowloon dockd[22073]: Setting screen size: height: 1080, width: 5520
smclt30p commented 6 years ago

Ok, now can you run acpi_listen, dock, undock the laptop and post the output here?

v0d commented 6 years ago
[jo@kowloon github-issue-9]$ acpi_listen 
--- docked

 --- now undock
battery PNP0C0A:00 00000080 00000001
jack/headphone HEADPHONE unplug
ac_adapter ACPI0003:00 00000080 00000000
ibm/hotkey LEN0268:00 00000080 00006030
thermal_zone LNXTHERM:00 00000081 00000000

---- now back in

jack/headphone HEADPHONE plug
battery PNP0C0A:00 00000080 00000001
ac_adapter ACPI0003:00 00000080 00000001
ibm/hotkey LEN0268:00 00000080 00006030
thermal_zone LNXTHERM:00 00000081 00000000
jack/lineout LINEOUT plug
jack/videoout VIDEOOUT plug
jack/lineout LINEOUT plug
jack/videoout VIDEOOUT plug
smclt30p commented 6 years ago

Can you do lsusb while docked in?

v0d commented 6 years ago
[jo@kowloon github-issue-9]$ lsusb
Bus 002 Device 009: ID 17ef:1010 Lenovo 
Bus 002 Device 003: ID 0bda:0316 Realtek Semiconductor Corp. 
Bus 002 Device 002: ID 0781:5583 SanDisk Corp. Ultra Fit
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 009: ID 138a:0097 Validity Sensors, Inc. 
Bus 001 Device 007: ID 04ca:7066 Lite-On Technology Corp. 
Bus 001 Device 005: ID 8087:0a2b Intel Corp. 
Bus 001 Device 003: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader
Bus 001 Device 029: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
Bus 001 Device 028: ID 04d9:0192 Holtek Semiconductor, Inc. 
Bus 001 Device 027: ID 17ef:100f Lenovo 
Bus 001 Device 026: ID 17ef:1010 Lenovo 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
v0d commented 6 years ago

Let me know if you need anything else. Thanks for your Support :)

sentriz commented 6 years ago

exact same issue here. t470, ultradock. github-issue-9 fixed the loop, and starting acpid fixed the daemon not starting. but same as @v0d, nothing happens when i dock or undock (but --set) works

smclt30p commented 6 years ago

Hi guys, sorry for the delay I was busy. The problem here is that the new docks are fired as a USB device and not a ACPI event. @sentriz can you post lsusb please?

sentriz commented 6 years ago

sure this is while docked

$ lsusb
Bus 002 Device 003: ID 0bda:0316 Realtek Semiconductor Corp.
Bus 002 Device 005: ID 17ef:1010 Lenovo
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 008: ID 138a:0097 Validity Sensors, Inc.
Bus 001 Device 007: ID 5986:111c Acer, Inc
Bus 001 Device 005: ID 8087:0a2b Intel Corp.
Bus 001 Device 003: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader
Bus 001 Device 014: ID 17ef:100f Lenovo
Bus 001 Device 013: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 012: ID 17ef:1010 Lenovo
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
smclt30p commented 6 years ago

Now, there are 2 Lenovo devices. The Mini Dock Series 3 is ID 100a, could the new dock be ID 100f? Or ID 1010?

On 7 June 2018 at 17:34, Senan Kelly notifications@github.com wrote:

sure this is while docked

$ lsusb Bus 002 Device 003: ID 0bda:0316 Realtek Semiconductor Corp. Bus 002 Device 005: ID 17ef:1010 Lenovo Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 008: ID 138a:0097 Validity Sensors, Inc. Bus 001 Device 007: ID 5986:111c Acer, Inc Bus 001 Device 005: ID 8087:0a2b Intel Corp. Bus 001 Device 003: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader Bus 001 Device 014: ID 17ef:100f Lenovo Bus 001 Device 013: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 012: ID 17ef:1010 Lenovo Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/libthinkpad/dockd/issues/9#issuecomment-395465410, or mute the thread https://github.com/notifications/unsubscribe-auth/ANUV-4psJ4b0cvgM7T2b5R9uDnsp5GNwks5t6UgQgaJpZM4UHjdE .

smclt30p commented 6 years ago

According to this: https://github.com/mvp/uhubctl/blob/master/README.md

100f is the Ultra dock. Patch incoming.

sentriz commented 6 years ago

hmm, I can't tell. When I undock they both disappear. The only things connected to the dock are a monitor, logitech keyboard and mouse, and ethernet cable

smclt30p commented 6 years ago

Does the file /sys/devices/platform/dock.2/docked exist on your machine and does it respond to the dock status?

sentriz commented 6 years ago

hmm, only /sys/devices/platform/dock.0/docked exists, and it does not respond (always 1)

smclt30p commented 6 years ago

Okay let's test this:

First build and install the test version of libthinkpad: https://github.com/libthinkpad/libthinkpad/tree/2.7-test Then build and install the test version of dockd: https://github.com/libthinkpad/dockd/tree/1.30-test

And please report back. You should see this in your syslog:

....
.. dockd[xxx]: Lenovo UltraDock (2015) Detected
....

And it should trigger.

sentriz commented 6 years ago

great thanks. I'm at home right now, but I'll test it in the morning when I'm back at work with the dock

sentriz commented 6 years ago

unfortunately it didn't work, but here is the syslog http://termbin.com/xpcr

smclt30p commented 6 years ago

Do you have a "dock detected" in syslog?

sentriz commented 6 years ago

is syslog journalctl? (on a systemd machine)

smclt30p commented 6 years ago

Yes. Do journalctl | grep dockd and post it here.

sentriz commented 6 years ago
$ journalctl --since "2 hours ago" -f | grep dockd
Jun 08 11:19:12 work sudo[10410]:    senan : TTY=pts/2 ; PWD=/opt ; USER=root ; COMMAND=/usr/sbin/dockd --config undocked
Jun 08 11:19:20 work sudo[10484]:    senan : TTY=pts/2 ; PWD=/opt ; USER=root ; COMMAND=/usr/sbin/dockd --config undocked
Jun 08 11:19:51 work sudo[10697]:    senan : TTY=pts/2 ; PWD=/opt ; USER=root ; COMMAND=/usr/sbin/dockd --daemon
Jun 08 12:23:43 work sudo[8647]:    senan : TTY=pts/1 ; PWD=/home/senan ; USER=root ; COMMAND=/usr/sbin/dockd --daemon
Jun 08 12:24:18 work sudo[8941]:    senan : TTY=pts/2 ; PWD=/home/senan ; USER=root ; COMMAND=/usr/sbin/dockd --config docked
Jun 08 12:27:20 work sudo[10439]:    senan : TTY=pts/1 ; PWD=/home/senan ; USER=root ; COMMAND=/usr/sbin/dockd --daemon
Jun 08 12:27:41 work sudo[10535]:    senan : TTY=pts/1 ; PWD=/home/senan ; USER=root ; COMMAND=/usr/sbin/dockd --daemon
Jun 08 12:58:12 work sudo[23850]:    senan : TTY=pts/2 ; PWD=/home/senan ; USER=root ; COMMAND=/usr/sbin/killall dockd

i was messing about with running dockd --daemon with and without sudo. but it was definitely running when I was testing the dock above

smclt30p commented 6 years ago

Is dockd running at all? There are no dockd messages in the output. Is acpid running?

smclt30p commented 6 years ago

Try journalctl -f and follow the dockd messages.

sentriz commented 6 years ago
work, ~, systemctl status acpid | grep "Active:"
   Active: active (running) since Fri 2018-06-08 13:34:16 IST; 4min 31s ago
work, ~, ps aux | grep "[d]ockd"
senan     3600  0.0  0.0 134812  3220 pts/1    Sl   13:38   0:00 dockd --daemon
work, ~, # will undock as soon as i start the next command^C
work, ~, journalctl -f | grep dockd
# undocking finished, exiting journalctl
^C^C⏎                                                                                                                                                                                                                                        work, ~, 
work, ~, # nothing happened 

there doesn't seem to be any dockd messages

smclt30p commented 6 years ago

Is anything related to dockd in syslog?

sentriz commented 6 years ago

this is from all time:

journalctl | grep -E 'dockd\[[0-9]+\]'
Jun 07 14:02:52 work kernel: dockd[9622]: segfault at 0 ip 00005654a24719f8 sp 00007ffe1e619538 error 4 in dockd[5654a246f000+6000]
Jun 07 14:14:59 work dockd[18160]: Applying config to   64: mode:  441, outputs:    1, x:    0, y:    0
Jun 07 14:15:01 work dockd[18160]: Applying config to   63: mode:   77, outputs:    1, x: 1920, y:  120
Jun 07 14:15:01 work dockd[18160]: Applying config to   65: mode:    0, outputs:    0, x:    0, y:    0
Jun 07 14:15:01 work dockd[18160]: Applying config to   66: mode:    0, outputs:    0, x:    0, y:    0
Jun 07 14:15:01 work dockd[18160]: Setting screen size: height: 1200, width: 3840

but these were yesterday, and with the build from the AUR. (the "Applying config" things were when I used --set I think)

smclt30p commented 6 years ago

I don't know what is happening here. Remove dockd from autostart, reboot the machine and start dockd manually. Verify the dockd version running is 1.30.

sentriz commented 6 years ago

it has been manual the whole time. sorry, how do I check the version?

smclt30p commented 6 years ago

Just execute dockd with no arguments.

sentriz commented 6 years ago

uh oh...