TTYescape: Difference between revisions
Start writing it! |
Finish documenting |
||
Line 16: | Line 16: | ||
"<i>But how will I type?</i>" you cry! "<i>for all I have is this pesky touchscreen</i>". Fear not dear user, for <code>fbkeyboard</code> is here to save you! | "<i>But how will I type?</i>" you cry! "<i>for all I have is this pesky touchscreen</i>". Fear not dear user, for <code>fbkeyboard</code> is here to save you! | ||
[https://github.com/bakonyiferenc/fbkeyboard fbkeyboard] is a tool for displaying a framebuffer keyboard on top of a TTY, it's both easy to use (simply tap the key you would like to press) and fun to look at with it's wonderful two-tone red and blue colour scheme. | |||
== Configuration == | == Configuration == | ||
Line 24: | Line 24: | ||
== Implementation == | == Implementation == | ||
TTYescape makes use of the aptly named tool <code>[ | TTYescape makes use of the aptly named tool <code>[https://github.com/wertarbyte/triggerhappy triggerhappy]</code>, a relatively simple daemon capable of listening directly to input events and performing specific actions on certain keypresses (or combinations thereof). See the linked README and the TTYescape trigger happy configuration for more details. | ||
On pressing {{button|Volume Down}} the <code>togglevt.sh</code> script is run with the argument "start", this creates the tempfile <code>/tmp/ttyescape.tmp</code> with the contents "1", releasing {{button|Volume Down}} deletes the file. Pressing {{button|Power}} will run the script with the argument "inc", causing the number in the tempfile to be incremented. If the number is equal to the value <code>PRESSCOUNT</code> set in the config file, the main body of the script is run, causing the user to switch TTYs, setting the font and launching fbkeyboard. | |||
No services need to be restarted when editing the ttyescape config, it is only read by the togglevt script which is only executed on button presses. | |||
== Security considerations == | |||
In order for this to work, both triggerhappy and the togglevt script must be run as root. It is important to ensure that their configuration files are only writable to root, otherwise it may be trivial for a user to gain root access via this tool. Absolutely zero security testing has been done on this tool, audit and use at your own discretion. | |||
== See Also == | |||
* {{MR|2309|pmaports}} - Merge request to add TTYescape to pmaports. | |||
* [https://github.com/bakonyiferenc/fbkeyboard fbkeyboard] - fbkeyboard source and docs | |||
* [https://github.com/wertarbyte/triggerhappy triggerhappy] - triggerhappy source and docs |
Revision as of 13:02, 8 August 2021
TTYescape - because mobile users can be hackers too
TTYescape is a collection of config files and a shell script enabling mobile users to escape the mortal limitations of "Desktop Environments" and "hardware acceleration", ascending to the one TRUE form of computer usage - the TTY.
[ Extract from pmaports!2309 ]
One of the largest limitations with a mobile device is the lack of keyboard, for mainstream OSs like Android and iOS, this is a non-issue as the whole OS stack is built to automatically recover in case of a crash / hang, hiding the internal state of affairs from users and making use of careful design to minimise the impact.
When bringing Linux to mobile, we carry not only the benefits of the Linux desktop but also it's limitations. In the event that your display manager goes haywire or hangs completely, or your graphics drivers get unhappy, the ability to quickly jump to a tty and start killing bad behaving programs or reset your display manager is one that most of us take for granted. But when hit by similar errors on a mobile device there is no such recourse available, users either have to reboot and hope that the issue doesn't occur again, or pull out a laptop and pull up a shell (assuming ssh is enabled and the rndis interface comes up).
Usage
TTYescape works by monitoring all input events on the system, if at any time you hold
and press three times you'll be quickly whisked away from the madness and dropped in TTY2."But how will I type?" you cry! "for all I have is this pesky touchscreen". Fear not dear user, for fbkeyboard
is here to save you!
fbkeyboard is a tool for displaying a framebuffer keyboard on top of a TTY, it's both easy to use (simply tap the key you would like to press) and fun to look at with it's wonderful two-tone red and blue colour scheme.
Configuration
TTYescape is configured by editing the file /etc/conf.d/ttyescape.conf
, currently it's possible to modify the font used in the TTY, adjust the number of times you have to press to switch to a TTY, and change the path to the tempfile used to count button presses.
Implementation
TTYescape makes use of the aptly named tool triggerhappy
, a relatively simple daemon capable of listening directly to input events and performing specific actions on certain keypresses (or combinations thereof). See the linked README and the TTYescape trigger happy configuration for more details.
On pressing togglevt.sh
script is run with the argument "start", this creates the tempfile /tmp/ttyescape.tmp
with the contents "1", releasing deletes the file. Pressing will run the script with the argument "inc", causing the number in the tempfile to be incremented. If the number is equal to the value PRESSCOUNT
set in the config file, the main body of the script is run, causing the user to switch TTYs, setting the font and launching fbkeyboard.
No services need to be restarted when editing the ttyescape config, it is only read by the togglevt script which is only executed on button presses.
Security considerations
In order for this to work, both triggerhappy and the togglevt script must be run as root. It is important to ensure that their configuration files are only writable to root, otherwise it may be trivial for a user to gain root access via this tool. Absolutely zero security testing has been done on this tool, audit and use at your own discretion.
See Also
- pmaports!2309 - Merge request to add TTYescape to pmaports.
- fbkeyboard - fbkeyboard source and docs
- triggerhappy - triggerhappy source and docs