Debian Codegraph @

crates/ddccontrol-db/README.md

raw symbols SCIP
1 # ddccontrol-db
2
3 `ddccontrol-db` parses the ddccontrol XML monitor database and exports the C ABI
4 used by `libddccontrol`.
5
6 CAPS string parsing lives in the sibling `ddccontrol-caps` crate.
7
8 ## C ABI Ownership
9
10 This crate deliberately preserves the existing C ABI while moving the XML
11 database parser to Rust.
12
13 Rust allocates returned C data with the process C allocator through `malloc`.
14 The C side must release that data with the matching ddccontrol free functions:
15
16 - VCP entries created by `ddccontrol_caps_parse` are owned by the caller's
17 `struct caps` and are released by the existing C caps cleanup paths.
18 - Monitor databases returned by `ddcci_create_db` must be released with
19 `ddcci_free_db`.
20
21 Do not allocate these structs with Rust-owned containers and expose their
22 internal pointers to C. Do not release Rust-created database structs with
23 anything other than the documented C cleanup function.
24
25 The Rust mirror structs are `#[repr(C)]`. Keep the Rust layout tests and the C
26 `test_abi_layout` test in sync with `src/lib/ddcci.h`, `src/lib/monitor_db.h`,
27 and `src/lib/monitor_db_internal.h`.
28
29 ## Compatibility Tests
30
31 The normal test suite includes a golden monitor database fixture under
32 `fixtures/compat-db`. To smoke-test a real `ddccontrol-db` checkout as well,
33 set `DDCCONTROL_DB_TEST_DATADIR` to either the checkout root or the `db`
34 directory that contains `options.xml` and `monitor/` before running
35 `cargo test`.
36
37 By default the real database test loads the first 25 monitor profiles in sorted
38 order. Set `DDCCONTROL_DB_TEST_PROFILES` to a comma-separated profile list to
39 select specific profiles.