Skip to content

Commit

Permalink
Move to a better maintained mach2 crate
Browse files Browse the repository at this point in the history
  • Loading branch information
haimgel committed Nov 5, 2024
1 parent 93d7602 commit 01f634e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ edition = "2021"

[dependencies]
core-foundation = "0.10"
core-foundation-sys = "^0.8"
core-graphics = "^0.24"
core-foundation-sys = "0.8"
core-graphics = "0.24"
# ddc must stay on "0.2" till ddc-hi is also updated
ddc = "0.2"
io-kit-sys = "0.4"
mach = "0.3"
thiserror = "1"
mach2 = "0.4"
thiserror = "1.0"

[dev-dependencies]
edid-rs = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion src/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use io_kit_sys::{
kIORegistryIterateRecursively, IORegistryEntryCreateCFProperty, IORegistryEntryGetName,
IORegistryEntryGetParentEntry, IORegistryEntryGetPath,
};
use mach::kern_return::KERN_SUCCESS;
use mach2::kern_return::KERN_SUCCESS;
use std::ffi::CStr;
use std::os::raw::{c_uint, c_void};
use std::time::Duration;
Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core_graphics::base::CGError;
use ddc::ErrorCode;
use io_kit_sys::ret::kIOReturnSuccess;
use mach::kern_return::{kern_return_t, KERN_FAILURE};
use mach2::kern_return::{kern_return_t, KERN_FAILURE};
use thiserror::Error;

/// An error that can occur during DDC/CI communication with a monitor
Expand All @@ -20,7 +20,7 @@ pub enum Error {
#[error("Service not found")]
ServiceNotFound,
/// Display location not found
#[error("Service not found")]
#[error("Display location not found")]
DisplayLocationNotFound,
}

Expand Down
2 changes: 1 addition & 1 deletion src/intel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use ddc::SUB_ADDRESS_DDC_CI;
use io_kit_sys::ret::kIOReturnSuccess;
use io_kit_sys::types::{io_service_t, IOItemCount};
use io_kit_sys::IORegistryEntryCreateCFProperties;
use mach::kern_return::KERN_FAILURE;
use mach2::kern_return::KERN_FAILURE;
use std::time::Duration;

pub(crate) fn execute<'a>(
Expand Down
2 changes: 1 addition & 1 deletion src/iokit/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use core_foundation::dictionary::CFDictionaryRef;
use core_graphics::display::CGDirectDisplayID;
use io_kit_sys::types::{io_service_t, IOOptionBits};
use mach::port::mach_port_t;
use mach2::port::mach_port_t;

pub const kIODisplayMatchingInfo: IOOptionBits = 0x00000100;
pub const kIODisplayOnlyPreferredName: IOOptionBits = 0x00000200;
Expand Down
2 changes: 1 addition & 1 deletion src/iokit/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
macro_rules! r#kern_try {
($expr:expr) => {
match $expr {
mach::kern_return::KERN_SUCCESS => (),
mach2::kern_return::KERN_SUCCESS => (),
err_code => return ::std::result::Result::Err(::std::io::Error::from_raw_os_error(err_code).into()),
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/iokit/io2c_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

/// Translation of IOKit/i2c/IOI2CInterface.h
extern crate io_kit_sys;
extern crate mach;
extern crate mach2;

use crate::iokit::wrappers::IoObject;
use io_kit_sys::ret::IOReturn;
use io_kit_sys::types::{io_service_t, IOItemCount, IOOptionBits};
use mach::vm_types::{mach_vm_address_t, mach_vm_size_t, vm_address_t};
use mach2::vm_types::{mach_vm_address_t, mach_vm_size_t, vm_address_t};
use std::os::raw::c_uint;

/// IOI2CRequest.sendTransactionType, IOI2CRequest.replyTransactionType
Expand Down

0 comments on commit 01f634e

Please sign in to comment.