linux-surface/surface-dtx-daemon

Does not excute [handler]-attach.sh

2ndBillGates opened this issue · 8 comments

I've set up the attach script, to prevent xinput reset to default setting.
But after i detach the screen, the script is not excuted.

I've confirmed the script file is executable.

Screenshot_20210329_174503

qzed commented

First, you're showing the attach script. That won't be run when detaching. For that you need the detach script. Based on the contents of that script, you probably do want to run this when attaching though?

If that still doesn't work, can you put something like echo $0 at the top of both the attach and detach script, change the log level in the config to debug, detach, then re-attach, and finally run journalctl -u surface-dtx-daemon.service -e? That should give you a log with the output of your scripts.

Sorry
I mistype the summary

I want to execute the script after I attach the screen, not detach

qzed commented

Yeah, that should work via the attach script. You can check via the logs as mentioned above, but that should get executed.

Although since you're trying to change device parameters of the keyboard, you might want to consider doing that via udev rules instead. Those will trigger when they detect the device (in this case touchpad), which might be a bit more reliable than the attach script.

journalctl returns with these

looks like when i detach the screen, it wouldn't umount my SD card either

-- Boot d00dab25ccce45edb2b1b8f7416c8b2d --
Mar 29 19:17:28 ArchSB2 systemd[1]: Started Surface Detachment System (DTX) Daemon.
Mar 29 19:49:21 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:21.193 INFO subprocess terminated with exit code: 0
Mar 29 19:49:21 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:21.193 INFO subprocess terminated with stderr: "umount: /run/media/tom/KGB: target is >
Mar 29 19:49:23 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:23.516 WARN hardware failure, aborting detahment: FailedToOpen
Mar 29 19:49:23 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:23.534 INFO subprocess terminated with exit code: 1
Mar 29 19:49:23 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:23.534 INFO subprocess terminated with stdout: "./attach.sh\n"
Mar 29 19:49:23 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:23.534 INFO subprocess terminated with stderr: "Unable to connect to X server\nUnable to>
Mar 29 19:49:23 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:23.561 ERRO invalid state, state: (Normal, Disconnected)
Mar 29 19:49:30 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:30.982 INFO subprocess terminated with exit code: 1
Mar 29 19:49:30 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:30.982 INFO subprocess terminated with stdout: "./attach.sh\n"
Mar 29 19:49:30 ArchSB2 surface-dtx-daemon[1120]: Mar 29 19:49:30.982 INFO subprocess terminated with stderr: "Unable to connect to X server\nUnable to>

also, i want to ask if possible to have muti-touch for touchpad?
like two finger to zoom in and out

qzed commented

Okay, there seem to be some errors going on in your scripts:

  • The detach script outputs umount: /run/media/tom/KGB: target is... (the rest is hidden in your log), so something doesn't seem to work quite right there.
  • The attach script outputs Unable to connect to X server, which is likely because you're running it as root and root doesn't run an X server. Not sure how to fix that though.

There's also a weird thing going on: hardware failure, aborting detachment: FailedToOpen. This is a message sent by the EC indicating that something with the hardware is wrong, specifically that the clipboard mechanism couldn't be opened for separating the tablet. What makes this weird is that you can still detach the tablet just fine as later stated by invalid state, state: (Normal, Disconnected) (the invalid state because it thinks the latch should be closed so detachment not possible, due to the failure before).

Any chance you've ever experienced any issues where detaching the tablet before didn't work properly or caused any issues (apart from scripts)? Also can you try a two-button reset and see if that gets rid of the FailedToOpen message?

qzed commented

also, i want to ask if possible to have muti-touch for touchpad?
like two finger to zoom in and out

This should be supported by the kernel just fine, but might be a user-space issue. AFAIK Xorg has problems with that. Works well on my SB2 on Wayland.

qzed commented

I'm going to close this as the handler scripts do get executed properly, but the content you added causes them to fail. With the new v0.3.0, things like this should be communicated a bit cleaner in the logs, i.e. journalctl -u surface-dtx-daemon.service -e should show the full (and now formatted) output. Hardware and runtime errors like FailedToOpen are now also displayed to the user. Feel free to open a new issue if there are any other problems.