Skip to content

feat: Support multiple devices per driver crate (Fixes #90)#160

Open
ANAVHEOBA wants to merge 1 commit into
tweedegolf:mainfrom
ANAVHEOBA:feature/issue-90-multi-device-support
Open

feat: Support multiple devices per driver crate (Fixes #90)#160
ANAVHEOBA wants to merge 1 commit into
tweedegolf:mainfrom
ANAVHEOBA:feature/issue-90-multi-device-support

Conversation

@ANAVHEOBA
Copy link
Copy Markdown

@ANAVHEOBA ANAVHEOBA commented Jan 30, 2026

  • Updated Driver struct to support a list of 'devices' alongside the legacy 'meta' field.
  • Updated FullCrate generation to produce one entry per device/chip.
  • Updated read-driver-db to aggregate devices from both fields.
  • Regenerated driver-db-schema.json.

Checklist

  • I agree that my contribution gets licensed under the MIT license, except for contributions to driver-db which
    get licensed under the CC0 license

- Updated Driver struct to support a list of 'devices' alongside the legacy 'meta' field.
- Updated FullCrate generation to produce one entry per device/chip.
- Updated read-driver-db to aggregate devices from both fields.
- Regenerated driver-db-schema.json.
Copy link
Copy Markdown
Member

@tdittr tdittr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for taking the time to look into this. Unfortunately I don't think this solves the problem.

Drivers will be listed multiple times, once per device instead of once with an aggregated view of manufacturers, etc. I suspect this will also need changes in the frontend part to show the new data (e. g. multiple manufacturers).

Or as an intermediate we could aggregate the multiple Meta sections into one when we export it to the frontend.

I would also prefer to just updating the existing driver descriptions, rather than having legacy support for the meta section.

Also please don't forget to tick the box to accept that your contribution will be licensed under MIT.

Comment on lines +96 to +106
for meta in metas {
// We clone krate for each device because it is consumed by FullCrate::new
let full = match FullCrate::new(&driver, meta, krate.clone()) {
Ok(full) => full,
Err(e) => {
eprintln!("Error creating full crate: {e}");
continue;
}
};
output.push(full);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds one copy of the whole driver to the listing. So then we will have drivers listed multiple times if they support multiple devices. I think the aggregation of the devices needs to happen later, maybe even in the frontend?

Comment thread backend/src/driver_db.rs
Comment on lines -17 to +21
pub meta: Meta,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub meta: Option<Meta>,
/// List of devices supported by this driver
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub devices: Vec<Meta>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather see meta be replaced by devices. Also for the existing drivers. I guess category will need to be pulled out from meta as it is not really specific to each device.

Comment thread backend/src/lib.rs
Comment on lines +50 to +51
driver_db: &Driver,
meta: driver_db::Meta,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is meta being passed separately when it is already part of driver_db?

Comment thread backend/src/lib.rs
Comment on lines +71 to +73
dev_boards: driver_db.dev_boards.clone(),
interfaces: driver_db.interfaces.clone(),
resources: driver_db.resources.clone(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it the .clone() needed?

Comment thread driver-db-schema.json
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the schema, however it looks like you updated it by hand. Could you just run cargo run --release --bin read-driver-db it should update it automatically from the Rust types.

Sorry for not documenting this better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants