iokit

OSX: How to get a volume name (or bsd name) from a IOUSBDeviceInterface or location id

ⅰ亾dé卋堺 提交于 2019-12-21 05:34:11
问题 I'm trying to write an app that associates a particular USB string descriptor (of a USB mass storage device) with its volume or bsd name. So the code goes through all the connected USB devices, gets the string descriptors and extracts information from one of them. I would like to get the volume name of those USB devices. I can't find the right API to do that. I have tried to do that: DASessionRef session = DASessionCreate(kCFAllocatorDefault); DADiskRef disk_ref = DADiskCreateFromIOMedia

How to get list of HID devices in a Swift/Cocoa application?

本秂侑毒 提交于 2019-12-14 00:33:14
问题 The following code works perfectly to get a list of connected HID devices: import Foundation import IOKit import IOKit.usb import IOKit.hid private func createDeviceMatchingDictionary( usagePage: Int, usage: Int) -> CFMutableDictionary { let dict = [ kIOHIDDeviceUsageKey: usage, kIOHIDDeviceUsagePageKey: usagePage ] as NSDictionary return dict.mutableCopy() as! NSMutableDictionary; } let manager = IOHIDManagerCreate(kCFAllocatorDefault, IOOptionBits(kIOHIDOptionsTypeNone)); let keyboard =

Get serial number of device on iOS 8

和自甴很熟 提交于 2019-12-14 00:20:44
问题 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 empty. Can the serial number be obtained any other way? 回答1: Answer: No. There are currently floating solutions around abusing the .mobileconfig, but they add other problems due their nature. UUID was removed for a reason. See the news around privacy and the summon of Apple by the US Senat from 2011

Using IOKit to return Mac's Serial number returns 4 extra characters

若如初见. 提交于 2019-12-13 12:19:26
问题 I'm playing with IOKit and have the following code, the general idea is to pass a platformExpert key to this small core foundation command line application and have it print the decoded string. The test case is "serial-number". The code below when run like: ./compiled serial-number Almost works but returns the last 4 characters of the serial number at the beginning of the string i.e. for an example serial such as C12D2JMPDDQX it would return DDQXC12D2JMPDDQX Any ideas? #include

No kernel file specified Error On KEXT MAC Environment

老子叫甜甜 提交于 2019-12-13 06:55:23
问题 I try implement KEXT for USBHID Device. If i am checking on Terminal It able to load KEXT ie Newtok:Desktop Rasheed$ kextutil -nt SampleKextDriver.kext No kernel file specified; using running kernel for linking. SampleKextDriver.kext appears to be loadable (including linkage for on-disk libraries). But Unfortunately I Got the above Message. My plist File is <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0

Authenticate macOS App to wake Mac from sleep

自闭症网瘾萝莉.ら 提交于 2019-12-12 11:34:19
问题 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 what is provided here. When I run the IOPMSchedulePowerEvent code, the value of "result" in the code below is (IOReturn) result = -536870207. IOReturn result = IOPMSchedulePowerEvent(CFBridgingRetain(someCFDate), NULL, CFSTR(kIOPMAutoWake)); After doing some digging and finding someone with a

Hide Audio device using codeless kext

夙愿已清 提交于 2019-12-12 09:24:02
问题 I am developing a audio driver to do some custom audio processing using audio reflector driver sample code from Apple. Output from audio reflector driver is passed to real USB audio hardware device using core audio application. Now I want to hide USB audio hardware device from the system preferences so that user is not able to select the USB audio hardware output device as the default output device. Using the "SampleUSBAudioOverrideDriver" codeless kext I am able to change the name of output

Trap each SHIFT key independently on OS X

 ̄綄美尐妖づ 提交于 2019-12-12 04:24:20
问题 I have working code (here) that traps keycodes for non-modifier keydown events, and modifier-changed events. But if you do: LSHIFT down -> RSHIFT down -> RSHIFT up -> LSHIFT up ... the inner 2 actions will not trigger either of these hooks, because the modifier state is not changing! (EDIT: Woops! I should have tested that out before writing, because actually a new modifier-changed is produced by each actual change.) My only thought is maybe to additionally watch at an even lower level (here)

Build fails when using methods from I/O Kit on XCode

倾然丶 夕夏残阳落幕 提交于 2019-12-11 22:11:47
问题 I need to perform some operations in my C++ app upon sleep and wake up of Mac OS. I am being pointed to using I/O Kit. I followed this guide, specifically "Listing 3". No build errors occurred with the #include directives for IOKit . However, build fails when I uncomment IOAllowPowerChange() or IOCancelPowerChange() : Undefined symbols for architecture x86_64: "_IOAllowPowerChange", referenced from: SleepCallback(void*, unsigned int, unsigned int, void*) in MyAppFrameWork.a(PowerWatcher.o) ld

Adding IOKit to iOS Project

孤街浪徒 提交于 2019-12-11 19:44:15
问题 I'm currently trying to add IOKit to my project. I linked against the IOKit dyn lib and linked against the provate header files. The problem is, that i get an error while building, as it says, that iokit dyn lib couldn't be found, but i linked against it. Best regards Header files from: http://iphonedevwiki.net/index.php/IOKit.framework 来源: https://stackoverflow.com/questions/18273638/adding-iokit-to-ios-project