Skip to content

Commit

Permalink
windows: Expose location_paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmehall committed Aug 10, 2024
1 parent 5afbb29 commit c295159
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ pub struct DeviceInfo {
#[cfg(target_os = "windows")]
pub(crate) instance_id: OsString,

#[cfg(target_os = "windows")]
pub(crate) location_paths: Vec<OsString>,

#[cfg(target_os = "windows")]
pub(crate) parent_instance_id: OsString,

Expand Down Expand Up @@ -122,6 +125,12 @@ impl DeviceInfo {
&self.instance_id
}

/// *(Windows-only)* Location paths property
#[cfg(target_os = "windows")]
pub fn location_paths(&self) -> &[OsString] {
&self.location_paths
}

/// *(Windows-only)* Instance ID path of the parent hub
#[cfg(target_os = "windows")]
pub fn parent_instance_id(&self) -> &OsStr {
Expand Down Expand Up @@ -312,6 +321,7 @@ impl std::fmt::Debug for DeviceInfo {
{
s.field("instance_id", &self.instance_id);
s.field("parent_instance_id", &self.parent_instance_id);
s.field("location_paths", &self.location_paths);
s.field("port_number", &self.port_number);
s.field("driver", &self.driver);
}
Expand Down
1 change: 1 addition & 0 deletions src/platform/windows_winusb/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ pub fn probe_device(devinst: DevInst) -> Option<DeviceInfo> {

Some(DeviceInfo {
instance_id,
location_paths,
parent_instance_id,
devinst,
port_number,
Expand Down

0 comments on commit c295159

Please sign in to comment.