FrameworkComputer / inputmodule-rs

Framework Laptop 16 Input Module SW/FW
MIT License
223 stars 24 forks source link

Thread 'main' panicked when trying to display a greyscale image #107

Open cyber199 opened 3 months ago

cyber199 commented 3 months ago

Trying out the LED modules and I get an issue when trying to show a greyscale image and I don't know if I'm encountering a bug or just being an idiot. It happens with both my own image and the examples found in this repo ("/res/greyscale.gif", "/res/stripe.gif", and "/res/stripe.png"). With RUST_BACKTRACE=full set I get the following:

$ ./Downloads/inputmodule-control_cli_linux led-matrix --image-gray ~/Pictures/greyscale.gif 

thread 'main' panicked at 'Write failed!: Custom { kind: TimedOut, error: "Operation timed out" }', inputmodule-control/src/inputmodule.rs:430:10
stack backtrace:
   0:     0x58f52d0b4ad0 - std::backtrace_rs::backtrace::libunwind::trace::ha9053a9a07ca49cb
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x58f52d0b4ad0 - std::backtrace_rs::backtrace::trace_unsynchronized::h9c2852a457ad564e
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x58f52d0b4ad0 - std::sys_common::backtrace::_print_fmt::h457936fbfaa0070f
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x58f52d0b4ad0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5779d7bf7f70cb0c
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x58f52d05501e - core::fmt::write::h5a4baaff1bcd3eb5
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/fmt/mod.rs:1232:17
   5:     0x58f52d090ae4 - std::io::Write::write_fmt::h4bc1f301cb9e9cce
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/io/mod.rs:1684:15
   6:     0x58f52d0b5fd7 - std::sys_common::backtrace::_print::h5fcdc36060f177e8
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x58f52d0b5fd7 - std::sys_common::backtrace::print::h54ca9458b876c8bf
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x58f52d0b5d75 - std::panicking::default_hook::{{closure}}::hbe471161c7664ed6
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:271:22
   9:     0x58f52d0b635a - std::panicking::default_hook::ha3500da57aa4ac4f
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:290:9
  10:     0x58f52d0b635a - std::panicking::rust_panic_with_hook::h50c09d000dc561d2
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:692:13
  11:     0x58f52d0b6184 - std::panicking::begin_panic_handler::{{closure}}::h9e2b2176e00e0d9c
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:583:13
  12:     0x58f52d0b60e6 - std::sys_common::backtrace::__rust_end_short_backtrace::h5739b8e512c09d02
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:150:18
  13:     0x58f52d0b60d1 - rust_begin_unwind
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
  14:     0x58f52cfb6d32 - core::panicking::panic_fmt::hf33a1475b4dc5c3e
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
  15:     0x58f52cfb70a2 - core::result::unwrap_failed::hdff5465d74574b44
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1750:5
  16:     0x58f52cfe887c - core::result::Result<T,E>::expect::h09ad2071d782a90c
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1047:23
  17:     0x58f52cfe887c - inputmodule_control::inputmodule::simple_cmd_port::h02da7342bdc230ca
                               at /home/runner/work/inputmodule-rs/inputmodule-rs/inputmodule-control/src/inputmodule.rs:429:5
  18:     0x58f52cfe887c - inputmodule_control::inputmodule::send_col::hd125100e375920d3
                               at /home/runner/work/inputmodule-rs/inputmodule-rs/inputmodule-control/src/inputmodule.rs:518:5
  19:     0x58f52cfe887c - inputmodule_control::inputmodule::display_gray_image_cmd::hece8238746f38c60
                               at /home/runner/work/inputmodule-rs/inputmodule-rs/inputmodule-control/src/inputmodule.rs:656:9
  20:     0x58f52cfe887c - inputmodule_control::inputmodule::serial_commands::haded42d84a5f6028
                               at /home/runner/work/inputmodule-rs/inputmodule-rs/inputmodule-control/src/inputmodule.rs:203:21
  21:     0x58f52cfef147 - inputmodule_control::main::hd73c270150b5884e
                               at /home/runner/work/inputmodule-rs/inputmodule-rs/inputmodule-control/src/main.rs:63:20
  22:     0x58f52cfd18c3 - core::ops::function::FnOnce::call_once::h60cafe144945ca54
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
  23:     0x58f52cfd18c3 - std::sys_common::backtrace::__rust_begin_short_backtrace::hf44eaa5f7d26e481
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:134:18
  24:     0x58f52d007789 - main
  25:     0x75a9dc229d90 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  26:     0x75a9dc229e40 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:392:3
  27:     0x58f52cfb9d55 - _start
  28:                0x0 - <unknown>

I am running Linux Mint 21.3, which I know isn't officially supported, but being based on Ubuntu Jammy I didn't think it would be a vast departure. Everything else I've tried works, including --image-bw, so I'm hoping the problem isn't with my machine.

Eddio0141 commented 2 months ago

Same problem here display_gray_image_cmd uses the SendCol for every column but after a few calls, it seems to panic with the time out error

Sleeping after each command sent would "fix" this, but I don't understand why sending few columns of data in a row is too much to handle

