Skip to content
Snippets Groups Projects
Verified Commit d038cfea authored by Anhad Singh's avatar Anhad Singh :crab:
Browse files

init: set the `DISPLAY` environment variable to the VT#

parent b9ea46e2
No related branches found
Tags 4.0.3
No related merge requests found
......@@ -78,35 +78,7 @@ pub fn run(file: &Path) -> Result<()> {
println!("init: failed to run: no argument");
},
"run.d" => if let Some(new_dir) = args.next() {
// On startup, the VESA display driver is started which basically makes use of the framebuffer
// provided by the firmware. The GPU device are latter started by `pcid` (such as `virtio-gpu`).
let mut devices = vec![];
let schemes = std::fs::read_dir(":").unwrap();
for entry in schemes {
let path = entry.unwrap().path();
let path_str = path
.into_os_string()
.into_string()
.expect("init: failed to convert path to string");
if path_str.contains("display") {
println!("init: found display scheme {}", path_str);
devices.push(path_str);
}
}
let device = devices.iter().filter(|d| !d.contains("vesa")).collect::<Vec<_>>();
let device = if device.is_empty() {
// No GPU available, fallback to VESA display which *should* always be accessible.
"vesa"
} else {
// :/display/virtio-gpu
// ^^^^^^^^^^
device[0].split("/").nth(2).unwrap()
};
std::env::set_var("DISPLAY", &format!("display/{}:3/activate", device));
std::env::set_var("DISPLAY", "3");
let mut entries = vec![];
match read_dir(&new_dir) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment