![]() |
Prusa Slicer 2.6.0
|
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <locale.h>#include <errno.h>#include <dlfcn.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/ioctl.h>#include <sys/utsname.h>#include <fcntl.h>#include <poll.h>#include <linux/hidraw.h>#include <linux/version.h>#include <linux/input.h>#include "hidapi.h"
Include dependency graph for hid.c:Go to the source code of this file.
Classes | |
| struct | hid_device_ |
Macros | |
| #define | HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) |
| #define | HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len) |
Typedefs | |
| typedef const char *(* | hid_wrapper_udev_device_get_devnode_type) (struct udev_device *udev_device) |
| typedef struct udev_device *(* | hid_wrapper_udev_device_get_parent_with_subsystem_devtype_type) (struct udev_device *udev_device, const char *subsystem, const char *devtype) |
| typedef const char *(* | hid_wrapper_udev_device_get_sysattr_value_type) (struct udev_device *udev_device, const char *sysattr) |
| typedef struct udev_device *(* | hid_wrapper_udev_device_new_from_devnum_type) (struct udev *udev, char type, dev_t devnum) |
| typedef struct udev_device *(* | hid_wrapper_udev_device_new_from_syspath_type) (struct udev *udev, const char *syspath) |
| typedef struct udev_device *(* | hid_wrapper_udev_device_unref_type) (struct udev_device *udev_device) |
| typedef int(* | hid_wrapper_udev_enumerate_add_match_subsystem_type) (struct udev_enumerate *udev_enumerate, const char *subsystem) |
| typedef struct udev_list_entry *(* | hid_wrapper_udev_enumerate_get_list_entry_type) (struct udev_enumerate *udev_enumerate) |
| typedef struct udev_enumerate *(* | hid_wrapper_udev_enumerate_new_type) (struct udev *udev) |
| typedef int(* | hid_wrapper_udev_enumerate_scan_devices_type) (struct udev_enumerate *udev_enumerate) |
| typedef struct udev_enumerate *(* | hid_wrapper_udev_enumerate_unref_type) (struct udev_enumerate *udev_enumerate) |
| typedef const char *(* | hid_wrapper_udev_list_entry_get_name_type) (struct udev_list_entry *list_entry) |
| typedef struct udev_list_entry *(* | hid_wrapper_udev_list_entry_get_next_type) (struct udev_list_entry *list_entry) |
| typedef struct udev *(* | hid_wrapper_udev_new_type) (void) |
| typedef struct udev *(* | hid_wrapper_udev_unref_type) (struct udev *udev) |
Enumerations | |
| enum | device_string_id { DEVICE_STRING_MANUFACTURER , DEVICE_STRING_PRODUCT , DEVICE_STRING_SERIAL , DEVICE_STRING_COUNT } |
Functions | |
| static void | hid_wrapper_udev_close () |
| static int | hid_wrapper_udev_init () |
| static __u32 | detect_kernel_version (void) |
| static hid_device * | new_hid_device (void) |
| static wchar_t * | utf8_to_wchar_t (const char *utf8) |
| static wchar_t * | copy_udev_string (struct udev_device *dev, const char *udev_name) |
| static int | uses_numbered_reports (__u8 *report_descriptor, __u32 size) |
| static int | parse_uevent_info (const char *uevent, int *bus_type, unsigned short *vendor_id, unsigned short *product_id, char **serial_number_utf8, char **product_name_utf8) |
| static int | get_device_string (hid_device *dev, enum device_string_id key, wchar_t *string, size_t maxlen) |
| int HID_API_EXPORT | hid_init (void) |
| Initialize the HIDAPI library. | |
| int HID_API_EXPORT | hid_exit (void) |
| Finalize the HIDAPI library. | |
| 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_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. | |
| hid_device *HID_API_EXPORT | hid_open_path (const char *path) |
| Open a HID device by its path name. | |
| int HID_API_EXPORT | hid_write (hid_device *dev, const unsigned char *data, size_t length) |
| Write an Output report to a HID device. | |
| 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. | |
| 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 HIDIOCGFEATURE | ( | len | ) | _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len) |
| #define HIDIOCSFEATURE | ( | len | ) | _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) |
| typedef const char *(* hid_wrapper_udev_device_get_devnode_type) (struct udev_device *udev_device) |
| typedef struct udev_device *(* hid_wrapper_udev_device_get_parent_with_subsystem_devtype_type) (struct udev_device *udev_device, const char *subsystem, const char *devtype) |
| typedef const char *(* hid_wrapper_udev_device_get_sysattr_value_type) (struct udev_device *udev_device, const char *sysattr) |
| typedef struct udev_device *(* hid_wrapper_udev_device_new_from_devnum_type) (struct udev *udev, char type, dev_t devnum) |
| typedef struct udev_device *(* hid_wrapper_udev_device_new_from_syspath_type) (struct udev *udev, const char *syspath) |
| typedef struct udev_device *(* hid_wrapper_udev_device_unref_type) (struct udev_device *udev_device) |
| typedef int(* hid_wrapper_udev_enumerate_add_match_subsystem_type) (struct udev_enumerate *udev_enumerate, const char *subsystem) |
| typedef struct udev_list_entry *(* hid_wrapper_udev_enumerate_get_list_entry_type) (struct udev_enumerate *udev_enumerate) |
| typedef struct udev_enumerate *(* hid_wrapper_udev_enumerate_new_type) (struct udev *udev) |
| typedef int(* hid_wrapper_udev_enumerate_scan_devices_type) (struct udev_enumerate *udev_enumerate) |
| typedef struct udev_enumerate *(* hid_wrapper_udev_enumerate_unref_type) (struct udev_enumerate *udev_enumerate) |
| typedef const char *(* hid_wrapper_udev_list_entry_get_name_type) (struct udev_list_entry *list_entry) |
| typedef struct udev_list_entry *(* hid_wrapper_udev_list_entry_get_next_type) (struct udev_list_entry *list_entry) |
| typedef struct udev *(* hid_wrapper_udev_new_type) (void) |
| typedef struct udev *(* hid_wrapper_udev_unref_type) (struct udev *udev) |
| enum device_string_id |
| Enumerator | |
|---|---|
| DEVICE_STRING_MANUFACTURER | |
| DEVICE_STRING_PRODUCT | |
| DEVICE_STRING_SERIAL | |
| DEVICE_STRING_COUNT | |
|
static |
References hid_wrapper_udev_device_get_sysattr_value, and utf8_to_wchar_t().
Referenced by hid_enumerate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Referenced by hid_init().
Here is the caller graph for this function:
|
static |
References hid_device_::device_handle, DEVICE_STRING_COUNT, DEVICE_STRING_MANUFACTURER, device_string_names, DEVICE_STRING_PRODUCT, DEVICE_STRING_SERIAL, free(), hid_wrapper_udev_device_get_parent_with_subsystem_devtype, hid_wrapper_udev_device_get_sysattr_value, hid_wrapper_udev_device_new_from_devnum, hid_wrapper_udev_device_unref, hid_wrapper_udev_new, hid_wrapper_udev_unref, L, parse_uevent_info(), and stat.
Referenced by hid_get_manufacturer_string(), hid_get_product_string(), and hid_get_serial_number_string().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References hid_wrapper_handle, hid_wrapper_udev_device_get_devnode, hid_wrapper_udev_device_get_parent_with_subsystem_devtype, hid_wrapper_udev_device_get_sysattr_value, hid_wrapper_udev_device_new_from_devnum, hid_wrapper_udev_device_new_from_syspath, hid_wrapper_udev_device_unref, hid_wrapper_udev_enumerate_add_match_subsystem, hid_wrapper_udev_enumerate_get_list_entry, hid_wrapper_udev_enumerate_new, hid_wrapper_udev_enumerate_scan_devices, hid_wrapper_udev_enumerate_unref, hid_wrapper_udev_list_entry_get_name, hid_wrapper_udev_list_entry_get_next, hid_wrapper_udev_new, and hid_wrapper_udev_unref.
Referenced by hid_exit(), and hid_wrapper_udev_init().
Here is the caller graph for this function:
|
static |
References hid_wrapper_handle, hid_wrapper_libudev_paths, hid_wrapper_udev_close(), hid_wrapper_udev_device_get_devnode, hid_wrapper_udev_device_get_parent_with_subsystem_devtype, hid_wrapper_udev_device_get_sysattr_value, hid_wrapper_udev_device_new_from_devnum, hid_wrapper_udev_device_new_from_syspath, hid_wrapper_udev_device_unref, hid_wrapper_udev_enumerate_add_match_subsystem, hid_wrapper_udev_enumerate_get_list_entry, hid_wrapper_udev_enumerate_new, hid_wrapper_udev_enumerate_scan_devices, hid_wrapper_udev_enumerate_unref, hid_wrapper_udev_list_entry_get_name, hid_wrapper_udev_list_entry_get_next, hid_wrapper_udev_new, and hid_wrapper_udev_unref.
Referenced by hid_init().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References hid_device_::blocking, hid_device_::device_handle, and hid_device_::uses_numbered_reports.
|
static |
type vendor product
HID_ID=0003:000005AC:00008242
References free().
Referenced by get_device_string(), and hid_enumerate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Referenced by hid_open_path().
Here is the caller graph for this function:
|
static |
References L.
Referenced by copy_udev_string(), and hid_enumerate().
Here is the caller graph for this function:| const char* device_string_names[] |
Referenced by get_device_string(), and hid_enumerate().
| void* hid_wrapper_handle = NULL |
Referenced by hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_wrapper_udev_init().
|
static |
Referenced by hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by get_device_string(), hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by copy_udev_string(), get_device_string(), hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by get_device_string(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by get_device_string(), hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by get_device_string(), hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by get_device_string(), hid_enumerate(), hid_wrapper_udev_close(), and hid_wrapper_udev_init().
|
static |
Referenced by hid_init(), and hid_read_timeout().