CMake: Remove LIB_LIBHID from configuration

This commit is contained in:
Marius Greuel
2023-01-20 20:41:36 +01:00
parent 5ec72e240b
commit c98a49bfcd
5 changed files with 9 additions and 23 deletions

View File

@@ -189,11 +189,6 @@ endif()
# -------------------------------------
# Find libhidapi
find_library(HAVE_LIBHID NAMES hid)
if(HAVE_LIBHID)
set(LIB_LIBHID ${HAVE_LIBHID})
endif()
find_library(HAVE_LIBHIDAPI NAMES ${PREFERRED_LIBHIDAPI})
if(HAVE_LIBHIDAPI)
set(LIB_LIBHIDAPI ${HAVE_LIBHIDAPI})
@@ -307,7 +302,6 @@ if (DEBUG_CMAKE)
message(STATUS "HAVE_LIBUSB: ${HAVE_LIBUSB}")
message(STATUS "HAVE_LIBUSB_1_0: ${HAVE_LIBUSB_1_0}")
message(STATUS "HAVE_LIBUSB_WIN32: ${HAVE_LIBUSB_WIN32}")
message(STATUS "HAVE_LIBHID: ${HAVE_LIBHID}")
message(STATUS "HAVE_LIBHIDAPI: ${HAVE_LIBHIDAPI}")
message(STATUS "HAVE_LIBFTDI: ${HAVE_LIBFTDI}")
message(STATUS "HAVE_LIBFTDI1: ${HAVE_LIBFTDI1}")

View File

@@ -52,7 +52,7 @@ add_compile_definitions(CONFIG_DIR=\"${CONFIG_DIR}\")
if(WIN32)
set(EXTRA_WINDOWS_RESOURCES "${PROJECT_BINARY_DIR}/src/windows.rc")
set(EXTRA_WINDOWS_LIBRARIES setupapi ws2_32)
set(EXTRA_WINDOWS_LIBRARIES setupapi hid ws2_32)
endif()
if(MSVC)

View File

@@ -79,9 +79,6 @@
/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
#cmakedefine HAVE_LIBUSB_1_0_LIBUSB_H 1
/* Define if HID support is enabled via the Win32 DDK */
#cmakedefine HAVE_LIBHID 1
/* Define if HID support is enabled via libhidapi */
#cmakedefine HAVE_LIBHIDAPI 1

View File

@@ -23,11 +23,6 @@
#include <io.h>
#include <malloc.h>
#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "hid.lib")
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "setupapi.lib")
#define strerror_r(errno,buf,len) strerror_s(buf,len,errno)
#define R_OK 4

View File

@@ -54,9 +54,9 @@
#include "avrdude.h"
#include "libavrdude.h"
#if defined(HAVE_LIBUSB) || (defined(WIN32) && defined(HAVE_LIBHID))
#if defined(HAVE_LIBUSB) || defined(WIN32)
#if (defined(WIN32) && defined(HAVE_LIBHID))
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <hidsdi.h>
@@ -88,7 +88,7 @@
#define SPI_MAX_CHUNK (64 - 10) // max packet size less the command overhead
#if (defined(WIN32) && defined(HAVE_LIBHID))
#ifdef WIN32
static HANDLE open_hid(unsigned short vid, unsigned short pid);
static const char *usb_strerror()
{
@@ -116,7 +116,7 @@ static int pickit2_read_report(const PROGRAMMER *pgm, unsigned char report[65]);
*/
struct pdata
{
#if (defined(WIN32) && defined(HAVE_LIBHID))
#ifdef WIN32
HANDLE usb_handle, write_event, read_event;
#else
struct usb_dev_handle *usb_handle; // LIBUSB STUFF
@@ -179,7 +179,7 @@ static void pickit2_teardown(PROGRAMMER * pgm)
}
static int pickit2_open(PROGRAMMER *pgm, const char *port) {
#if (defined(WIN32) && defined(HAVE_LIBHID))
#ifdef WIN32
PDATA(pgm)->usb_handle = open_hid(PICKIT2_VID, PICKIT2_PID);
if (PDATA(pgm)->usb_handle == INVALID_HANDLE_VALUE)
@@ -227,7 +227,7 @@ static int pickit2_open(PROGRAMMER *pgm, const char *port) {
static void pickit2_close(PROGRAMMER * pgm)
{
#if (defined(WIN32) && defined(HAVE_LIBHID))
#ifdef WIN32
CloseHandle(PDATA(pgm)->usb_handle);
CloseHandle(PDATA(pgm)->read_event);
CloseHandle(PDATA(pgm)->write_event);
@@ -788,7 +788,7 @@ static int pickit2_spi(const PROGRAMMER *pgm, const unsigned char *cmd,
return n_bytes;
}
#if (defined(WIN32) && defined(HAVE_LIBHID))
#ifdef WIN32
/*
Func: open_hid()
Desc: finds & opens device having specified VID & PID.
@@ -1298,7 +1298,7 @@ void pickit2_initpgm(PROGRAMMER *pgm) {
strncpy(pgm->type, "pickit2", sizeof(pgm->type));
}
#endif /* defined(HAVE_LIBUSB) || (defined(WIN32) && defined(HAVE_LIBHID)) */
#endif /* defined(HAVE_LIBUSB) || defined(WIN32) */
const char pickit2_desc[] = "Microchip's PICkit2 Programmer";