87 questions
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 ...
4
votes
1
answer
3k
views
How to set `com.apple.developer.driverkit.transport.usb` entitlement?
I am unsure about how to set the com.apple.developer.driverkit.transport.usb key in my dext entitlements file. The Info.plist file already contains the IOKitPersonalities dictionary, and reading about ...
2
votes
1
answer
383
views
Keystrokes are not blocked when using kIOHIDOptionsTypeSeizeDevice and are still passed to the OS
My goal is to block keystrokes from reaching the OS using IOHID (Can't use CGEvent for other reasons). According to the docs of kIOHIDOptionsTypeSeizeDevice:
Used to open exclusive communication with ...
5
votes
1
answer
2k
views
Migrating a codeless KEXT to a codeless DEXT
I am migrating a codeless KEXT to a codeless DEXT. I have watched the WWDC video and read much of the information on the Apple Developer site. The difficulty I am having is finding not what to do but ...
4
votes
3
answers
6k
views
Getting iPhone's battery level
I have a simple question. How do I get iPhone's battery level?
[UIDevice currentDevice] batteryLevel]
Simple enough? However there is a little catch - I can't use UIKit. Here is what I wrote so far, ...
4
votes
1
answer
2k
views
How to allocate memory in a DriverKit system extension and map it to another process?
I have allocated memory in my application and passed its pointer and size to IOConnectCallStructMethod. Using IOMemoryDescriptor::CreateMapping I have then mapped this memory to the DriverKit system ...
3
votes
1
answer
2k
views
Create a CFRunLoopSourceRef using IOPSNotificationCreateRunLoopSource in Swift
I am trying to subscribe to changes in power state on macOS. I discovered there is a way using IOKit, though it is a bit convoluted. I need to import it using #import <IOKit/ps/IOPowerSources.h> ...
14
votes
4
answers
22k
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....
7
votes
2
answers
4k
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 ...
4
votes
4
answers
17k
views
how to get Device id, vendor id and product id of a mounted usb device in Mac OS cocoa
I am trying to write a Cocoa program which detects iPods connected to Mac OS. I am listening to NSWorkspaceDidMountNotification and NSWorkspaceDidUnmountNotification for the USB device mount and ...
3
votes
1
answer
1k
views
Performance issue after migrating from codeless KEXT to DEXT
I am working on migrating a codeless KEXT to DriverKit. It is used to disable the IOKit HID driver for USB devices that present themselves as HID compliant in firmware upgrade mode.
So far I have ...
3
votes
1
answer
2k
views
How should "NewUserClient" be implemented
I am trying to interact with a dext from an application. I am able to find the service using IOServiceOpen and I get a call to NewUserClient of my dext (I can see the type parameter passed being ...
3
votes
2
answers
5k
views
Will use of IOKit in my iOS app get my app rejected?
devs, as mentioned by Erica IOKit is a semi private framework; does anybody has any experience in using it in an app-store app?
I want to use it to get IMEI and ICCID number.
2
votes
2
answers
2k
views
How to map memory in DriverKit using IOMemoryDescriptor::CreateMapping?
I am trying to learn more about DriverKit and memory management, and I read this question:
How to allocate memory in a DriverKit system extension and map it to another process?
And I would like to ...
1
vote
1
answer
2k
views
IOHIDEventSystemClientScheduleWithRunLoop with EXC_BAD_ACCESS
I'm trying to get touch events in my application. So I used the IOHIDFamily callback to get the events. My code is like this:
void handle_event(void* target, void* refcon, IOHIDServiceRef service, ...
34
votes
8
answers
10k
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 ...
15
votes
4
answers
5k
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 *...
11
votes
4
answers
9k
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 ...
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 ...
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
3
answers
8k
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 ...
5
votes
1
answer
8k
views
Creating virtual USB device in Mac OS X
I tried to add virtual usb device with driver in Mac OS programmatically.
IOKit documentations says: Traditionally, drivers of virtual devices match on IOResources because virtual devices do not ...
5
votes
0
answers
292
views
Authenticate macOS App to wake Mac from sleep
I'm looking for a way to authenticate a macOS app that would allow the app to wake the user's Mac from sleep.
I'm aware that I can schedule a power event to wake the computer using similar code to ...
5
votes
2
answers
2k
views
USBInterfaceOpen always report kIOReturnExclusiveAccess error
Recently I encountered this problem headachely, I've already spend one week on this issue, but still failed. Hopefully, you can help me to kick this stone away, many thanks.
My Problem:
Our compony ...
4
votes
2
answers
2k
views
Monitor changes on Thunderbolt port connection
I am working on a requirement where i need to monitor changes in Thunderbolt port connection. (When Thunderbolt cable is connected or disconnected).
I tried to use IOServiceMatching(...