-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS offline Linux - tty forwarding to xterm.js #172
Comments
If I get some free time I will take a look at this, but I believe you can hide the textarea using CSS 3 and then redirect the serial output to the xtermjs. You would have to hook the serial interface API which I think is documented under the project. This would mean the kernel would have to have serial TTY support built in along with the kernel flags at boot indicating to use a serial console. |
I managed to run FreeDOS offline on iOS by using v86 and DraftCode. |
This is a good idea. It would also be nice to have this feature for the keyboard input (#105), which would entail porting the keyboard handling from xtermjs to |
You can use any browser with GoCoEdit - v86 is the fastest performing in Chrome.
I used this attribute before I wrote my first post. Problem is that characters can only be written in lowercase letters and the some vim shortcuts are not supported. I use a bluetooth keyboard and have tested that in conjunction with xterm.js these problems do not occur. The perfect solution (after loading the system) would be to open xterm. js in the full window. This could be a very interesting and comprehensive solution, because Apple does not allow for virtualization in its store. |
Hi @copy, I am looking into it now. I am feeling better after some sick time I needed. I will try to visit as much of this as possible tonight and try to get a sample on GitHub later this week. I am thinking that redirecting the serial output/input is the best route with the appropriate kernel; however, I will look at the screen output and keyboard redirect. However, as always work comes first (just got a new job). Update: It might be easy to create a separate add-on to xterm.js similar to their web socket ones such as https://github.com/sourcelair/xterm.js/blob/v3/src/addons/terminado/terminado.js and instead hook it to the existing API functions. Thoughts? |
Sounds good. |
Any new info? |
Hi @jaromaz, Sorry not at this time. I have been super busy at work. |
I pushed a fix for the phone keyboard, I'll make a release tonight. Integration of xterm for the terminal would still be nice, I'll leave this issue open for that. |
I might be missing something, but the following seems to work perfectly with xterm.js: <!doctype html>
<title>Serial example with xterm.js</title>
<!-- run `npm install xterm` first to get these -->
<link rel="stylesheet" href="../node_modules/xterm/dist/xterm.css" />
<script src="../node_modules/xterm/dist/xterm.js"></script>
<!-- display for xterm.js -->
<div id="terminal"></div>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = () => {
var emulator = new V86Starter({
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
cdrom: {
url: "../images/linux.iso",
},
autostart: true,
disable_keyboard: true
});
var term = window.term = new Terminal();
term.open(document.getElementById('terminal'));
// Wire input events from xterm.js -> ttyS0
term.on('key', key => emulator.serial0_send(key));
// Wire output events from ttyS0 -> xterm.js
emulator.add_listener("serial0-output-char", (char) => term.write(char));
};
</script> |
Continuing the discussion from #210, now that I have In Linux I can change the terminal size with So I need a way to manage this. One thought would be to have 2 serial connections (or hijack the existing Anyone got advice here? How should I handle this? Using |
I would try xterm.js's auto-resizing plugin, combined with one of these hacks. From a quick glance, xterm.js supports these ANSI escapes, so something like this should work: res() {
old=$(stty -g)
stty raw -echo min 0 time 5
printf '\0337\033[r\033[999;999H\033[6n\0338' > /dev/tty
IFS='[;R' read -r _ rows cols _ < /dev/tty
stty "$old"
# echo "cols:$cols"
# echo "rows:$rows"
stty cols "$cols" rows "$rows"
}
trap res DEBUG |
Busybox doesn't seem to work with this hack. I'll have to do some more research. Also, the xterm |
There's xterm.js support now, see #203 (comment). |
I managed to run Linux 3 offline on iOS by using your v86 Project and the web server included in GoCoEdit app. Unfortunately, keyboard operation is not working properly. However, it is working properly at https://xtermjs.org. Can you redirect the tty to xterm.js instead of textarea?
The text was updated successfully, but these errors were encountered: