Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change windows driver usage #323

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed cmake/Hantek_6022B.cat
Binary file not shown.
30 changes: 0 additions & 30 deletions cmake/Hantek_6022B.inf

This file was deleted.

24 changes: 0 additions & 24 deletions cmake/OpenHantek_driver/OpenHantek.inf

This file was deleted.

88 changes: 51 additions & 37 deletions cmake/libusb_on_windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,30 @@ endif()

# set file names for lib and associated inf/cat files
set(LIBUSB_7Z "${CMAKE_CURRENT_LIST_DIR}/libusb-1.0.21-win.7z")
# use updated cat/inf files provided by VictorEEV
set(HANTEK_6022B_CAT "${CMAKE_CURRENT_LIST_DIR}/OpenHantek_driver/OpenHantek.cat")
set(HANTEK_6022B_INF "${CMAKE_CURRENT_LIST_DIR}/OpenHantek_driver/OpenHantek.inf")
# use "new" cat/inf files provided by fgrieu (PR #251)
set(INF_DIR "${CMAKE_CURRENT_LIST_DIR}/../utils/signed-windows-inf-files")
set(HANTEK_6022BE_LOADER_CAT "${INF_DIR}/Hantek_6022BE_loader.cat")
set(HANTEK_6022BE_LOADER_INF "${INF_DIR}/Hantek_6022BE_loader.inf")
set(HANTEK_6022BE_OPENHT_CAT "${INF_DIR}/Hantek_6022BE_openht.cat")
set(HANTEK_6022BE_OPENHT_INF "${INF_DIR}/Hantek_6022BE_openht.inf")
set(HANTEK_6022BE_SIGROK_CAT "${INF_DIR}/Hantek_6022BE_sigrok.cat")
set(HANTEK_6022BE_SIGROK_INF "${INF_DIR}/Hantek_6022BE_sigrok.inf")
set(HANTEK_6022BL_LOADER_CAT "${INF_DIR}/Hantek_6022BL_loader.cat")
set(HANTEK_6022BL_LOADER_INF "${INF_DIR}/Hantek_6022BL_loader.inf")
set(HANTEK_6022BL_OPENHT_CAT "${INF_DIR}/Hantek_6022BL_openht.cat")
set(HANTEK_6022BL_OPENHT_INF "${INF_DIR}/Hantek_6022BL_openht.inf")
set(HANTEK_6022BL_SIGROK_CAT "${INF_DIR}/Hantek_6022BL_sigrok.cat")
set(HANTEK_6022BL_SIGROK_INF "${INF_DIR}/Hantek_6022BL_sigrok.inf")
set(README_INSTALL_TXT "${INF_DIR}/README_INSTALL.txt")
set(LIBUSB_DIR "${CMAKE_BINARY_DIR}/libusb-1.0.21-win")
set(INF_DIR "${CMAKE_CURRENT_LIST_DIR}/../utils/windows_drivers")
set(DRIVER_DIR "driver")

if (USE_OPENHANTEK_DRIVER)
# use updated cat/inf files provided by VictorEEV
set(OPENHANTEK_CAT "${INF_DIR}/openhantek/OpenHantek.cat")
set(OPENHANTEK_INF "${INF_DIR}/openhantek/OpenHantek.inf")
else()
# use "new" cat/inf files provided by fgrieu (PR #251)
set(HANTEK_6022BE_LOADER_CAT "${INF_DIR}/fgrieu/Hantek_6022BE_loader.cat")
set(HANTEK_6022BE_LOADER_INF "${INF_DIR}/fgrieu/Hantek_6022BE_loader.inf")
set(HANTEK_6022BE_OPENHT_CAT "${INF_DIR}/fgrieu/Hantek_6022BE_openht.cat")
set(HANTEK_6022BE_OPENHT_INF "${INF_DIR}/fgrieu/Hantek_6022BE_openht.inf")
set(HANTEK_6022BE_SIGROK_CAT "${INF_DIR}/fgrieu/Hantek_6022BE_sigrok.cat")
set(HANTEK_6022BE_SIGROK_INF "${INF_DIR}/fgrieu/Hantek_6022BE_sigrok.inf")
set(HANTEK_6022BL_LOADER_CAT "${INF_DIR}/fgrieu/Hantek_6022BL_loader.cat")
set(HANTEK_6022BL_LOADER_INF "${INF_DIR}/fgrieu/Hantek_6022BL_loader.inf")
set(HANTEK_6022BL_OPENHT_CAT "${INF_DIR}/fgrieu/Hantek_6022BL_openht.cat")
set(HANTEK_6022BL_OPENHT_INF "${INF_DIR}/fgrieu/Hantek_6022BL_openht.inf")
set(HANTEK_6022BL_SIGROK_CAT "${INF_DIR}/fgrieu/Hantek_6022BL_sigrok.cat")
set(HANTEK_6022BL_SIGROK_INF "${INF_DIR}/fgrieu/Hantek_6022BL_sigrok.inf")
set(README_INSTALL_TXT "${INF_DIR}/fgrieu/README_INSTALL.txt")
endif()

execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf "${LIBUSB_7Z}"
Expand All @@ -48,24 +53,33 @@ target_link_libraries(${PROJECT_NAME} "${LIBUSB_DIR}/${ARCH}/libusb-1.0.lib")
target_include_directories(${PROJECT_NAME} PRIVATE "${LIBUSB_DIR}" "${LIBUSB_DIR}/libusb-1.0")

# execute commands
add_custom_command(TARGET ${PROJECT_NAME}
if (USE_OPENHANTEK_DRIVER)
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LIBUSB_DIR}/${ARCH}/libusb-1.0.dll" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022B_CAT}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022B_INF}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_LOADER_CAT}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_LOADER_INF}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_OPENHT_CAT}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_OPENHT_INF}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_SIGROK_CAT}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_SIGROK_INF}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_LOADER_CAT}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_LOADER_INF}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_OPENHT_CAT}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_OPENHT_INF}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_SIGROK_CAT}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_SIGROK_INF}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${README_INSTALL_TXT}" $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENHANTEK_CAT}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENHANTEK_INF}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LIBUSB_DIR}/${ARCH}/libusb-1.0.dll" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
COMMENT "Copy libusb-1 dlls and inf/cat files for ${PROJECT_NAME}"
)

)
else()
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_LOADER_CAT}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_LOADER_INF}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_OPENHT_CAT}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_OPENHT_INF}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_SIGROK_CAT}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BE_SIGROK_INF}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_LOADER_CAT}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_LOADER_INF}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_OPENHT_CAT}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_OPENHT_INF}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_SIGROK_CAT}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HANTEK_6022BL_SIGROK_INF}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${README_INSTALL_TXT}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${DRIVER_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LIBUSB_DIR}/${ARCH}/libusb-1.0.dll" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
COMMENT "Copy libusb-1 dlls and inf/cat files for ${PROJECT_NAME}"
)
endif()
2 changes: 2 additions & 0 deletions openhantek/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ if(WIN32 AND MINGW)
set(EXECTYPE WIN32)
endif()

option(USE_OPENHANTEK_DRIVER "Use OpenHantek Windows driver" ON)

# Enable MacOSX bundle magic in the next line
option(BUILD_MACOSX_BUNDLE "Build MacOS app bundle" ON)
#
Expand Down
File renamed without changes.
Binary file not shown.
26 changes: 26 additions & 0 deletions utils/windows_drivers/openhantek/OpenHantek.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[Version]
Signature = "$Windows NT$"
Class = USBDevice
ClassGuid = {88BAE032-5A81-49F0-BC3D-A4FF138216D6}
Provider = "Windows"
CatalogFile = OpenHantek.cat
DriverVer = 08/01/2022, 1.0.0.0

[Manufacturer]
"Hantek" = Device, NTamd64

[Device.NTamd64]
"Hantek 6022BE - Loader" = Install, USB\VID_04B4&PID_6022
"Hantek 6022BE - OpenHantek" = Install, USB\VID_04B5&PID_6022
"Hantek 6022BE - Sigrok" = Install, USB\VID_1D50&PID_608E&REV_0000
"Hantek 6022BL - Loader" = Install, USB\VID_04B4&PID_602A
"Hantek 6022BL - OpenHantek" = Install, USB\VID_04B5&PID_602A
"Hantek 6022BL - Sigrok" = Install, USB\VID_1D50&PID_608E&REV_0003

[Install]
Include = WinUSB.inf
Needs = WinUSB.NT

[Install.Services]
Include = WinUSB.inf
Needs = WinUSB.NT.Services