![]() |
Prusa Slicer 2.6.0
|
#include <IOKit/hid/IOHIDManager.h>#include <IOKit/hid/IOHIDKeys.h>#include <IOKit/IOKitLib.h>#include <IOKit/usb/USBSpec.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 hid.c:Go to the source code of this file.
Classes | |
| struct | pthread_barrier |
| struct | input_report |
| struct | hid_device_ |
Macros | |
| #define | BUF_LEN 256 |
Typedefs | |
| typedef int | pthread_barrierattr_t |
| typedef struct pthread_barrier | pthread_barrier_t |
Functions | |
| static int | pthread_barrier_init (pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count) |
| static int | pthread_barrier_destroy (pthread_barrier_t *barrier) |
| static int | pthread_barrier_wait (pthread_barrier_t *barrier) |
| static int | return_data (hid_device *dev, unsigned char *data, size_t length) |
| static hid_device * | new_hid_device (void) |
| static void | free_hid_device (hid_device *dev) |
| static int32_t | get_int_property (IOHIDDeviceRef device, CFStringRef key) |
| static unsigned short | get_vendor_id (IOHIDDeviceRef device) |
| static unsigned short | get_product_id (IOHIDDeviceRef device) |
| static int32_t | get_max_report_length (IOHIDDeviceRef device) |
| static int | get_string_property (IOHIDDeviceRef device, CFStringRef prop, wchar_t *buf, size_t len) |
| static int | get_serial_number (IOHIDDeviceRef device, wchar_t *buf, size_t len) |
| static int | get_manufacturer_string (IOHIDDeviceRef device, wchar_t *buf, size_t len) |
| static int | get_product_string (IOHIDDeviceRef device, wchar_t *buf, size_t len) |
| static wchar_t * | dup_wcs (const wchar_t *s) |
| static io_service_t | hidapi_IOHIDDeviceGetService (IOHIDDeviceRef device) |
| static int | init_hid_manager (void) |
| int HID_API_EXPORT | hid_init (void) |
| Initialize the HIDAPI library. | |
| int HID_API_EXPORT | hid_exit (void) |
| Finalize the HIDAPI library. | |
| static void | process_pending_events (void) |
| struct hid_device_info HID_API_EXPORT * | hid_enumerate (unsigned short vendor_id, unsigned short product_id) |
| Enumerate the HID Devices. | |
| void HID_API_EXPORT | hid_free_enumeration (struct hid_device_info *devs) |
| Free an enumeration Linked List. | |
| hid_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. | |
| static void | hid_device_removal_callback (void *context, IOReturn result, void *sender) |
| 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 void | perform_signal_callback (void *context) |
| static void * | read_thread (void *param) |
| hid_device *HID_API_EXPORT | hid_open_path (const char *path) |
| Open a HID device by its path name. | |
| static int | set_report (hid_device *dev, IOHIDReportType type, const unsigned char *data, size_t length) |
| int HID_API_EXPORT | hid_write (hid_device *dev, const unsigned char *data, size_t length) |
| Write an Output report to a HID device. | |
| static int | cond_wait (const hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex) |
| static int | cond_timedwait (const hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime) |
| int HID_API_EXPORT | hid_read_timeout (hid_device *dev, unsigned char *data, size_t length, int milliseconds) |
| Read an Input report from a HID device with timeout. | |
| int HID_API_EXPORT | hid_read (hid_device *dev, unsigned char *data, size_t length) |
| Read an Input report from a HID device. | |
| int HID_API_EXPORT | hid_set_nonblocking (hid_device *dev, int nonblock) |
| Set the device handle to be non-blocking. | |
| int HID_API_EXPORT | hid_send_feature_report (hid_device *dev, const unsigned char *data, size_t length) |
| Send a Feature report to the device. | |
| int HID_API_EXPORT | hid_get_feature_report (hid_device *dev, unsigned char *data, size_t length) |
| Get a feature report from a HID device. | |
| void HID_API_EXPORT | hid_close (hid_device *dev) |
| Close a HID device. | |
| int HID_API_EXPORT_CALL | hid_get_manufacturer_string (hid_device *dev, wchar_t *string, size_t maxlen) |
| Get The Manufacturer String from a HID device. | |
| int HID_API_EXPORT_CALL | hid_get_product_string (hid_device *dev, wchar_t *string, size_t maxlen) |
| Get The Product String from a HID device. | |
| int HID_API_EXPORT_CALL | hid_get_serial_number_string (hid_device *dev, wchar_t *string, size_t maxlen) |
| Get The Serial Number String from a HID device. | |
| int HID_API_EXPORT_CALL | hid_get_indexed_string (hid_device *dev, int string_index, wchar_t *string, size_t maxlen) |
| Get a string from a HID device, based on its string index. | |
| HID_API_EXPORT const wchar_t *HID_API_CALL | hid_error (hid_device *dev) |
| Get a string describing the last error which occurred. | |
Variables | |
| static IOHIDManagerRef | hid_mgr = 0x0 |
| struct pthread_barrier |
| struct input_report |
Collaboration diagram for input_report:| Class Members | ||
|---|---|---|
| uint8_t * | data | |
| size_t | len | |
| struct input_report * | next | |
| struct hid_device_ |
Collaboration diagram for hid_device_:| Class Members | ||
|---|---|---|
| pthread_barrier_t | barrier | |
| int | blocking | |
| BOOL | blocking | |
| pthread_cond_t | condition | |
| int | device_handle | |
| IOHIDDeviceRef | device_handle | |
| HANDLE | device_handle | |
| int | disconnected | |
| uint8_t * | input_report_buf | |
| size_t | input_report_length | |
| struct input_report * | input_reports | |
| DWORD | last_error_num | |
| void * | last_error_str | |
| CFIndex | max_input_report_len | |
| pthread_mutex_t | mutex | |
| OVERLAPPED | ol | |
| USHORT | output_report_length | |
| char * | read_buf | |
| BOOL | read_pending | |
| CFRunLoopRef | run_loop | |
| CFStringRef | run_loop_mode | |
| pthread_barrier_t | shutdown_barrier | |
| int | shutdown_thread | |
| CFRunLoopSourceRef | source | |
| pthread_t | thread | |
| int | uses_numbered_reports | |
| #define BUF_LEN 256 |
| typedef struct pthread_barrier pthread_barrier_t |
| typedef int pthread_barrierattr_t |
|
static |
References hid_device_::disconnected, hid_device_::input_reports, and hid_device_::shutdown_thread.
Referenced by hid_read_timeout().
Here is the caller graph for this function:
|
static |
References hid_device_::disconnected, hid_device_::input_reports, and hid_device_::shutdown_thread.
Referenced by hid_read_timeout().
Here is the caller graph for this function:
|
static |
References input_report::len, and malloc().
Referenced by hid_enumerate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References hid_device_::barrier, hid_device_::condition, input_report::data, free(), hid_device_::input_report_buf, hid_device_::input_reports, hid_device_::mutex, input_report::next, pthread_barrier_destroy(), hid_device_::run_loop_mode, hid_device_::shutdown_barrier, and hid_device_::source.
Here is the call graph for this function:
|
static |
Referenced by get_max_report_length(), get_product_id(), get_vendor_id(), and hid_enumerate().
Here is the caller graph for this function:
|
static |
References get_string_property(), and input_report::len.
Referenced by hid_enumerate(), and hid_get_manufacturer_string().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References get_int_property().
Referenced by hid_open_path().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References get_int_property().
Referenced by hid_enumerate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References get_string_property(), and input_report::len.
Referenced by hid_enumerate(), and hid_get_product_string().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References get_string_property(), and input_report::len.
Referenced by hid_enumerate(), and hid_get_serial_number_string().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References FALSE, and input_report::len.
Referenced by get_manufacturer_string(), get_product_string(), and get_serial_number().
Here is the caller graph for this function:
|
static |
References get_int_property().
Referenced by hid_enumerate().
Here is the call graph for this function:
Here is the caller graph for this function:Referenced by hid_open_path().
Here is the caller graph for this function:
|
static |
References hid_device_::condition, input_report::data, hid_device_::input_reports, input_report::len, hid_device_::mutex, input_report::next, and return_data().
Referenced by hid_open_path().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Referenced by hid_enumerate().
Here is the caller graph for this function:
|
static |
References hid_mgr.
Referenced by hid_init().
Here is the caller graph for this function:
|
static |
References hid_device_::barrier, hid_device_::blocking, hid_device_::condition, hid_device_::device_handle, hid_device_::disconnected, hid_device_::input_report_buf, hid_device_::input_reports, hid_device_::mutex, pthread_barrier_init(), hid_device_::run_loop, hid_device_::run_loop_mode, hid_device_::shutdown_barrier, hid_device_::shutdown_thread, hid_device_::source, and hid_device_::uses_numbered_reports.
Here is the call graph for this function:References hid_device_::run_loop.
Referenced by read_thread().
Here is the caller graph for this function:References FALSE.
Referenced by hid_enumerate().
Here is the caller graph for this function:
|
static |
References pthread_barrier::cond, and pthread_barrier::mutex.
Referenced by free_hid_device().
Here is the caller graph for this function:
|
static |
References pthread_barrier::cond, pthread_barrier::count, pthread_barrier::mutex, and pthread_barrier::trip_count.
Referenced by new_hid_device().
Here is the caller graph for this function:
|
static |
References pthread_barrier::cond, pthread_barrier::count, pthread_barrier::mutex, and pthread_barrier::trip_count.
Referenced by hid_close(), hid_open_path(), and read_thread().
Here is the caller graph for this function:References hid_device_::barrier, hid_device_::condition, hid_device_::device_handle, hid_device_::disconnected, FALSE, hid_device_::mutex, perform_signal_callback(), pthread_barrier_wait(), hid_device_::run_loop, hid_device_::run_loop_mode, hid_device_::shutdown_barrier, hid_device_::shutdown_thread, and hid_device_::source.
Referenced by hid_open_path().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References input_report::data, free(), hid_device_::input_reports, input_report::len, and input_report::next.
Referenced by hid_close(), hid_read_timeout(), and hid_report_callback().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References input_report::data, hid_device_::device_handle, and hid_device_::disconnected.
Referenced by hid_send_feature_report(), and hid_write().
Here is the caller graph for this function:
|
static |
Referenced by hid_enumerate(), hid_exit(), hid_init(), and init_hid_manager().