No internet connection
  1. Home
  2. General

Can all usb input be “cancelled” via an ssh command or browser hotkey

By @Alt0
    2022-01-31 18:07:51.537Z2022-01-31 18:21:25.546Z

    TDLR: title question. If not possible I would like to formally request this :-)

    Why needed:
    I use a product similar to Synergy where I have 2 PCs & 2 monitors but 1 mouse and keyboard.
    ( The 2nd PC I keep TinyPilots browser window up, thus controlling a 3rd PC as a slave )

    When I switch between PC 1 and 2 via some Ctrl or Alt or Shift hotkey press, then TinyPilot’s browser window will think these are still held down and thus typing, clicking, etc get into a bad state on its slave machine. The only solution is to exit full screen mode (via Esc, which isn’t passed thru from full screen) go up to the address bar, and then refresh the TinyPilot client page. And then re-enter full screen after it refreshes. It’s just very inconvenient each time I switch. Pressing these modifier keys on PC2 isn’t usually enough to “undo” the browser window from thinking that they are still being held down from the previous hotkey press between the 2x PCs.

    The Question(s):
    Is there a way to shortcut (pun perhaps intended :P) this via some Hotkey in the browser which isn’t passed thru, or some ssh command I can run from anywhere on the LAN to cancel all input (possibly this is more client browser based so I wonder if instead this command would have to communicate from TinyPilot server to the browser to auto refresh… I would really like that! Sometimes the screen displayed in the browser after a reboot is NOT accurate)

    In any case, Unplugging and plugging back in the USB cable to the slave machine doesn’t help from my tests to stop the browser client window from thinking Modifier keys are held. It specifically requires a page reload.

    If this isn’t available might I request some option to possibly enable like F5 not be passed thru to refresh the browser window so this can be quickly resolved without undoing full screen, refreshing the address bar, redoing the full screen, for every time I switch back to the secondary PC?

    However as mentioned, it too would be handy to be able to force refresh all client-side browser views from the server, via some SSH command if that’s doable; tho I wonder if that would take some JavaScript polling to check to see if the server (TinyPilot) requests new image data / to do a full page refresh (like if an ssh command drops some file which is watched for and then deleted by a client-side component, if that’s even possibly) and thus should initiate a url redirect to itself to refresh its own page, thus having the correct image. That would be super valuable.

    Side note: did you know Chrome demonstrates significantly lower latency compared to when using Firefox as the client-side controller? I just discovered this. FF is quite a lot more lag in comparison.

    • 4 replies
    1. I just want to make sure I understand the behavior you're seeing. For simplicity, I'm just going to pretend that your hotkey is shift even if that's not necessarily the hotkey you're using to switch PCs.

      1. You press shift as a hotkey to switch from PC 1 to PC 2
      2. You release the shift key
      3. When you click in the TinyPilot browser window, PC 3 behaves as though you're still pressing the shift key
      4. Refreshing the TinyPilot browser window on PC 2 fixes the issue so that it no longer thinks you're pressing the shift key

      It's not possible to send a command to clear the USB state. The server actually doesn't really keep state, so that's why you don't see any difference when you plug and unplug the USB cable.

      TinyPilot actually keeps track of keyboard state in the browser.

      I suspect the problem is actually caused when you leave, not when you come back. Because if you switch from PC2 to PC1 with a hotkey while the TinyPilot window has focus, then TinyPilot sees you push down shift, but it never sees you release the shift key because the Synergy-like app switched screens. So when you come back, it thinks that you're still holding down the shift key.

      You should be able to fix this if you press any non-modifier key, even something like Home or End. When you do that, TinyPilot should see that you're not still holding down shift, and it will update its internal keyboard state.

      Can you try reproducing the issue and then hitting a keyboard key and see if that resets the state? Any key except Ctrl, Alt, Shift, or Win/Meta should fix it.

      1. A@Alt0
          2022-02-05 20:41:18.020Z2022-02-06 00:26:44.045Z

          Sorry for the delay. Yes it’s exactly as your understand.

          I’ll try to pay attention next time in the lower corner for key history if TinyPilot “thinks” shift or some modifier key is held still.

          Unfortunately pressing other keys (on the slave / controlled PC) doesn’t undo it at all. Nor does unplugging & reply pluging tinypilot’s USB

          1. Does the hotkey involve the Ctrl key? We just fixed a bug where the Ctrl key can get stuck down if TinyPilot doesn't see the key release event. That fix will be included in the 2.4.0 release later this month. But even if you were hitting that bug, pressing and releasing Ctrl when you come back to TinyPilot in the browser should have fixed it.

            1. A@Alt0
                2022-02-09 06:30:07.394Z

                Mainly Shift key, but I will await the update and see. Sometimes it was Ctrl, but it is very particular if trying to "undo"