1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 13:10:29 +03:00
mobile-nixos/boot/gui/lib/vtconsole.rb
2020-02-28 23:14:09 -05:00

23 lines
799 B
Ruby

module VTConsole
# Allows unmapping the "vtcon" console from the frame buffer
# This will ensure it doesn't trample on our lvgui.
def self.map_console(value)
# BAD HACK!
# This always tries to map/unmap the console from the framebuffer
# even when not using the framebuffer output! (Simulator)
# TODO: better introspection to allow the app to know it is running in a
# simulated environment.
begin
# We don't know which one(s) are running on the frame buffer.
Dir.glob("/sys/class/vtconsole/vtcon*").each do |dir|
# So we check...
if File.read(File.join(dir, "name")).strip.match(/frame buffer/)
# And only write to those.
File.write(File.join(dir, "bind"), value.to_s)
end
end
rescue
end
end
end