Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some commands in dasharo_ectool fail #648

Closed
mkopec opened this issue Dec 21, 2023 · 8 comments
Closed

Some commands in dasharo_ectool fail #648

mkopec opened this issue Dec 21, 2023 · 8 comments
Assignees
Labels
bug Something isn't working novacustom_ns5x/7x_adl NovaCustom NS5x/7xPU (12th Gen) novacustom_ns5x/7x_tgl NovaCustom NS5x/7xMU (11th Gen) novacustom_nv4x_adl NovaCustom NV4xPZ (12th Gen) novacustom_nv4x_tgl NovaCustom NV4xMx (11th Gen)

Comments

@mkopec
Copy link
Member

mkopec commented Dec 21, 2023

Device

NovaCustom *

Dasharo version

v1.5.1 TGL, v1.7.1 ADL

Affected component(s) or functionality

dasharo_ectool

Brief summary

Running ie. dasharo_ectool fan 0 returns rust string parsing error

How reproducible

100%

How to reproduce

  • Boot into DTS
  • Run dasharo_ectool fan 0

Expected behavior

Command returns fan speed

Actual behavior

thread 'main' panicked at 'Must use `_os` lookups with `Arg::allow_invalid_utf8` at `[hash: 6BFD8DFE7A7242BC]`', /usr/src/debug/dasharo-ectool/0.3.8.AUTOINC+411fab9b7c-r0/cargo_home/bitbake/clap-3.2.23/src/parser/matches/arg_matches.rs:1854:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Screenshots

No response

Additional context

No response

Solutions you've tried

workaround:

echo -e '\x7' | sudo dd of=/dev/port bs=1B count=1 oflag=seek_bytes seek=$(( 0xe00 )) 2> /dev/null
sudo dd if=/dev/port bs=1B count=1 skip=$(( 0xe03 )) 2> /dev/null | xxd -ps

returns the raw PWM value for fan index 0

@mkopec mkopec added the bug Something isn't working label Dec 21, 2023
@BeataZdunczyk BeataZdunczyk added novacustom_nv4x_tgl NovaCustom NV4xMx (11th Gen) novacustom_ns5x/7x_adl NovaCustom NS5x/7xPU (12th Gen) novacustom_nv4x_adl NovaCustom NV4xPZ (12th Gen) novacustom_ns5x/7x_tgl NovaCustom NS5x/7xMU (11th Gen) labels Jan 9, 2024
@macpijan
Copy link
Contributor

still relevant?

@SebastianCzapla
Copy link
Contributor

SebastianCzapla commented Dec 13, 2024

v1.5.2 TGL nv41mz, booted DTS 2.1.0 via IPXE, and got almost identical error message:

thread 'main' panicked at /usr/src/debug/dasharo-ectool/0.3.8.AUTOINC+4ae73b9d2c/cargo_home/bitbake/clap-3.2.23/src/parser/matches/arg_matches.rs:1854:13:
Must use `_os` lookups with `Arg::allow_invalid_utf8` at `[hash: 6BFD8DFE7A7242BC]`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Appears when running dasharo_ectool fan 0, up to fan 255

@SebastianCzapla
Copy link
Contributor

In theory, fix should be simple. Within ectool source, in subcommand parsing, we should use value_of_os instead of value_of, when allowing invalid utf8, in the part where we acquire index of the fan.

        Some(("fan", sub_m)) => {
            let index = sub_m.value_of("index").unwrap().parse::<u8>().unwrap();
            let duty_opt = sub_m.value_of("duty").map(|x| x.parse::<u8>().unwrap());
            match duty_opt {
                Some(duty) => match unsafe { fan_set(&mut ec, index, duty) } {
                    Ok(()) => (),
                    Err(err) => {
                        eprintln!("failed to set fan {} to {}: {:X?}", index, duty, err);
                        process::exit(1);
                    },
                },
                None => match unsafe { fan_get(&mut ec, index) } {
                    Ok(()) => (),
                    Err(err) => {
                        eprintln!("failed to get fan {}: {:X?}", index, err);
                        process::exit(1);
                    },
                },
            }
        },

@macpijan
Copy link
Contributor

Care to try it out and report back here whether theory works in practice?

@SebastianCzapla
Copy link
Contributor

I will give it a shot, but I need to familiarize myself with rust/ectool buildinging first.

@macpijan
Copy link
Contributor

should be simply cargo build but if it takes too much time we can schedule it later as well

@SebastianCzapla
Copy link
Contributor

root@DasharoToolsSuite:~# /mnt/dasharo_ectool fan 0
58
root@DasharoToolsSuite:~# /mnt/dasharo_ectool fan 0
58
root@DasharoToolsSuite:~# /mnt/dasharo_ectool fan 0
255
root@DasharoToolsSuite:~# /mnt/dasharo_ectool fan 0
255
root@DasharoToolsSuite:~# /mnt/dasharo_ectool fan 0
255
root@DasharoToolsSuite:~# 

58 was shown during normal operation, 255 when setting fan turbo mode [fn +1]

Dasharo/ec#65

@mkopec
Copy link
Member Author

mkopec commented Dec 13, 2024

Resolved by Dasharo/ec#65

@mkopec mkopec closed this as completed Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working novacustom_ns5x/7x_adl NovaCustom NS5x/7xPU (12th Gen) novacustom_ns5x/7x_tgl NovaCustom NS5x/7xMU (11th Gen) novacustom_nv4x_adl NovaCustom NV4xPZ (12th Gen) novacustom_nv4x_tgl NovaCustom NV4xMx (11th Gen)
Projects
None yet
Development

No branches or pull requests

4 participants