Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "IOKit-sys"
version = "0.1.5"
version = "0.2.0"
authors = ["David Cuddeback <david.cuddeback@gmail.com>"]
description = "FFI bindings for IOKit"
license = "MIT"
Expand All @@ -15,4 +15,4 @@ build = "build.rs"
[dependencies]
libc = "0.2"
mach = "0.1.1"
CoreFoundation-sys = "0.1.4"
core-foundation = "0.6.3"
8 changes: 4 additions & 4 deletions examples/list_serial_ports.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate IOKit_sys;
extern crate CoreFoundation_sys as cf;
extern crate core_foundation as cf;
extern crate libc;
extern crate mach;

Expand All @@ -14,7 +14,7 @@ use mach::port::{mach_port_t,MACH_PORT_NULL};
use mach::kern_return::KERN_SUCCESS;

use IOKit_sys::*;
use cf::*;
use cf::{base::*, string::*, dictionary::*};


fn main() {
Expand Down Expand Up @@ -64,15 +64,15 @@ fn main() {

let result = IORegistryEntryCreateCFProperties(modem_service, &mut props, kCFAllocatorDefault, 0);
if result == KERN_SUCCESS {
CFDictionaryApplyFunction(props, print_property_entry, ptr::null());
CFDictionaryApplyFunction(props, print_property_entry, ptr::null_mut());
}

IOObjectRelease(modem_service);
}
}
}

extern "C" fn print_property_entry(key: CFTypeRef, value: CFTypeRef, _context: *const c_void) {
extern "C" fn print_property_entry(key: CFTypeRef, value: CFTypeRef, _context: *mut c_void) {
unsafe {
let mut buf = Vec::<c_char>::with_capacity(256);

Expand Down
2 changes: 1 addition & 1 deletion src/io_hid_base.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// exports from <IOKit/hid/IOHIDBase.h>

use libc::c_void;
use cf::CFIndex;
use cf::base::CFIndex;
use io_return::IOReturn;
use io_hid_keys::IOHIDReportType;

Expand Down
2 changes: 1 addition & 1 deletion src/io_hid_manager.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// exports from <IOKit/hid/IOHIDManager.h>

use libc::c_void;
use cf::{CFAllocatorRef, CFDictionaryRef};
use cf::{base::CFAllocatorRef, dictionary::CFDictionaryRef};
use types::IOOptionBits;
use io_return::IOReturn;
use io_hid_base::{IOHIDDeviceCallback, IOHIDReportCallback};
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![allow(non_camel_case_types,non_upper_case_globals,non_snake_case)]

extern crate CoreFoundation_sys as cf;
extern crate core_foundation as cf;
extern crate libc;
extern crate mach;

use cf::{CFTypeRef,CFDictionaryRef,CFMutableDictionaryRef,CFStringRef,CFAllocatorRef};
use cf::{base::CFTypeRef,dictionary::CFDictionaryRef,dictionary::CFMutableDictionaryRef,string::CFStringRef,base::CFAllocatorRef};
use libc::{c_void,c_char,c_int,size_t,uintptr_t};

use mach::boolean::boolean_t;
Expand Down Expand Up @@ -38,7 +38,6 @@ mod io_hid_manager;
pub struct IONotificationPort {
__private: c_void,
}

pub type IONotificationPortRef = *mut IONotificationPort;

pub type IOServiceMatchingCallback = extern fn (refcon: *mut c_void, iterator: io_iterator_t);
Expand All @@ -63,6 +62,7 @@ extern "C" {

pub fn IONotificationPortCreate(masterPort: mach_port_t) -> IONotificationPortRef;
pub fn IONotificationPortDestroy(notify: IONotificationPortRef);
pub fn IONotificationPortGetRunLoopSource(notify: IONotificationPortRef) -> cf::runloop::CFRunLoopSourceRef;
pub fn IONotificationPortGetMachPort(notify: IONotificationPortRef) -> mach_port_t;

pub fn IOCreateReceivePort(msgType: u32, recvPort: *mut mach_port_t) -> kern_return_t;
Expand Down