We have moved to a new Sailfish OS Forum. Please start new discussions there.
0

[SailfishOS 1.1.2.15 (Yliaavanlampi)] BUG SSH breaks after running python scripts. [answered]

asked 2015-02-22 15:45:43 +0300

Djbengan gravatar image

Hello! On Yliaavanlampi, when sshing into the phone and running a python script, after terminating, input stops showing. This is on OS-X. Did not have this issue on Utiika. Fast demo on yt. Same issue on diffrent scripts, nothing connected to phone so dont mind the error.

https://www.youtube.com/watch?v=F7MO6V7nSis

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by saturn
close date 2015-02-23 01:23:03.895034

1 Answer

Sort by » oldest newest most voted
3

answered 2015-02-22 16:27:21 +0300

t-lo gravatar image

updated 2015-02-22 16:28:05 +0300

It's your python code that does this. From the youtube video I assume that you're trying to run "Striker" (e.g. https://github.com/SkyeSweeney/Striker/). Looking at the striker code it's pretty straightforward why your terminal stops echoing - the code tells the terminal to do so.

We start with looking ar "StrikerMonitor.py", https://github.com/SkyeSweeney/Striker/blob/master/StrikerMonitor.py:

  • the main entry point is in line 30, the main() function
  • main() function will call linuxcrt.set_curses_term() in line 34

We're now in the file "linuxcrt.py", https://github.com/SkyeSweeney/Striker/blob/master/linuxcrt.py:

  • in line 15-16, the file descriptor for standard input is acquired, and current terminal settings are read (into new_term)
  • then, the "CANONICAL" and "ECHO" bits are removed (tilde ~ operator) from the terminal settings in new_term in line 20. ==> Removing the "ECHO" bit causes your problem.
  • finally, the new settings are applied to the current terminal in set_curses_term() in line 28

You can test by just running this condensed python code, it causes the same behaviour:

>>> import sys, termios
>>> fd = sys.stdin.fileno()
>>> new_term = termios.tcgetattr(fd)
>>> new_term[3] = (new_term[3] & ~termios.ICANON & ~termios.ECHO)
>>> termios.tcsetattr(fd, termios.TCSAFLUSH, new_term)

However, I have no Idea why it should have worked before.

edit flag offensive delete publish link more

Comments

Man, thanks for the amazing answer!

Djbengan ( 2015-02-22 17:54:01 +0300 )edit

Question tools

Follow
1 follower

Stats

Asked: 2015-02-22 15:45:43 +0300

Seen: 242 times

Last updated: Feb 22 '15