<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO - Lenovo X1 Yoga (Gen 3) touchpad not suspended in tablet mode"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=106498#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO - Lenovo X1 Yoga (Gen 3) touchpad not suspended in tablet mode"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=106498">bug 106498</a>
              from <span class="vcard"><a class="email" href="mailto:z@zxmth.us" title="Zachary Smith <z@zxmth.us>"> <span class="fn">Zachary Smith</span></a>
</span></b>
        <pre>Thanks for the helpful comments, Peter.

I added a breakpoint to evdev_notify_suspended_device and stepped through all
of the devices coming through. When the touchpad ("Synaptics TM3293-011") comes
through, I watched it go all the way through and it does successfully hit the
'continue' in the list_for_each block so is not sending a dispatch to itself.
It continues to be suspended and has its fd set to -1. All seems good there.

A little while later, the keyboard ("AT Translated Set 2 keyboard") comes
through evdev_notify_suspend_device and loops over the devices_list. 

When it comes to the touchpad, if (d->dispatch->interface->device_suspended)
evaluates true and d->dispatch->interface->device_suspended(d, device) is
called (with 'd' == touchpad and device = keyboard) triggering
tp_interface_device_removed which ultimately calls tp_resume_conditional which
then re-enables the touchpad that was previously disabled. 

I confirmed that the touchpad fd was -1 when entering tp_resume_conditional and
23 (which was what it was prior to suspending) upon exit.


Here is the stack:
#0  0x00007ffff7bab526 in tp_resume_conditional (tp=
    0x6518f0, device=0x668380, excluded_device=0x65c000)
    at ../src/evdev-mt-touchpad.c:1955
#1  0x00007ffff7bac15f in tp_interface_device_removed (device=0x668380,
removed_device=0x65c000) at ../src/evdev-mt-touchpad.c:2344
#2  0x00007ffff7b9ffc7 in evdev_notify_suspended_device (device=0x65c000)
    at ../src/evdev.c:2506
#3  0x00007ffff7ba00f9 in evdev_device_suspend (device=0x65c000) at
../src/evdev.c:2537
#4  0x00007ffff7ba4a8c in fallback_suspend (dispatch=0x66f730, device=0x65c000)
    at ../src/evdev-fallback.c:1149
#5  0x00007ffff7ba4b4b in fallback_tablet_mode_switch_event (time=2988977338,
event=
    0x68bda0, data=0x66f730) at ../src/evdev-fallback.c:1175
#6  0x00007ffff7b96f75 in post_device_event (device=0x65a560, time=2988977338,
type=
    LIBINPUT_EVENT_SWITCH_TOGGLE, event=0x68bda0) at ../src/libinput.c:2117
#7  0x00007ffff7b98349 in switch_notify_toggle (device=0x65a560,
time=2988977338, sw=
    LIBINPUT_SWITCH_TABLET_MODE, state=LIBINPUT_SWITCH_STATE_ON) at
../src/libinput.c:2740
#8  0x00007ffff7ba3d1b in fallback_process_switch (dispatch=
    0x667120, device=0x65a560, e=0x7fffffffe790, time=2988977338)
    at ../src/evdev-fallback.c:705
#9  0x00007ffff7ba437b in fallback_interface_process (evdev_dispatch=
    0x667120, device=0x65a560, event=0x7fffffffe790, time=2988977338)
    at ../src/evdev-fallback.c:902
#10 0x00007ffff7b9c8ae in evdev_process_event (device=0x65a560,
e=0x7fffffffe790)
    at ../src/evdev.c:863
#11 0x00007ffff7b9c8e4 in evdev_device_dispatch_one (device=0x65a560,
ev=0x7fffffffe790)
    at ../src/evdev.c:871
#12 0x00007ffff7b9ca83 in evdev_device_dispatch (data=0x65a560) at
../src/evdev.c:930
#13 0x00007ffff7b96c14 in libinput_dispatch (libinput=0x619760) at
../src/libinput.c:2000
#14 0x0000000000407229 in handle_and_print_events (li=0x619760)
    at ../tools/libinput-debug-events.c:773
#15 0x00000000004076a2 in mainloop (li=0x619760) at
../tools/libinput-debug-events.c:899
#16 0x00000000004078aa in main (argc=2, argv=0x7fffffffeba8)
    at ../tools/libinput-debug-events.c:998</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>