I was trying to create a black and white video playback feature by using the SendCol and CommitCols commands, but after about 5 or 6 of these commands invoked in a row, it times out and panics. Sleeping between the commands sent would let me get somewhere, but the video fps can't go above 10 because of this

I thought the USB 2.0 connection is the limit, but I guess its not? What's going on with this?

bkjohnson commented 1 month ago

I have the same problem on Ubuntu 22.04.

mb720 commented 1 month ago

I encountered a similar error on Arch Linux when running inputmodule-control --serial-dev /dev/ttyACM0 led-matrix --all-brightnesses.

Here's what I did:

  1. Install inputmodule-control from AUR
  2. sudo udevadm control --reload && sudo udevadm trigger
  3. RUST_BACKTRACE=full inputmodule-control --serial-dev /dev/ttyACM0 led-matrix --all-brightnesses

The error and stacktrace are:

thread 'main' panicked at inputmodule-control/src/inputmodule.rs:430:10:
Write failed!: Custom { kind: TimedOut, error: "Operation timed out" }
stack backtrace:
  0:     0x5bb58fa3b122 - std::backtrace_rs::backtrace::libunwind::trace::h1a07e5dba0da0cd2
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
  1:     0x5bb58fa3b122 - std::backtrace_rs::backtrace::trace_unsynchronized::h61b9b8394328c0bc
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
  2:     0x5bb58fa3b122 - std::sys_common::backtrace::_print_fmt::h1c5e18b460934cff
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:68:5
  3:     0x5bb58fa3b122 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1e1a1972118942ad
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:44:22
  4:     0x5bb58f925ceb - core::fmt::rt::Argument::fmt::h07af2b4071d536cd
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/fmt/rt.rs:165:63
  5:     0x5bb58f925ceb - core::fmt::write::hc090a2ffd6b28c4a
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/fmt/mod.rs:1157:21
  6:     0x5bb58fa15db2 - std::io::Write::write_fmt::h8898bac6ff039a23
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/io/mod.rs:1832:15
  7:     0x5bb58fa40459 - std::sys_common::backtrace::_print::h4e80c5803d4ee35b
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:47:5
  8:     0x5bb58fa40459 - std::sys_common::backtrace::print::ha96650907276675e
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:34:9
  9:     0x5bb58fa3fc7e - std::panicking::default_hook::{{closure}}::h215c2a0a8346e0e0
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:271:22
  10:     0x5bb58fa40ea4 - std::panicking::default_hook::h207342be97478370
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:298:9
  11:     0x5bb58fa40ea4 - std::panicking::rust_panic_with_hook::hac8bdceee1e4fe2c
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:795:13
  12:     0x5bb58fa407c2 - std::panicking::begin_panic_handler::{{closure}}::h00d785e82757ce3c
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:664:13
  13:     0x5bb58fa40719 - std::sys_common::backtrace::__rust_end_short_backtrace::h1628d957bcd06996
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x5bb58fa40706 - rust_begin_unwind
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
  15:     0x5bb58f83aa02 - core::panicking::panic_fmt::hdc63834ffaaefae5
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
  16:     0x5bb58f83ae55 - core::result::unwrap_failed::h82b551e0ff2b2176
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1654:5
  17:     0x5bb58f8756e3 - core::result::Result<T,E>::expect::hb72d3219b0180778
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1034:23
  18:     0x5bb58f8756e3 - inputmodule_control::inputmodule::simple_cmd_port::h0d7ec998a76e5072
                              at /usr/src/debug/inputmodule-control/inputmodule-rs-0.2.0/inputmodule-control/src/inputmodule.rs:429:5
  19:     0x5bb58f8756e3 - inputmodule_control::inputmodule::send_col::h945634c0f164cc46
                              at /usr/src/debug/inputmodule-control/inputmodule-rs-0.2.0/inputmodule-control/src/inputmodule.rs:518:5
  20:     0x5bb58f8756e3 - inputmodule_control::inputmodule::all_brightnesses_cmd::h56ac9181668a700d
                              at /usr/src/debug/inputmodule-control/inputmodule-rs-0.2.0/inputmodule-control/src/inputmodule.rs:543:9
  21:     0x5bb58f8756e3 - inputmodule_control::inputmodule::serial_commands::h0fb2f06f7f2778e4
                              at /usr/src/debug/inputmodule-control/inputmodule-rs-0.2.0/inputmodule-control/src/inputmodule.rs:193:21
  22:     0x5bb58f87f214 - inputmodule_control::main::h2ef305b83abfb911
                              at /usr/src/debug/inputmodule-control/inputmodule-rs-0.2.0/inputmodule-control/src/main.rs:63:20
  23:     0x5bb58f859946 - core::ops::function::FnOnce::call_once::hbcee2982b8497b48
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
  24:     0x5bb58f859946 - std::sys_common::backtrace::__rust_begin_short_backtrace::h982926f2f021e470
                              at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:155:18
  25:     0x5bb58f89979c - main
  26:     0x7129369a4c88 - <unknown>
  27:     0x7129369a4d4c - __libc_start_main
  28:     0x5bb58f8446a5 - _start
  29:                0x0 - <unknown>