Skip to content

Commit c0019a7

Browse files
kotborealiskotborealis
kotborealis
authored andcommitted
fix: io devices
1 parent 4d8163d commit c0019a7

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/wasi-experimental-io-devices/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ maintenance = { status = "experimental" }
1515

1616
[dependencies]
1717
wasmer-wasi = { version = "=3.2.0-alpha.1", path = "../wasi", default-features=false }
18+
wasmer-wasi-types = { path = "../wasi-types", version = "=3.2.0-alpha.1" }
1819
tracing = "0.1"
1920
minifb = { version = "0.23", optional = true }
2021
nix = "0.25.0"
@@ -30,7 +31,7 @@ enable-serde = [
3031
"wasmer-wasi/enable-serde"
3132
]
3233
# This feature exists, so that "cargo build --all" doesn't
33-
# accidentally link libxcbcommon and libwayland into the CLI
34+
# accidentally link libxcbcommon and libwayland into the CLI
3435
# libraries. When using wasi-experimental-io-devices, users
3536
# have to enable this feature manually
3637
link_external_libs = [

lib/wasi-experimental-io-devices/src/link-ext.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use wasmer_wasi::{
1010
WasiInodes,
1111
};
1212
use wasmer_wasi::{Fd, VirtualFile, WasiFs, WasiFsError, ALL_RIGHTS, VIRTUAL_ROOT_FD};
13+
use wasmer_wasi_types::wasi::{Fdflags};
1314

1415
use minifb::{Key, KeyRepeat, MouseButton, Scale, Window, WindowOptions};
1516

@@ -96,7 +97,7 @@ impl FrameBufferState {
9697
return None;
9798
}
9899
self.x_size = x;
99-
self.y_size = x;
100+
self.y_size = y;
100101

101102
self.data_1.resize((x * y) as usize, 0);
102103
self.data_2.resize((x * y) as usize, 0);
@@ -126,7 +127,7 @@ impl FrameBufferState {
126127
self.push_input_event(InputEvent::KeyRelease(key))?;
127128
}
128129
}
129-
let keys = self.window.get_keys_pressed(KeyRepeat::No)?;
130+
let keys = self.window.get_keys_pressed(KeyRepeat::No);
130131
for key in keys {
131132
self.keys_pressed.insert(key);
132133
self.push_input_event(InputEvent::KeyPress(key))?;
@@ -456,7 +457,7 @@ pub fn initialize(inodes: &mut WasiInodes, fs: &mut WasiFs) -> Result<(), String
456457
"_wasmer/dev/fb0".to_string(),
457458
ALL_RIGHTS,
458459
ALL_RIGHTS,
459-
0,
460+
Fdflags::empty(),
460461
)
461462
.map_err(|e| format!("fb: Failed to create dev folder {:?}", e))?
462463
};
@@ -470,7 +471,7 @@ pub fn initialize(inodes: &mut WasiInodes, fs: &mut WasiFs) -> Result<(), String
470471
"input".to_string(),
471472
ALL_RIGHTS,
472473
ALL_RIGHTS,
473-
0,
474+
Fdflags::empty(),
474475
)
475476
.map_err(|e| format!("fb: Failed to init framebuffer {:?}", e))?;
476477

@@ -485,7 +486,7 @@ pub fn initialize(inodes: &mut WasiInodes, fs: &mut WasiFs) -> Result<(), String
485486
"fb".to_string(),
486487
ALL_RIGHTS,
487488
ALL_RIGHTS,
488-
0,
489+
Fdflags::empty(),
489490
)
490491
.map_err(|e| format!("fb: Failed to init framebuffer {:?}", e))?;
491492

@@ -500,7 +501,7 @@ pub fn initialize(inodes: &mut WasiInodes, fs: &mut WasiFs) -> Result<(), String
500501
"virtual_size".to_string(),
501502
ALL_RIGHTS,
502503
ALL_RIGHTS,
503-
0,
504+
Fdflags::empty(),
504505
)
505506
.map_err(|e| format!("fb_resolution: Failed to init framebuffer {:?}", e))?;
506507

@@ -515,7 +516,7 @@ pub fn initialize(inodes: &mut WasiInodes, fs: &mut WasiFs) -> Result<(), String
515516
"draw".to_string(),
516517
ALL_RIGHTS,
517518
ALL_RIGHTS,
518-
0,
519+
Fdflags::empty(),
519520
)
520521
.map_err(|e| format!("fb_index_display: Failed to init framebuffer {:?}", e))?;
521522

0 commit comments

Comments
 (0)