diff --git a/CMakeLists.txt b/CMakeLists.txt index 66ef3a74..d468919a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb281b70..3a87ffa9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) diff --git a/src/cmake_config.h.in b/src/cmake_config.h.in index 4b051b04..7f665ba5 100644 --- a/src/cmake_config.h.in +++ b/src/cmake_config.h.in @@ -79,9 +79,6 @@ /* Define to 1 if you have the 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 diff --git a/src/msvc/msvc_compat.h b/src/msvc/msvc_compat.h index 2c072b3b..9ccddaaf 100644 --- a/src/msvc/msvc_compat.h +++ b/src/msvc/msvc_compat.h @@ -23,11 +23,6 @@ #include #include -#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 diff --git a/src/pickit2.c b/src/pickit2.c index 7014b069..fd4851dc 100644 --- a/src/pickit2.c +++ b/src/pickit2.c @@ -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 #include @@ -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";