Skip to content

Instantly share code, notes, and snippets.

@zydeco
zydeco / reenumerate.c
Created March 7, 2017 12:30
Simulate unplugging and plugging in of usb device
// cc reenumerate.c -framework IOKit -framework CoreFoundation -o reenumerate
#include <stdio.h>
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/IOCFPlugIn.h>
#include <IOKit/usb/IOUSBLib.h>
#include <mach/mach.h>
#define kExcAccMaxWait 5