Added support for Streamdeck Pedal and updated UI to better fit the Packed UI style
This commit is contained in:
107
node_modules/node-hid/hidapi/libusb/CMakeLists.txt
generated
vendored
Normal file
107
node_modules/node-hid/hidapi/libusb/CMakeLists.txt
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
cmake_minimum_required(VERSION 3.6.3...3.25 FATAL_ERROR)
|
||||
|
||||
list(APPEND HIDAPI_PUBLIC_HEADERS "hidapi_libusb.h")
|
||||
|
||||
add_library(hidapi_libusb
|
||||
${HIDAPI_PUBLIC_HEADERS}
|
||||
hid.c
|
||||
)
|
||||
target_link_libraries(hidapi_libusb PUBLIC hidapi_include)
|
||||
|
||||
if(TARGET usb-1.0)
|
||||
target_link_libraries(hidapi_libusb PRIVATE usb-1.0)
|
||||
else()
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0>=1.0.9)
|
||||
target_link_libraries(hidapi_libusb PRIVATE PkgConfig::libusb)
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(hidapi_libusb PRIVATE Threads::Threads)
|
||||
|
||||
if(HIDAPI_NO_ICONV)
|
||||
target_compile_definitions(hidapi_libusb PRIVATE NO_ICONV)
|
||||
else()
|
||||
if(NOT ANDROID)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.11)
|
||||
message(STATUS "Check for Iconv")
|
||||
find_package(Iconv)
|
||||
if(Iconv_FOUND)
|
||||
if(NOT Iconv_IS_BUILT_IN)
|
||||
target_link_libraries(hidapi_libusb PRIVATE Iconv::Iconv)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "Iconv::Iconv")
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set(HIDAPI_NEED_EXPORT_ICONV TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Iconv Explicitly check '-liconv'")
|
||||
# Sometime the build environment is not setup
|
||||
# in a way CMake can find Iconv on its own by default.
|
||||
# But if we simply link against iconv (-liconv), the build may succeed
|
||||
# due to other compiler/link flags.
|
||||
set(CMAKE_REQUIRED_LIBRARIES "iconv")
|
||||
check_c_source_compiles("
|
||||
#include <stddef.h>
|
||||
#include <iconv.h>
|
||||
int main() {
|
||||
char *a, *b;
|
||||
size_t i, j;
|
||||
iconv_t ic;
|
||||
ic = iconv_open(\"to\", \"from\");
|
||||
iconv(ic, &a, &i, &b, &j);
|
||||
iconv_close(ic);
|
||||
}
|
||||
"
|
||||
Iconv_EXPLICITLY_AT_ENV)
|
||||
if(Iconv_EXPLICITLY_AT_ENV)
|
||||
message(STATUS "Iconv Explicitly check '-liconv' - Available")
|
||||
target_link_libraries(hidapi_libusb PRIVATE iconv)
|
||||
else()
|
||||
message(FATAL_ERROR "Iconv is not found, make sure to provide it in the build environment")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# otherwise there is 2 options:
|
||||
# 1) iconv is provided by Standard C library and the build will be just fine
|
||||
# 2) The _user_ has to provide additional compilation options for this project/target
|
||||
endif()
|
||||
|
||||
# check for error: "conflicting types for 'iconv'"
|
||||
check_c_source_compiles("#include<iconv.h>
|
||||
extern size_t iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
|
||||
int main() {}"
|
||||
HIDAPI_ICONV_CONST)
|
||||
if(HIDAPI_ICONV_CONST)
|
||||
target_compile_definitions(hidapi_libusb PRIVATE "ICONV_CONST=const")
|
||||
endif()
|
||||
else()
|
||||
# On Android Iconv is disabled on the code level anyway, so no issue;
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(hidapi_libusb
|
||||
PROPERTIES
|
||||
EXPORT_NAME "libusb"
|
||||
OUTPUT_NAME "hidapi-libusb"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
PUBLIC_HEADER "${HIDAPI_PUBLIC_HEADERS}"
|
||||
)
|
||||
|
||||
# compatibility with find_package()
|
||||
add_library(hidapi::libusb ALIAS hidapi_libusb)
|
||||
# compatibility with raw library link
|
||||
add_library(hidapi-libusb ALIAS hidapi_libusb)
|
||||
|
||||
if(HIDAPI_INSTALL_TARGETS)
|
||||
install(TARGETS hidapi_libusb EXPORT hidapi
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/hidapi"
|
||||
)
|
||||
endif()
|
||||
|
||||
hidapi_configure_pc("${PROJECT_ROOT}/pc/hidapi-libusb.pc.in")
|
||||
22
node_modules/node-hid/hidapi/libusb/Makefile-manual
generated
vendored
Normal file
22
node_modules/node-hid/hidapi/libusb/Makefile-manual
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
OS=$(shell uname)
|
||||
|
||||
ifeq ($(OS), Linux)
|
||||
FILE=Makefile.linux
|
||||
endif
|
||||
|
||||
ifeq ($(OS), FreeBSD)
|
||||
FILE=Makefile.freebsd
|
||||
endif
|
||||
|
||||
ifeq ($(OS), Haiku)
|
||||
FILE=Makefile.haiku
|
||||
endif
|
||||
|
||||
ifeq ($(FILE), )
|
||||
all:
|
||||
$(error Your platform ${OS} is not supported by hidapi/libusb at this time.)
|
||||
endif
|
||||
|
||||
include $(FILE)
|
||||
34
node_modules/node-hid/hidapi/libusb/Makefile.am
generated
vendored
Normal file
34
node_modules/node-hid/hidapi/libusb/Makefile.am
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/hidapi $(CFLAGS_LIBUSB)
|
||||
|
||||
if OS_LINUX
|
||||
lib_LTLIBRARIES = libhidapi-libusb.la
|
||||
libhidapi_libusb_la_SOURCES = hid.c
|
||||
libhidapi_libusb_la_LDFLAGS = $(LTLDFLAGS) $(PTHREAD_CFLAGS)
|
||||
libhidapi_libusb_la_LIBADD = $(LIBS_LIBUSB)
|
||||
endif
|
||||
|
||||
if OS_FREEBSD
|
||||
lib_LTLIBRARIES = libhidapi.la
|
||||
libhidapi_la_SOURCES = hid.c
|
||||
libhidapi_la_LDFLAGS = $(LTLDFLAGS)
|
||||
libhidapi_la_LIBADD = $(LIBS_LIBUSB)
|
||||
endif
|
||||
|
||||
if OS_KFREEBSD
|
||||
lib_LTLIBRARIES = libhidapi.la
|
||||
libhidapi_la_SOURCES = hid.c
|
||||
libhidapi_la_LDFLAGS = $(LTLDFLAGS)
|
||||
libhidapi_la_LIBADD = $(LIBS_LIBUSB)
|
||||
endif
|
||||
|
||||
if OS_HAIKU
|
||||
lib_LTLIBRARIES = libhidapi.la
|
||||
libhidapi_la_SOURCES = hid.c
|
||||
libhidapi_la_LDFLAGS = $(LTLDFLAGS)
|
||||
libhidapi_la_LIBADD = $(LIBS_LIBUSB)
|
||||
endif
|
||||
|
||||
hdrdir = $(includedir)/hidapi
|
||||
hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h hidapi_libusb.h
|
||||
|
||||
EXTRA_DIST = Makefile-manual
|
||||
39
node_modules/node-hid/hidapi/libusb/Makefile.freebsd
generated
vendored
Normal file
39
node_modules/node-hid/hidapi/libusb/Makefile.freebsd
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
###########################################
|
||||
# Simple Makefile for HIDAPI test program
|
||||
#
|
||||
# Alan Ott
|
||||
# Signal 11 Software
|
||||
# 2010-06-01
|
||||
###########################################
|
||||
|
||||
all: hidtest libs
|
||||
|
||||
libs: libhidapi.so
|
||||
|
||||
CC ?= cc
|
||||
CFLAGS ?= -Wall -g -fPIC
|
||||
|
||||
COBJS = hid.o ../hidtest/test.o
|
||||
OBJS = $(COBJS)
|
||||
INCLUDES = -I../hidapi -I. -I/usr/local/include
|
||||
LDFLAGS = -L/usr/local/lib
|
||||
LIBS = -lusb -liconv -pthread
|
||||
|
||||
|
||||
# Console Test Program
|
||||
hidtest: $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||
|
||||
# Shared Libs
|
||||
libhidapi.so: $(COBJS)
|
||||
$(CC) $(LDFLAGS) -shared -Wl,-soname,$@.0 $^ -o $@ $(LIBS)
|
||||
|
||||
# Objects
|
||||
$(COBJS): %.o: %.c
|
||||
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o
|
||||
|
||||
.PHONY: clean libs
|
||||
39
node_modules/node-hid/hidapi/libusb/Makefile.haiku
generated
vendored
Normal file
39
node_modules/node-hid/hidapi/libusb/Makefile.haiku
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
###########################################
|
||||
# Simple Makefile for HIDAPI test program
|
||||
#
|
||||
# Alan Ott
|
||||
# Signal 11 Software
|
||||
# 2010-06-01
|
||||
###########################################
|
||||
|
||||
all: hidtest libs
|
||||
|
||||
libs: libhidapi.so
|
||||
|
||||
CC ?= cc
|
||||
CFLAGS ?= -Wall -g -fPIC
|
||||
|
||||
COBJS = hid.o ../hidtest/test.o
|
||||
OBJS = $(COBJS)
|
||||
INCLUDES = -I../hidapi -I. -I/usr/local/include
|
||||
LDFLAGS = -L/usr/local/lib
|
||||
LIBS = -lusb -liconv -pthread
|
||||
|
||||
|
||||
# Console Test Program
|
||||
hidtest: $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||
|
||||
# Shared Libs
|
||||
libhidapi.so: $(COBJS)
|
||||
$(CC) $(LDFLAGS) -shared -Wl,-soname,$@.0 $^ -o $@ $(LIBS)
|
||||
|
||||
# Objects
|
||||
$(COBJS): %.o: %.c
|
||||
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o
|
||||
|
||||
.PHONY: clean libs
|
||||
42
node_modules/node-hid/hidapi/libusb/Makefile.linux
generated
vendored
Normal file
42
node_modules/node-hid/hidapi/libusb/Makefile.linux
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
###########################################
|
||||
# Simple Makefile for HIDAPI test program
|
||||
#
|
||||
# Alan Ott
|
||||
# Signal 11 Software
|
||||
# 2010-06-01
|
||||
###########################################
|
||||
|
||||
all: hidtest-libusb libs
|
||||
|
||||
libs: libhidapi-libusb.so
|
||||
|
||||
CC ?= gcc
|
||||
CFLAGS ?= -Wall -g -fpic
|
||||
|
||||
LDFLAGS ?= -Wall -g
|
||||
|
||||
COBJS_LIBUSB = hid.o
|
||||
COBJS = $(COBJS_LIBUSB) ../hidtest/test.o
|
||||
OBJS = $(COBJS)
|
||||
LIBS_USB = `pkg-config libusb-1.0 --libs` -lrt -lpthread
|
||||
LIBS = $(LIBS_USB)
|
||||
INCLUDES ?= -I../hidapi -I. `pkg-config libusb-1.0 --cflags`
|
||||
|
||||
|
||||
# Console Test Program
|
||||
hidtest-libusb: $(COBJS)
|
||||
$(CC) $(LDFLAGS) $^ $(LIBS_USB) -o $@
|
||||
|
||||
# Shared Libs
|
||||
libhidapi-libusb.so: $(COBJS_LIBUSB)
|
||||
$(CC) $(LDFLAGS) $(LIBS_USB) -shared -fpic -Wl,-soname,$@.0 $^ -o $@
|
||||
|
||||
# Objects
|
||||
$(COBJS): %.o: %.c
|
||||
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) hidtest-libusb libhidapi-libusb.so ../hidtest/hidtest.o
|
||||
|
||||
.PHONY: clean libs
|
||||
2018
node_modules/node-hid/hidapi/libusb/hid.c
generated
vendored
Normal file
2018
node_modules/node-hid/hidapi/libusb/hid.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
56
node_modules/node-hid/hidapi/libusb/hidapi_libusb.h
generated
vendored
Normal file
56
node_modules/node-hid/hidapi/libusb/hidapi_libusb.h
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*******************************************************
|
||||
HIDAPI - Multi-Platform library for
|
||||
communication with HID devices.
|
||||
|
||||
libusb/hidapi Team
|
||||
|
||||
Copyright 2021, All Rights Reserved.
|
||||
|
||||
At the discretion of the user of this library,
|
||||
this software may be licensed under the terms of the
|
||||
GNU General Public License v3, a BSD-Style license, or the
|
||||
original HIDAPI license as outlined in the LICENSE.txt,
|
||||
LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
|
||||
files located at the root of the source distribution.
|
||||
These files may also be found in the public source
|
||||
code repository located at:
|
||||
https://github.com/libusb/hidapi .
|
||||
********************************************************/
|
||||
|
||||
/** @file
|
||||
* @defgroup API hidapi API
|
||||
|
||||
* Since version 0.11.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 11, 0).
|
||||
*/
|
||||
|
||||
#ifndef HIDAPI_LIBUSB_H__
|
||||
#define HIDAPI_LIBUSB_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "hidapi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @brief Open a HID device using libusb_wrap_sys_device.
|
||||
See https://libusb.sourceforge.io/api-1.0/group__libusb__dev.html#ga98f783e115ceff4eaf88a60e6439563c,
|
||||
for details on libusb_wrap_sys_device.
|
||||
|
||||
@ingroup API
|
||||
@param sys_dev Platform-specific file descriptor that can be recognised by libusb.
|
||||
@param interface_num USB interface number of the device to be used as HID interface.
|
||||
Pass -1 to select first HID interface of the device.
|
||||
|
||||
@returns
|
||||
This function returns a pointer to a #hid_device object on
|
||||
success or NULL on failure.
|
||||
*/
|
||||
HID_API_EXPORT hid_device * HID_API_CALL hid_libusb_wrap_sys_device(intptr_t sys_dev, int interface_num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
174
node_modules/node-hid/hidapi/libusb/hidapi_thread_pthread.h
generated
vendored
Normal file
174
node_modules/node-hid/hidapi/libusb/hidapi_thread_pthread.h
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
/*******************************************************
|
||||
HIDAPI - Multi-Platform library for
|
||||
communication with HID devices.
|
||||
|
||||
Alan Ott
|
||||
Signal 11 Software
|
||||
|
||||
libusb/hidapi Team
|
||||
|
||||
Sam Lantinga
|
||||
|
||||
Copyright 2023, All Rights Reserved.
|
||||
|
||||
At the discretion of the user of this library,
|
||||
this software may be licensed under the terms of the
|
||||
GNU General Public License v3, a BSD-Style license, or the
|
||||
original HIDAPI license as outlined in the LICENSE.txt,
|
||||
LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
|
||||
files located at the root of the source distribution.
|
||||
These files may also be found in the public source
|
||||
code repository located at:
|
||||
https://github.com/libusb/hidapi .
|
||||
********************************************************/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#if defined(__ANDROID__) && __ANDROID_API__ < __ANDROID_API_N__
|
||||
|
||||
/* Barrier implementation because Android/Bionic don't have pthread_barrier.
|
||||
This implementation came from Brent Priddy and was posted on
|
||||
StackOverflow. It is used with his permission. */
|
||||
typedef int pthread_barrierattr_t;
|
||||
typedef struct pthread_barrier {
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
int count;
|
||||
int trip_count;
|
||||
} pthread_barrier_t;
|
||||
|
||||
static int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
|
||||
{
|
||||
if(count == 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(pthread_mutex_init(&barrier->mutex, 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if(pthread_cond_init(&barrier->cond, 0) < 0) {
|
||||
pthread_mutex_destroy(&barrier->mutex);
|
||||
return -1;
|
||||
}
|
||||
barrier->trip_count = count;
|
||||
barrier->count = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pthread_barrier_destroy(pthread_barrier_t *barrier)
|
||||
{
|
||||
pthread_cond_destroy(&barrier->cond);
|
||||
pthread_mutex_destroy(&barrier->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pthread_barrier_wait(pthread_barrier_t *barrier)
|
||||
{
|
||||
pthread_mutex_lock(&barrier->mutex);
|
||||
++(barrier->count);
|
||||
if(barrier->count >= barrier->trip_count) {
|
||||
barrier->count = 0;
|
||||
pthread_cond_broadcast(&barrier->cond);
|
||||
pthread_mutex_unlock(&barrier->mutex);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
pthread_cond_wait(&barrier->cond, &(barrier->mutex));
|
||||
pthread_mutex_unlock(&barrier->mutex);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define HIDAPI_THREAD_TIMED_OUT ETIMEDOUT
|
||||
|
||||
typedef struct timespec hidapi_timespec;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pthread_t thread;
|
||||
pthread_mutex_t mutex; /* Protects input_reports */
|
||||
pthread_cond_t condition;
|
||||
pthread_barrier_t barrier; /* Ensures correct startup sequence */
|
||||
|
||||
} hidapi_thread_state;
|
||||
|
||||
static void hidapi_thread_state_init(hidapi_thread_state *state)
|
||||
{
|
||||
pthread_mutex_init(&state->mutex, NULL);
|
||||
pthread_cond_init(&state->condition, NULL);
|
||||
pthread_barrier_init(&state->barrier, NULL, 2);
|
||||
}
|
||||
|
||||
static void hidapi_thread_state_destroy(hidapi_thread_state *state)
|
||||
{
|
||||
pthread_barrier_destroy(&state->barrier);
|
||||
pthread_cond_destroy(&state->condition);
|
||||
pthread_mutex_destroy(&state->mutex);
|
||||
}
|
||||
|
||||
#define hidapi_thread_cleanup_push pthread_cleanup_push
|
||||
#define hidapi_thread_cleanup_pop pthread_cleanup_pop
|
||||
|
||||
static void hidapi_thread_mutex_lock(hidapi_thread_state *state)
|
||||
{
|
||||
pthread_mutex_lock(&state->mutex);
|
||||
}
|
||||
|
||||
static void hidapi_thread_mutex_unlock(hidapi_thread_state *state)
|
||||
{
|
||||
pthread_mutex_unlock(&state->mutex);
|
||||
}
|
||||
|
||||
static void hidapi_thread_cond_wait(hidapi_thread_state *state)
|
||||
{
|
||||
pthread_cond_wait(&state->condition, &state->mutex);
|
||||
}
|
||||
|
||||
static int hidapi_thread_cond_timedwait(hidapi_thread_state *state, hidapi_timespec *ts)
|
||||
{
|
||||
return pthread_cond_timedwait(&state->condition, &state->mutex, ts);
|
||||
}
|
||||
|
||||
static void hidapi_thread_cond_signal(hidapi_thread_state *state)
|
||||
{
|
||||
pthread_cond_signal(&state->condition);
|
||||
}
|
||||
|
||||
static void hidapi_thread_cond_broadcast(hidapi_thread_state *state)
|
||||
{
|
||||
pthread_cond_broadcast(&state->condition);
|
||||
}
|
||||
|
||||
static void hidapi_thread_barrier_wait(hidapi_thread_state *state)
|
||||
{
|
||||
pthread_barrier_wait(&state->barrier);
|
||||
}
|
||||
|
||||
static void hidapi_thread_create(hidapi_thread_state *state, void *(*func)(void*), void *func_arg)
|
||||
{
|
||||
pthread_create(&state->thread, NULL, func, func_arg);
|
||||
}
|
||||
|
||||
static void hidapi_thread_join(hidapi_thread_state *state)
|
||||
{
|
||||
pthread_join(state->thread, NULL);
|
||||
}
|
||||
|
||||
static void hidapi_thread_gettime(hidapi_timespec *ts)
|
||||
{
|
||||
clock_gettime(CLOCK_REALTIME, ts);
|
||||
}
|
||||
|
||||
static void hidapi_thread_addtime(hidapi_timespec *ts, int milliseconds)
|
||||
{
|
||||
ts->tv_sec += milliseconds / 1000;
|
||||
ts->tv_nsec += (milliseconds % 1000) * 1000000;
|
||||
if (ts->tv_nsec >= 1000000000L) {
|
||||
ts->tv_sec++;
|
||||
ts->tv_nsec -= 1000000000L;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user