Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚾ Basic functionality #2

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open

⚾ Basic functionality #2

wants to merge 32 commits into from

Conversation

janie177
Copy link
Member

@janie177 janie177 commented Sep 4, 2024

This does a few things:

  1. Rebase on our open source rust template.
  2. Wrap some IGCL functionality so that we can init the library, enumerate devices and query some driver settings.

MarijnS95 and others added 24 commits May 25, 2023 11:33
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
…s/actions/checkout-4

Bump actions/checkout from 3 to 4
…when a process has no override configuration.
@janie177 janie177 marked this pull request as ready for review September 4, 2024 08:51
push:
pull_request:

jobs:
Copy link
Member

@MarijnS95 MarijnS95 Sep 4, 2024

Choose a reason for hiding this comment

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

We should add a job that runs api_gen and compares the output, like some (but not all) of our other bindings crates.

(In other words you can copy-paste the setup from one of the others we have!)

Cargo.lock Outdated Show resolved Hide resolved
```

```rust
// A code example
Copy link
Member

Choose a reason for hiding this comment

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

Let's fill this in.

src/device_adapter.rs Outdated Show resolved Hide resolved
src/device_adapter.rs Outdated Show resolved Hide resolved
Comment on lines +110 to +111
adapter_properties.Size = std::mem::size_of::<ctl_device_adapter_properties_t>() as u32;
adapter_properties.Version = 0;
Copy link
Member

Choose a reason for hiding this comment

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

FRU...

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@MarijnS95 MarijnS95 Sep 4, 2024

Choose a reason for hiding this comment

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

Field Record Update. Instead of your MaybeUninit assume_init() hack, something like:

let adapter_properties = ctl_device_adapter_properties_t {
    Size: std::mem::size_of::<ctl_device_adapter_properties_t>() as u32,
    Version: 0;
    ..Default::default() // or unsafe { mem::zeroed() }
};

// LUID is only available on windows.
#[cfg(target_os = "windows")]
let mut device_id = {
let luid_size = std::mem::size_of::<LUID>();
Copy link
Member

Choose a reason for hiding this comment

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

So we only use the Windows type to get the size? Why don't we store (and pass a pointer to) an instance of LUID?

Copy link
Member Author

Choose a reason for hiding this comment

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

Something to look into, to what extent we can unify the interfaces between platforms if multiple are supported. But it would also be an option to expose different types and functions depending on the platform of course. I suppose the caller would have to be aware either way to use the data sensibly.

src/lib.rs Outdated Show resolved Hide resolved
Comment on lines +126 to +127
#[cfg(not(target_os = "windows"))]
let device_id = vec![];
Copy link
Member

Choose a reason for hiding this comment

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

You can also wrap the existence of this item in the struct with cfg(windows).

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking about doing that, but I'm not sure what I prefer. I'm also not sure if this library even runs outside of Windows environments at all.

Copy link
Member

Choose a reason for hiding this comment

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

If we don't intend that we shouldn't have the cfgs 😉

(And instead have the cfg in our own crate to disable this dependency)

src/lib.rs Outdated
adapter_properties.device_id_size = luid_size as u32;
device_id
};
#[cfg(target_os = "windows")]
Copy link
Member

Choose a reason for hiding this comment

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

Everywhere: cfg(windows)?

Copy link
Member Author

Choose a reason for hiding this comment

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

We'll have to find a cleaner solution for this, but won't fix it now.

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean? It's just more common to use cfg(windows) over cfg(target_os = "windows").

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.

4 participants