Classes | Macros | Typedefs | Functions | Variables
hidapi.cpp File Reference
#include <IOKit/hid/IOHIDManager.h>
#include <IOKit/hid/IOHIDKeys.h>
#include <IOKit/IOKitLib.h>
#include <CoreFoundation/CoreFoundation.h>
#include <wchar.h>
#include <locale.h>
#include <pthread.h>
#include <sys/time.h>
#include <unistd.h>
#include <dlfcn.h>
#include "hidapi.h"
Include dependency graph for hidapi.cpp:

Go to the source code of this file.

Classes

struct  hid_device_
 
struct  input_report
 
struct  pthread_barrier
 

Macros

#define BUF_LEN   256
 

Typedefs

typedef struct pthread_barrier pthread_barrier_t
 
typedef int pthread_barrierattr_t
 

Functions

static int cond_timedwait (const hidapi_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
 
static int cond_wait (const hidapi_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex)
 
static wchar_t * dup_wcs (const wchar_t *s)
 
static void free_hid_device (hidapi_device *dev)
 
static int32_t get_int_property (IOHIDDeviceRef device, CFStringRef key)
 
static int32_t get_location_id (IOHIDDeviceRef device)
 
static int get_manufacturer_string (IOHIDDeviceRef device, wchar_t *buf, size_t len)
 
static int32_t get_max_report_length (IOHIDDeviceRef device)
 
static unsigned short get_product_id (IOHIDDeviceRef device)
 
static int get_product_string (IOHIDDeviceRef device, wchar_t *buf, size_t len)
 
static int get_serial_number (IOHIDDeviceRef device, wchar_t *buf, size_t len)
 
static int get_string_property (IOHIDDeviceRef device, CFStringRef prop, wchar_t *buf, size_t len)
 
static int get_transport (IOHIDDeviceRef device, wchar_t *buf, size_t len)
 
static int32_t get_usage (IOHIDDeviceRef device)
 
static int32_t get_usage_page (IOHIDDeviceRef device)
 
static unsigned short get_vendor_id (IOHIDDeviceRef device)
 
void HID_API_EXPORT hid_close (hidapi_device *dev)
 Close a HID device. More...
 
static void hid_device_removal_callback (void *context, IOReturn result, void *sender)
 
struct hidapi_device_info HID_API_EXPORThid_enumerate (unsigned short vendor_id, unsigned short product_id)
 Enumerate the HID Devices. More...
 
HID_API_EXPORT const wchar_t *HID_API_CALL hid_error (hidapi_device *dev)
 Get a string describing the last error which occurred. More...
 
int HID_API_EXPORT hid_exit (void)
 Finalize the HIDAPI library. More...
 
void HID_API_EXPORT hid_free_enumeration (struct hidapi_device_info *devs)
 Free an enumeration Linked List. More...
 
int HID_API_EXPORT hid_get_feature_report (hidapi_device *dev, unsigned char *data, size_t length)
 Get a feature report from a HID device. More...
 
int HID_API_EXPORT_CALL hid_get_indexed_string (hidapi_device *dev, int string_index, wchar_t *string, size_t maxlen)
 Get a string from a HID device, based on its string index. More...
 
int HID_API_EXPORT_CALL hid_get_manufacturer_string (hidapi_device *dev, wchar_t *string, size_t maxlen)
 Get The Manufacturer String from a HID device. More...
 
int HID_API_EXPORT_CALL hid_get_product_string (hidapi_device *dev, wchar_t *string, size_t maxlen)
 Get The Product String from a HID device. More...
 
int HID_API_EXPORT_CALL hid_get_serial_number_string (hidapi_device *dev, wchar_t *string, size_t maxlen)
 Get The Serial Number String from a HID device. More...
 
int HID_API_EXPORT hid_init (void)
 Initialize the HIDAPI library. More...
 
hidapi_device *HID_API_EXPORT hid_open (unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
 Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number. More...
 
hidapi_device *HID_API_EXPORT hid_open_path (const char *path)
 Open a HID device by its path name. More...
 
int HID_API_EXPORT hid_read (hidapi_device *dev, unsigned char *data, size_t length)
 Read an Input report from a HID device. More...
 
int HID_API_EXPORT hid_read_timeout (hidapi_device *dev, unsigned char *data, size_t length, int milliseconds)
 Read an Input report from a HID device with timeout. More...
 
static void hid_report_callback (void *context, IOReturn result, void *sender, IOHIDReportType report_type, uint32_t report_id, uint8_t *report, CFIndex report_length)
 
int HID_API_EXPORT hid_send_feature_report (hidapi_device *dev, const unsigned char *data, size_t length)
 Send a Feature report to the device. More...
 
int HID_API_EXPORT hid_set_nonblocking (hidapi_device *dev, int nonblock)
 Set the device handle to be non-blocking. More...
 
int HID_API_EXPORT hid_write (hidapi_device *dev, const unsigned char *data, size_t length)
 Write an Output report to a HID device. More...
 
static io_service_t hidapi_IOHIDDeviceGetService (IOHIDDeviceRef device)
 
static int init_hid_manager (void)
 
static hidapi_devicenew_hid_device (void)
 
static void perform_signal_callback (void *context)
 
static void process_pending_events (void)
 
static int pthread_barrier_destroy (pthread_barrier_t *barrier)
 
static int pthread_barrier_init (pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
 
static int pthread_barrier_wait (pthread_barrier_t *barrier)
 
static voidread_thread (void *param)
 
static int return_data (hidapi_device *dev, unsigned char *data, size_t length)
 
static int set_report (hidapi_device *dev, IOHIDReportType type, const unsigned char *data, size_t length)
 

Variables

static IOHIDManagerRef hid_mgr = 0x0
 

Macro Definition Documentation

#define BUF_LEN   256

Typedef Documentation

typedef int pthread_barrierattr_t

Definition at line 21 of file hidapi.cpp.

Function Documentation

static int cond_timedwait ( const hidapi_device dev,
pthread_cond_t *  cond,
pthread_mutex_t *  mutex,
const struct timespec *  abstime 
)
static

Definition at line 812 of file hidapi.cpp.

static int cond_wait ( const hidapi_device dev,
pthread_cond_t *  cond,
pthread_mutex_t *  mutex 
)
static

Definition at line 792 of file hidapi.cpp.

static wchar_t* dup_wcs ( const wchar_t *  s)
static

Definition at line 260 of file hidapi.cpp.

static void free_hid_device ( hidapi_device dev)
static

Definition at line 127 of file hidapi.cpp.

static int32_t get_int_property ( IOHIDDeviceRef  device,
CFStringRef  key 
)
static

Definition at line 171 of file hidapi.cpp.

static int32_t get_location_id ( IOHIDDeviceRef  device)
static

Definition at line 1022 of file hidapi.cpp.

static int get_manufacturer_string ( IOHIDDeviceRef  device,
wchar_t *  buf,
size_t  len 
)
static

Definition at line 248 of file hidapi.cpp.

static int32_t get_max_report_length ( IOHIDDeviceRef  device)
static

Definition at line 196 of file hidapi.cpp.

static unsigned short get_product_id ( IOHIDDeviceRef  device)
static

Definition at line 191 of file hidapi.cpp.

static int get_product_string ( IOHIDDeviceRef  device,
wchar_t *  buf,
size_t  len 
)
static

Definition at line 253 of file hidapi.cpp.

static int get_serial_number ( IOHIDDeviceRef  device,
wchar_t *  buf,
size_t  len 
)
static

Definition at line 243 of file hidapi.cpp.

static int get_string_property ( IOHIDDeviceRef  device,
CFStringRef  prop,
wchar_t *  buf,
size_t  len 
)
static

Definition at line 201 of file hidapi.cpp.

static int get_transport ( IOHIDDeviceRef  device,
wchar_t *  buf,
size_t  len 
)
static

Definition at line 1045 of file hidapi.cpp.

static int32_t get_usage ( IOHIDDeviceRef  device)
static

Definition at line 1027 of file hidapi.cpp.

static int32_t get_usage_page ( IOHIDDeviceRef  device)
static

Definition at line 1036 of file hidapi.cpp.

static unsigned short get_vendor_id ( IOHIDDeviceRef  device)
static

Definition at line 186 of file hidapi.cpp.

static void hid_device_removal_callback ( void context,
IOReturn  result,
void sender 
)
static

Definition at line 522 of file hidapi.cpp.

static void hid_report_callback ( void context,
IOReturn  result,
void sender,
IOHIDReportType  report_type,
uint32_t  report_id,
uint8_t report,
CFIndex  report_length 
)
static

Definition at line 535 of file hidapi.cpp.

static io_service_t hidapi_IOHIDDeviceGetService ( IOHIDDeviceRef  device)
static

Definition at line 275 of file hidapi.cpp.

static int init_hid_manager ( void  )
static

Definition at line 327 of file hidapi.cpp.

static hidapi_device* new_hid_device ( void  )
static

Definition at line 104 of file hidapi.cpp.

static void perform_signal_callback ( void context)
static

Definition at line 585 of file hidapi.cpp.

static void process_pending_events ( void  )
static

Definition at line 365 of file hidapi.cpp.

static int pthread_barrier_destroy ( pthread_barrier_t barrier)
static

Definition at line 49 of file hidapi.cpp.

static int pthread_barrier_init ( pthread_barrier_t barrier,
const pthread_barrierattr_t attr,
unsigned int  count 
)
static

Definition at line 29 of file hidapi.cpp.

static int pthread_barrier_wait ( pthread_barrier_t barrier)
static

Definition at line 56 of file hidapi.cpp.

static void* read_thread ( void param)
static

Definition at line 591 of file hidapi.cpp.

static int return_data ( hidapi_device dev,
unsigned char *  data,
size_t  length 
)
static

Definition at line 779 of file hidapi.cpp.

static int set_report ( hidapi_device dev,
IOHIDReportType  type,
const unsigned char *  data,
size_t  length 
)
static

Definition at line 734 of file hidapi.cpp.

Variable Documentation

IOHIDManagerRef hid_mgr = 0x0
static

Definition at line 160 of file hidapi.cpp.



librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:26