Questions tagged [iokit]
The I/O Kit is a framework for driver development in the xnu Kernel which drives Apple's Mac OSX and iOS operating systems.
iokit
517
questions
34
votes
8
answers
9k
views
Private unique device identifier in iOS
We're working on a project with my colleagues which involves using a lot of private and non official code. This is not intended for AppStore use.
The first and only requirement we have is to not use ...
30
votes
5
answers
21k
views
IOKit Not found
So everything was fine, and then I decided to start developing on XCode 5 DP3 and iOS7
Prior to upgrading, my project compiled and ran fine on my iPhone 3GS (I made a little soft phone application); ...
28
votes
3
answers
26k
views
What is com.apple.Dont_Steal_Mac_OS_X
com.apple.Dont_Steal_Mac_OS_X is a IOResources provider...
Class Inheritance: Dont_Steal_Mac_OS_X : IOService : IORegistryEntry : OSObject
how does it work?
what does it do?
22
votes
3
answers
21k
views
Convert CFString to NSString - Swift
I'm trying to write a program that will scan for available serial ports and present them in a popup menu. Why can I not take the CFString straight from the IORegistryEntryCreateCFProperty() function ...
21
votes
4
answers
20k
views
How to create a program to list all the USB devices in a Mac?
I have a limited exposure to the Mac OS X operating system and now I have started using Xcode and am studying about I/O kit. I need to create a program in Xcode under command line tool in order to ...
21
votes
4
answers
13k
views
Where can I systematically study how to write Mac OS X device drivers? [closed]
I'm looking for an exhaustive, university-level book or guide to study in order to
gain the ability of writing Mac OS X device drivers. I'm totally ignorant on this OS, but I'm already skilled on ...
17
votes
2
answers
14k
views
gdb | view the variable argument list
I as using the bt command to view the stacktrace. The output is
(gdb) bt
#0 0x001ae4cd in Debugger (message=0x1 "???\a") at /SourceCache/xnu/xnu-1228.7.58/osfmk/i386/AT386/model_dep.c:705
#1 ...
15
votes
4
answers
4k
views
CGDisplayIOServicePort is deprecated in OS X >= 10.9, how to replace?
I did small app to allow quickly change screen resolutions on multiple monitors. I want to show product name as title of the monitor, and it's very simple to find using this code:
NSDictionary *...
15
votes
2
answers
880
views
Sending MCCS commands on Cocoa
I am trying to write a simple Cocoa App for the Mac for one simple purpose: switching my Dell monitor input to another one (so I can switch between PC and MAC). I already found an application for ...
14
votes
3
answers
21k
views
How to get CPU temperature and fan speed on OS X?
How do I get CPU temperature and fan speeds in OS X?
I understand that information is obtained from IOHWSensor in IOKit, but I'm unable to find any reliable information on how to exactly do that....
13
votes
6
answers
15k
views
How to get monitor EDID in OS X?
I'm looking to pull the EDID information in OS X / macOS?
It looks like it's stored in the IORegistry. Is there a way to access it with the current monomac libraries? Can I do it with standard interop ...
12
votes
5
answers
4k
views
How to resolve CGDirectDisplayID changing issues on newer multi-GPU Apple laptops in Core Foundation/IO Kit?
In Mac OS X, every display gets a unique CGDirectDisplayID number assigned to it. You can use CGGetActiveDisplayList() or [NSScreen screens] to access them, among others. Per Apple's docs:
A ...
11
votes
4
answers
8k
views
Disable ambient-light sensor screen dimming programmatically on OS X
I've been digging around in the kernel code repo for days, but I just can't find this anywhere.
I want to disable/enable/detect the state of the ambient-light sensor based screen dimming that many of ...
11
votes
2
answers
633
views
Detecting if Mac has a backlit keyboard
It’s quite easy to detect if Mac has an illuminated keyboard with ioreg at the command line:
ioreg -c IOResources -d 3 | grep '"KeyboardBacklight" =' | sed 's/^.*= //g'
But how can I ...
11
votes
3
answers
2k
views
How do I lower the amount of memory IOKit reserves at process start up?
I am a developer working on a very large, memory intensive 32bit application. Running out of virtual address space (memory) is a problem for us. During my investigation of some recent issues I ...
11
votes
2
answers
2k
views
OSX - disabling system-wide touch gestures
I need to programmatically disable/suppress system-wide touch gestures on Mac OS. I'm referring to gestures such as the 4-finger swipe between spaces, etc.
I've looked to EventTap but that doesn't ...
10
votes
2
answers
6k
views
Using IOHIDManager to Get Modifier Key Events
I'm trying to use IOHIDManager to get modifier key events because Cocoa flagsChanged events are lacking (difficult to differentiate between press/release, left/right if both are down, etc.) Here's the ...
10
votes
4
answers
4k
views
How to detect SSD in Mac OS X?
Is there a reliable, quick, deterministic way (i.e. not a benchmark) to check whether the system drive Mac OS X is on is a Solid State Drive?
Is there any other indicator how well disk handles ...
10
votes
2
answers
2k
views
Send data to a PS3 DualShock3 controller from a Mac (IOHIDDeviceSetReport)
I've been playing around with the HID part of IOKit lately on my Mac with a PS3 controller. I've managed to look though the sample code and connect to my controller, receive a stream of data and parse ...
10
votes
3
answers
4k
views
Best way to communicate from KEXT to Daemon and block until result is returned from Daemon
In KEXT, I am listening for file close via vnode or file scope listener. For certain (very few) files, I need to send file path to my system daemon which does some processing (this has to happen in ...
10
votes
2
answers
5k
views
Programmatically "unplug and replug" a USB device to load new driver in OS X?
I'm working on an installer in OS X that installs an IOKit driver for a USB device, and I'm trying to get it to not require a restart at the end. The installer installs the driver correctly and ...
9
votes
4
answers
3k
views
Gamepad code on OS X: Buh?
I thought I was a decent programmer until I tried writing gamepad code for OS X. Now I feel deeply useless.
Does anyone know of any code that I can legally use in my (non-free) game?
Is it really ...
9
votes
4
answers
7k
views
Acessing a serial to USB device with I/O kit
I have the following problem: I have a Wintec WBT-202 GPS device which has the ability to transmit the location data live as NMEA data over USB. Inside this USB it is just a USB to serial bridge which ...
9
votes
1
answer
919
views
How to memory-map a PCI BAR using PCIDriverKit?
How to memory-map a PCI Base Address Register (BAR) from a PCIDriverKit driver (DEXT) to a userspace application?
Memory-mapping from a driver extension to an application can be accomplished by ...
9
votes
0
answers
452
views
Mouse IOHIDDeviceRef not delivering any input reports in macOS 10.12
I'm trying to receive input reports for my mouse (wrapped in an IOHIDDeviceRef), but for the life of me I can't seem to get it working on macOS 10.12. The same code works fine in 10.11 and 10.10, and ...
9
votes
4
answers
10k
views
Get serial number of device on iOS 8
For an in-house application, we were using the following code UIDevice+serialNumber to get the device serial number.
However, it seems that with iOS 8, the registry key "IOPlatformSerialNumber" is ...
8
votes
1
answer
2k
views
Mac low-level keyboard device corresponding to Linux /dev/input?
What is the name of the low-level keyboard device in macOS (somewhere in Darwin / Mach / IOKit) that corresponds to /dev/input in Linux? (e.g. /dev/input/event0)
Context: I'm asking because want to '...
8
votes
1
answer
5k
views
MAC address from interface on OS X (C)
This might be a stupid question and I apologize if it's already been addressed here, but I've searched quite a bit without much luck. I'm trying to get my interface's hardware address in C and I'm ...
8
votes
2
answers
8k
views
Cocoa: Detecting USB devices by Vendor ID
I'm writing a Foundation tool for Mac and trying to detect when Apple devices are connected and disconnected via USB. I found some help in this post along with the USBPrivateDataSample -- but it seems ...
7
votes
1
answer
7k
views
macOS. How to get CPU temperature programmatically
I need to get CPU temperature using Swift, but I can't find any information except for this.
I think that I should use IOKit.framework but again there's no much information about it.
7
votes
4
answers
3k
views
High resolution and high framerate mouse coordinates on OSX? (Or other solution?)
I'd like to get mouse movements in high resolution and high framerate on OSX.
"High framerate" = 60 fps or higher (preferably > 120)
"High resolution" = Subpixel values
Problem
I've got an opengl ...
7
votes
1
answer
1k
views
Enabling Closed-Display Mode w/o Meeting Apple's Requirements
EDIT:
I have heavily edited this question after making some significant new discoveries and the question not having any answers yet.
Historically/AFAIK, keeping your Mac awake while in closed-...
7
votes
2
answers
847
views
Difference between various kIOPMAssertionType's
What is the difference between kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionTypePreventSystemSleep and kIOPMAssertionTypePreventUserIdleSystemSleep?
I am trying to create an IOPMAssertion that will ...
7
votes
2
answers
3k
views
How to tap/hook keyboard events in OSX and record which keyboard fires each event
I've now discovered how to hook/tap keyboard events on OS X at a low level: How to tap (hook) F7 through F12 and Power/Eject on a MacBook keyboard
Printing out the code from that answer:
// compile ...
7
votes
2
answers
5k
views
IOKit device adding/removal notifications - only fire once?
I have been trying to get notified when a specific USB device is added or removed. I have read 'Accessing Hardware From Applications' document and have a bare-bones demo application, mainly based on ...
7
votes
2
answers
3k
views
Getting the BSD name of a USB device using IOKit to write to the device?
I am trying to determine the BSD name of virtual serial port using IOKit under MacOS.
I have a USB CDC device that looks like a virtual serial port, and I want to get the BSD device path so that I ...
7
votes
1
answer
5k
views
Gamepad and joystick support on Mac OS X in user space
I have been searching through how to do gamepad and joystick support on Mac for some days and all resources that I found seems to suggest a pre-installed driver along with using Apple's HID API, which ...
7
votes
1
answer
881
views
Why do static functions eliminate undefined symbols in Xcode?
I am attempting to use I/O kit and have linked to I/O kit properly.
When I use a function in I/O kit and don't call it within a static function, I get the following error Undefined symbols for ...
6
votes
2
answers
4k
views
Is libusb the preferred method on Mac OS X to access USB device?
Is libusb the preferred method to talk to a device over USB (using AT commands) on OS X these days?
Is there any high level equivalent in cocoa?
6
votes
6
answers
4k
views
IOKit not permitted in Sandbox?
I'm new to using IOKit and have noticed what I think is the sandbox making it fail.
Here is the test I'm trying (in Pascal) which runs fine outside the sandbox but when I enable it IOServiceOpen ...
6
votes
3
answers
7k
views
IOCreatePlugInInterfaceForService returns mysterious error
I am trying to use some old IOKit functionality in a new Swift 4.0 Mac app (not iOS). I have created a bridging header to use an existing Objective C third party framework, DDHidLib, and I am current ...
6
votes
1
answer
15k
views
Mac - Virtual Serial Port
I need to create a Cocoa app that will create a virtual serial port available to other apps, meaning registered in the IO Kit Registry.
Gist of the app:
Create a virtual serial port (listed in /...
6
votes
1
answer
2k
views
How to set speaker configuration programatically using Core Audio API on Mac OS X?
I have a 7.1 channel audio output device and a custom kext to drive that. My custom application needs to send 7.1 rear channel audio data to the device but the device receives only 2 channel audio ...
6
votes
2
answers
1k
views
How to create a display for OS X?
I need to write what I think is a display driver for OS X. It's like those "Use your iPad as a second monitor!" apps, but I need to write the OS X software that will register another display with OS ...
6
votes
1
answer
4k
views
Can't get started with kext development in OS X
I'm trying to do Apple's "Kernel Extension" Tutorial. I've created a project file, created the Info.plist, built it, used kextlibs to learn the dependencies, added them to the Info.plist, rebuilt, ...
6
votes
0
answers
1k
views
OSX change Product ID to USB composite device
I've got a composite USB device i need to use under MAC OSX. Under Linux i can change the product id using the usb_modeswitch tool with the following command
usb_modeswitch -v 0x072f -p 0x100d -V ...
6
votes
0
answers
1k
views
Help writing a DVB driver for OS X
I'm looking at options to access DVB data on OS X. Initially I want to support the EyeTV DTT USB device, but in the long-run I'd like to support a number of popular devices. The problem I have is ...
6
votes
1
answer
11k
views
Using IOKit to communicate with USB device
I'm trying to make an application that communicates with a USB device about the same way I use the screen command on Terminal.
To make my question easier to understand, This is what I normally do in ...
5
votes
2
answers
2k
views
Programmatically get amount of RAM installed on OS X
I'm working on a machine that has 8 gigs of memory installed and I'm trying to programmatically determine how much memory is installed in the machine. I've already attempted using sysctlbyname() to ...
5
votes
2
answers
1k
views
Is there a battery level did change notification equivalent for kIOPSCurrentCapacityKey on macOS?
I am building a Swift app that monitors the battery percentage, as well as the charging state, of a Mac laptop's battery. On iOS, there is a batteryLevelDidChange notification that is sent when the ...