You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does it matter what we set this arg for an input line? If not, can we get a short note in the docs that it doesn't matter. Maybe have it be an Option<u8> that can be set to None?
The text was updated successfully, but these errors were encountered:
tal-zvon
changed the title
Does Line.request()
Does Line.request() matter for Input lines?
Feb 25, 2021
tal-zvon
changed the title
Does Line.request() matter for Input lines?
Does Line.request()'s default arg matter for Input lines?
Feb 25, 2021
* @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set for a requested
* line, this specifies the default output value, should be 0 (low) or
* 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
if (lflags&GPIOHANDLE_REQUEST_OUTPUT) {
intval= !!handlereq.default_values[i];
ret=gpiod_direction_output(desc, val);
if (ret)
goto out_free_lh;
} elseif (lflags&GPIOHANDLE_REQUEST_INPUT) {
ret=gpiod_direction_input(desc);
if (ret)
goto out_free_lh;
}
You can see that for REQUEST_OUTPUT, the value from default_values[i] (which is the default arg in Rust code) is passed to gpiod_direction_output() to actually set the mode to output and the default state.
For REQUEST_INPUT however, default_values[i] is not used. (It's not used anywhere else in that function.)
I think a short note in the doc to say it only applies for outputs would make sense. Changing it to Option<u8> would just add unnecessary complexity, IMO.
Does it matter what we set this arg for an input line? If not, can we get a short note in the docs that it doesn't matter. Maybe have it be an
Option<u8>
that can be set toNone
?The text was updated successfully, but these errors were encountered: