mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
Virtual consoles kinda work!
We now make three VirtualConsoles at boot: tty0, tty1, and tty2. We launch an instance of /bin/sh in each one. You switch between them with Alt+1/2/3 How very very cool :^)
This commit is contained in:
parent
68739dc43e
commit
7a7956a595
24 changed files with 251 additions and 103 deletions
|
@ -11,15 +11,30 @@ TTY::~TTY()
|
|||
|
||||
ssize_t TTY::read(byte* buffer, size_t size)
|
||||
{
|
||||
return 0;
|
||||
ssize_t nread = min(m_buffer.size(), size);
|
||||
memcpy(buffer, m_buffer.data(), nread);
|
||||
if (nread == m_buffer.size())
|
||||
m_buffer.clear();
|
||||
else {
|
||||
dbgprintf("had %u, read %u\n", m_buffer.size(), nread);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
return nread;
|
||||
}
|
||||
|
||||
ssize_t TTY::write(const byte* buffer, size_t size)
|
||||
{
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
onTTYWrite(buffer[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TTY::hasDataAvailableForRead() const
|
||||
{
|
||||
return false;
|
||||
return !m_buffer.isEmpty();
|
||||
}
|
||||
|
||||
void TTY::emit(byte ch)
|
||||
{
|
||||
m_buffer.append(ch);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue