efernau / rot8

screen rotation daemon
MIT License
111 stars 27 forks source link

Panic on backend #19

Closed phodina closed 2 years ago

phodina commented 3 years ago

Hi, thanks for awesome crate. However, I ran it on my desktop machine with GDM running under X11 and I got panic. Seems there are some unwrap calls when querying the backend.

FYI I'm packaging this crate for Guix.

$ RUST_BACKTRACE=1 /gnu/store/rwbscw79gmc5bn1zdxxkwjszfpgzmqsh-rust-rot8-0.1.3/bin/rot8 
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:134:40
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: rot8::main
  10: std::rt::lang_start::{{closure}}
  11: std::rt::lang_start_internal
  12: main
  13: __libc_start_main
  14: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
efernau commented 3 years ago

Hi,

thanks for the Guix package!

Can't reproduce your error at the moment. The error points to an unwrap at line 134, here we do a "pidof sway" command. Is this the problem? But the error text NotFound, message: "No such file or directory" makes me think otherwise. Do you have an accelerometer device with path "/sys/bus/iio/devices/iio:device/inaccel_raw"?

ghost commented 2 years ago

Hiya! I am also having this error. I do not have any path that begins with /sys/bus/iio/. I'm on Void linux musl using 1.3. My backtrace is this

$ RUST_BACKTRACE=full rot8 --display LVDS-1
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:295:57
stack backtrace:
   0:     0x556208cf8483 - <unknown>
   1:     0x556208d1c42c - <unknown>
   2:     0x556208cf4b15 - <unknown>
   3:     0x556208cf9d78 - <unknown>
   4:     0x556208cf99a5 - <unknown>
   5:     0x556208cfa3a6 - <unknown>
   6:     0x556208cfa287 - <unknown>
   7:     0x556208cf8934 - <unknown>
   8:     0x556208cf9fa9 - <unknown>
   9:     0x556208be79d3 - <unknown>
  10:     0x556208be7ac3 - <unknown>
  11:     0x556208bf6182 - <unknown>
  12:     0x556208bee616 - <unknown>
  13:     0x556208bf7b42 - <unknown>
  14:     0x556208cf0051 - <unknown>
  15:     0x556208bf6d02 - <unknown>
  16:     0x7f399f20b70a - libc_start_main_stage2
                               at ./src/env/__libc_start_main.c:94:2
efernau commented 2 years ago

Hey,

normally the accelerometer are exposed in the sys file system, exported via the /sys directory.

Each sensor device is exposed as a subdirectory of /sys/bus/iio/devices with a name following the scheme iio:device where is the numeric index of the device.

Are you sure you have an accelerometer? which kernel do you use uname -r Do you have IIO module in your kernel? Maybe this helps: Linux kernel sysfs IIO devices Maybe you need a packet like this: iio-sensor-proxy

ghost commented 2 years ago

No, I'm not sure that I have an accelerometer but I do know that previous releases of this laptop do include one. I'm using 5.18.9, the Void build is called 5.18.9_1. Using lsmod and cat /proc/modules, it does not appear that I have the iio module enabled. Going to try iio-sensor-proxy and enable the module. I'll update with the result.