Skip to content

Instantly share code, notes, and snippets.

View yamaya's full-sized avatar

Masayuki Yamaya yamaya

  • Sapporo, Hokkaido, Japan
View GitHub Profile
#include <IOKit/hid/IOHIDLib.h>
#include <IOKit/hidsystem/event_status_driver.h>
static int hid_mousex, hid_mousey;
static void hidCallback(void* context, IOReturn result, void* sender, IOHIDValueRef valueRef)
{
IOHIDElementRef element = IOHIDValueGetElement(valueRef);
if (mouse_capture > 0 && IOHIDElementGetUsagePage(element) == kHIDPage_GenericDesktop) {
int value = (int)IOHIDValueGetIntegerValue(valueRef);
@yamaya
yamaya / shuttle.swift
Created April 27, 2017 13:50 — forked from jeamland/shuttle.swift
My stunning adventures in Swift
import Foundation
import IOKit
import IOKit.hid
import Quartz
let ioman = IOHIDManagerCreate(kCFAllocatorDefault,
IOOptionBits(kIOHIDOptionsTypeNone))
let runloop : CFRunLoop = CFRunLoopGetCurrent()
let devices = [
kIOHIDVendorIDKey: 0x0b33,