roysten / rust-framebuffer Goto Github PK
View Code? Open in Web Editor NEWBasic framebuffer abstraction for Rust
License: Do What The F*ck You Want To Public License
Basic framebuffer abstraction for Rust
License: Do What The F*ck You Want To Public License
I should probably define the constants as the c_ulong
type, to enable compilation on both 64 and 32 bit systems.
Hello! Can you please document what license this code is released under?
When I run the rust-logo
example, it failed with this error message:
❯ sudo cargo run --example rust-logo
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/examples/rust-logo`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: FramebufferError { kind: IoctlFailed, details: "Ioctl returned -1: Inappropriate ioctl for device" }', examples/rust-logo/main.rs:18:56
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Source Line:
18 │ let _ = Framebuffer::set_kd_mode(KdMode::Graphics).unwrap();
And backtrace:
❯ sudo RUST_BACKTRACE=1 cargo run --example rust-logo
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/rust-logo`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: FramebufferError { kind: IoctlFailed, details: "Ioctl returned -1: Inappropriate ioctl for device" }', examples/rust-logo/main.rs:18:56
stack backtrace:
0: rust_begin_unwind
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
1: core::panicking::panic_fmt
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
2: core::result::unwrap_failed
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1651:5
3: core::result::Result<T,E>::unwrap
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1076:23
4: rust_logo::main
at ./examples/rust-logo/main.rs:18:13
5: core::ops::function::FnOnce::call_once
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
I knows only a little about fbdev and IDW why the problem occurs and how to fix it. Much appreciate if you could help :)
Instead should take AsRef<Path>
.
This should be a backwards compatible change.
Without this, I have to convert my path to a &str before giving it to the function.
Same concept is implemented in std::fs::File::open
.
Is there a reason for the Framebuffer struct to not implement the Debug
trait? I want to store a Framebuffer
inside a struct which implements Debug
, but this results in an error. I don't think I can implement this trait on Framebuffer
in my own project.
I checked the File
and Mmap
structs which Framebuffer
uses and they both implement Debug
, so there should not be an issue to do the same for Framebuffer
, right?
Apparently the values in var_screen_info and fix_screen_info differ among drivers. Could you please post the driver you are using and the debug output from the two structs?
let fb = Framebuffer::new("/dev/fb0");
println!("{:?} {:?}", fb.var_screen_info, fb.fix_screen_info);
Thanks!
--Not needed anymore!--
Line 87 of starfield/main.rs sets self.x
to a random float between -wh
and wh
which could include the value 0. Line 89 divides self.b
by that number, which could result in a divide by zero.
Hi,
I don't have required rust configuration on my current computer, so i can't execute examples given for this library.
Can you show what the output would looks like?
Regards,
PE
Compiling on a x86 computer for an arm target :
cargo build --release --example rust-logo --target arm-unknown-linux-gnueabi
The error is :
# ./rust-logo
./rust-logo: /lib/libc.so.6: version `GLIBC_2.28' not found (required by ./rust-logo)
./rust-logo: /lib/libc.so.6: version `GLIBC_2.18' not found (required by ./rust-logo)
./rust-logo: /lib/libc.so.6: version `GLIBC_2.33' not found (required by ./rust-logo)
./rust-logo: /lib/libc.so.6: version `GLIBC_2.32' not found (required by ./rust-logo)
./rust-logo: /lib/libc.so.6: version `GLIBC_2.34' not found (required by ./rust-logo)
This is because the target linux system is an "old" linux which I can't upgrade : https://linux-sunxi.org/Bookeen_Cybook_Muse
I tried to build with musleabi to avoid the dependency on libc6 :
cargo build --release --example rust-logo --target armv7-unknown-linux-musleabi
with config :
cat ~/.cargo/config.toml
[target.armv7-unknown-linux-musleabi]
linker = "/home/arthur/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/rust-lld"
This works for a "Hello World" rust binary, but doesn't for rust-framebuffer :
The result is :
# ./rust-logo
thread 'main' panicked at examples/rust-logo/main.rs:15:61:
called `Result::unwrap()` on an `Err` value: BmpError { kind: BmpIoError(Os { code: 2, kind: NotFound, message: "No such file or directory" }), details: "BMP Error: Io Error" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
# RUST_BACKTRACE=1 ./rust-logo
thread 'main' panicked at examples/rust-logo/main.rs:15:61:
called `Result::unwrap()` on an `Err` value: BmpError { kind: BmpIoError(Os { code: 2, kind: NotFound, message: "No such file or directory" }), details: "BMP Error: Io Error" }
stack backtrace:
0: rust_begin_unwind
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
1: core::panicking::panic_fmt
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
2: core::result::unwrap_failed
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
3: rust_logo::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.