Example #1
0
        None, 0x9d, 0xc7, 0xb7, 0x80, 0x9e, 0xc0, 0x11, 0xD4, 0xa5, 0x4f, 0x00,
        0x0a, 0x27, 0x05, 0x28, 0x61)

    kIOUSBInterfaceUserClientTypeID = CFUUIDGetConstantUUIDWithBytes(
        None, 0x2d, 0x97, 0x86, 0xc6, 0x9e, 0xf3, 0x11, 0xD4, 0xad, 0x51, 0x00,
        0x0a, 0x27, 0x05, 0x28, 0x61)

    kIOUSBInterfaceInterfaceID = CFUUIDGetConstantUUIDWithBytes(
        None, 0x73, 0xc9, 0x7a, 0xe8, 0x9e, 0xf3, 0x11, 0xD4, 0xb1, 0xd0, 0x00,
        0x0a, 0x27, 0x05, 0x28, 0x61)

    kIOUSBDeviceInterfaceID = CFUUIDGetConstantUUIDWithBytes(
        None, 0x5c, 0x81, 0x87, 0xd0, 0x9e, 0xf3, 0x11, 0xD4, 0x8b, 0x45, 0x00,
        0x0a, 0x27, 0x05, 0x28, 0x61)

    USBDeviceAddress = define('USBDeviceAddress', 'UInt16')

    class IOUSBDevRequest(Structure):
        _fields_ = [
            parse('UInt8 bmRequestType').cstruct,
            parse('UInt8 bRequest').cstruct,
            parse('UInt16 wValue').cstruct,
            parse('UInt16 wIndex').cstruct,
            parse('UInt16 wLength').cstruct,
            parse('void *pData').cstruct,
            parse('UInt32 wLenDone').cstruct,
        ]

    define('IOUSBDevRequest', IOUSBDevRequest)

    IOAsyncCallback1 = parse(
Example #2
0
Dynamically loaded on OS X.
Refer to the hid module for available functions
'''

from ctypes import *
from ctypes.util import find_library

import logging
import struct

# common code for OS X and win32
from hid import HIDDevice
from hid.cparser import define, parse

# define various types we'll be using (so we can match name from headers)
mach_port_t = define('mach_port_t', 'void*')
io_object_t = define('io_object_t', 'void*')
io_iterator_t = define('io_iterator_t', 'void*')
io_service_t = define('io_service_t', 'void*')
io_registry_entry_t = define('io_registry_entry_t', io_object_t)

LPVOID = define('LPVOID', 'void*')
Boolean = define('Boolean', c_ubyte)
UInt8 = define('UInt8', c_uint8)
UInt16 = define('UInt16', c_uint16)
SInt32 = define('SInt32', c_int32)
UInt32 = define('UInt32', c_uint32)
uint32_t = define('uint32_t', c_uint32)
UInt64 = define('UInt64', c_uint64)
ULONG = define('ULONG', c_ulong)
IOReturn = define('IOReturn', c_int)
Example #3
0
Dynamically loaded on OS X.
Refer to the hid module for available functions
'''

from ctypes import *
from ctypes.util import find_library

import logging
import struct

# common code for OS X and win32
from hid import HIDDevice
from hid.cparser import define, parse

# define various types we'll be using (so we can match name from headers)
mach_port_t = define('mach_port_t', 'void*')
io_object_t = define('io_object_t', 'void*')
io_iterator_t = define('io_iterator_t', 'void*')
io_service_t = define('io_service_t', 'void*')
io_registry_entry_t = define('io_registry_entry_t', io_object_t)

LPVOID = define('LPVOID', 'void*')
Boolean = define('Boolean', c_ubyte)
UInt8 = define('UInt8', c_uint8)
UInt16 = define('UInt16', c_uint16)
SInt32 = define('SInt32', c_int32)
UInt32 = define('UInt32', c_uint32)
uint32_t = define('uint32_t', c_uint32)
UInt64 = define('UInt64', c_uint64)
ULONG = define('ULONG', c_ulong)
IOReturn = define('IOReturn', c_int)
Example #4
0
        0x9d, 0xc7, 0xb7, 0x80, 0x9e, 0xc0, 0x11, 0xD4,
        0xa5, 0x4f, 0x00, 0x0a, 0x27, 0x05, 0x28, 0x61)

    kIOUSBInterfaceUserClientTypeID=CFUUIDGetConstantUUIDWithBytes(None,
        0x2d, 0x97, 0x86, 0xc6, 0x9e, 0xf3, 0x11, 0xD4,
        0xad, 0x51, 0x00, 0x0a, 0x27, 0x05, 0x28, 0x61)

    kIOUSBInterfaceInterfaceID=CFUUIDGetConstantUUIDWithBytes(None,
        0x73, 0xc9, 0x7a, 0xe8, 0x9e, 0xf3, 0x11, 0xD4,
        0xb1, 0xd0, 0x00, 0x0a, 0x27, 0x05, 0x28, 0x61)

    kIOUSBDeviceInterfaceID=CFUUIDGetConstantUUIDWithBytes(None,
        0x5c, 0x81, 0x87, 0xd0, 0x9e, 0xf3, 0x11, 0xD4,
        0x8b, 0x45, 0x00, 0x0a, 0x27, 0x05, 0x28, 0x61)

    USBDeviceAddress=define('USBDeviceAddress','UInt16')

    class IOUSBDevRequest(Structure):
        _fields_=[
            parse('UInt8 bmRequestType').cstruct,
            parse('UInt8 bRequest').cstruct,
            parse('UInt16 wValue').cstruct,
            parse('UInt16 wIndex').cstruct,
            parse('UInt16 wLength').cstruct,
            parse('void *pData').cstruct,
            parse('UInt32 wLenDone').cstruct,
        ]

    define('IOUSBDevRequest',IOUSBDevRequest)

    IOAsyncCallback1=parse('void ( *IOAsyncCallback1)(void *refcon,IOReturn result,void *arg0)').ctype
