Note: This crate is specific to ChromeOS and requires the native libfeatures_c library at link time.
featured-rs
is a Rust wrapper for libfeatures_c. This library is used to interact with Featured to check which features are currently enabled.
You can also execute cargo
directly for faster build and tests. This would be useful when you are developing this crate. Since this crate depends on libfeatures_c.so, you need to install it to host environment first.
# Install libfeatures_c.so to host. (chroot)$ sudo emerge chromeos-base/featured # Build (chroot)$ cargo build # Unit tests (chroot)$ cargo test
The build script, build_buildings.sh
, generates bindings to ../c_feature_library.h
. Whenever breaking changes are made to ../c_featured_library.h
, this build script must be rerun to generate new bindings to the C library.
First, you need to make sure you have deployed featured
to your DUT. You may also need to deploy libchrome
and libbrillo
to have the examples run properly.
(chroot)$ cros deploy ${DUT_IP} chromeos-base/featured
Second, you need to build them and copy them over to your device.
(chroot)$ cargo build --release --examples (chroot)$ scp target/release/examples/*feature_check $DUT:/usr/local/bin
To run them on your DUT:
(DUT)$ feature_check (DUT)$ fake_feature_check