tock / libtock-rs

Rust userland library for Tock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why does to_result() in libtock-rs/platform/src/command_return.rs return BADRVAL for a driver check?

potto216 opened this issue · comments

In the discussion this was determined to be a bug which I will submit a PR for. The details are:

Discussed in #441

Originally posted by potto216 December 14, 2022
When performing a driver check with Console, Alarm, etc .is_success() and .raw_values()
return correct values but I don't understand .to_result()'s meaning

The three methods are located in libtock-rs/apis/console/src/lib.rs

For example for Console

S::command(DRIVER_NUM, command::DRIVER_CHECK, 0, 0).is_success()

returns true

and

S::command(DRIVER_NUM, command::DRIVER_CHECK, 0, 0).raw_values()
returns
ReturnVariant(128), r1 = 0, r2 = 0, r3 = 0
where pub const SUCCESS: ReturnVariant = ReturnVariant(128);

But
S::command(DRIVER_NUM, command::DRIVER_CHECK, 0, 0).to_result()

returns
BADRVAL

Is this expected? I would think this is indicating an error.