Example #5
0
        None, 0x9D, 0xC7, 0xB7, 0x80, 0x9E, 0xC0, 0x11, 0xD4, 0xA5, 0x4F, 0x00, 0x0A, 0x27, 0x05, 0x28, 0x61
    )

    kIOUSBInterfaceUserClientTypeID = CFUUIDGetConstantUUIDWithBytes(
        None, 0x2D, 0x97, 0x86, 0xC6, 0x9E, 0xF3, 0x11, 0xD4, 0xAD, 0x51, 0x00, 0x0A, 0x27, 0x05, 0x28, 0x61
    )

    kIOUSBInterfaceInterfaceID = CFUUIDGetConstantUUIDWithBytes(
        None, 0x73, 0xC9, 0x7A, 0xE8, 0x9E, 0xF3, 0x11, 0xD4, 0xB1, 0xD0, 0x00, 0x0A, 0x27, 0x05, 0x28, 0x61
    )

    kIOUSBDeviceInterfaceID = CFUUIDGetConstantUUIDWithBytes(
        None, 0x5C, 0x81, 0x87, 0xD0, 0x9E, 0xF3, 0x11, 0xD4, 0x8B, 0x45, 0x00, 0x0A, 0x27, 0x05, 0x28, 0x61
    )

    USBDeviceAddress = define("USBDeviceAddress", "UInt16")

    class IOUSBDevRequest(Structure):
        _fields_ = [
            parse("UInt8 bmRequestType").cstruct,
            parse("UInt8 bRequest").cstruct,
            parse("UInt16 wValue").cstruct,
            parse("UInt16 wIndex").cstruct,
            parse("UInt16 wLength").cstruct,
            parse("void *pData").cstruct,
            parse("UInt32 wLenDone").cstruct,
        ]

    define("IOUSBDevRequest", IOUSBDevRequest)

    IOAsyncCallback1 = parse("void ( *IOAsyncCallback1)(void *refcon,IOReturn result,void *arg0)").ctype