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

arm64: add support for libusb0 on arm64 #314

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:

env:
WDK_URL: https://go.microsoft.com/fwlink/p/?LinkID=253170
LIBUSB0_URL: https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip/download
LIBUSB0_URL: https://github.com/mcuee/libusb-win32/releases/download/snapshot_1.3.0.2/libusb-win32-bin-1.3.0.2.zip
LIBUSBK_URL: https://github.com/mcuee/libusbk/releases/download/V3.1.0.0/libusbK-3.1.0.0-bin.7z
SOLUTION_FILE_PATH: ./libwdi.sln
TARGET_PLATFORM: x64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vs2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:

env:
WDK_URL: https://go.microsoft.com/fwlink/p/?LinkID=253170
LIBUSB0_URL: https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.7.3/libusb-win32-bin-1.2.7.3.zip/download
LIBUSB0_URL: https://github.com/mcuee/libusb-win32/releases/download/release_1.4.0.0/libusb-win32-bin-1.4.0.0.zip
LIBUSBK_URL: https://github.com/mcuee/libusbk/releases/download/V3.1.0.0/libusbK-3.1.0.0-bin.7z
SOLUTION_FILE_PATH: ./libwdi.sln
BUILD_MACROS: '"WDK_DIR=\"../wdk/Windows Kits/8.0\";LIBUSB0_DIR=\"../libusb0\";LIBUSBK_DIR=\"../libusbk/bin\""'
Expand Down
7 changes: 6 additions & 1 deletion libwdi/embedder_files.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ struct emb embeddable_fixed[] = {

// libusb0
#if defined(LIBUSB0_DIR)
{ 0, LIBUSB0_DIR "\\bin\\x86\\libusb0_x86.dll", "x86" },
{ 0, LIBUSB0_DIR "\\bin\\x86\\install-filter.exe", "x86" },
{ 0, LIBUSB0_DIR "\\bin\\x86\\libusb0_x86.dll", "x86" },
# if defined(LIBUSBK_DIR)
# if defined(OPT_M32)
{ 1, "libusb0.dll", "x86" }, // reuse
Expand All @@ -73,6 +73,11 @@ struct emb embeddable_fixed[] = {
{ 0, LIBUSB0_DIR "\\bin\\amd64\\libusb0.sys", "amd64" },
{ 0, LIBUSB0_DIR "\\bin\\amd64\\install-filter.exe", "amd64" },
# endif // OPT_M64
# if defined(OPT_ARM)
{ 0, LIBUSB0_DIR "\\bin\\arm64\\libusb0.dll", "arm64" },
{ 0, LIBUSB0_DIR "\\bin\\arm64\\libusb0.sys", "arm64" },
{ 0, LIBUSB0_DIR "\\bin\\arm64\\install-filter.exe", "arm64" },
# endif // OPT_ARM
{ 0, LIBUSB0_DIR "\\installer_license.txt", "license\\libusb0" },
#endif // LIBUSB0_DIR

Expand Down
19 changes: 17 additions & 2 deletions libwdi/libusb0.inf.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ HKR,,,0,"libusb-win32 devices"
HKR,,Icon,,-20

[Manufacturer]
%VendorName% = Devices, NT, NTAMD64
%VendorName% = Devices, NT, NTAMD64, NTARM64

;--------------------------------------------------------------------------
; libusb-win32 files
Expand All @@ -42,7 +42,10 @@ libusb0.sys = 1,amd64
libusb0.dll = 1,amd64
#LK_DLL# #LK_EQ_X64#
libusb0_x86.dll = 1,x86
#LK_X86_DLL# #LK_EQ_X86#

[SourceDisksFiles.arm64]
libusb0.sys = 1,arm64
libusb0.dll = 1,arm64

[DestinationDirs]
libusb_files_sys = 10,system32\drivers
Expand Down Expand Up @@ -73,6 +76,8 @@ CopyFiles = libusb_files_sys, libusb_files_dll_x86
[LIBUSB_WIN32_DEV.NTAMD64]
CopyFiles = libusb_files_sys, libusb_files_dll, libusb_files_dll_wow64

[LIBUSB_WIN32_DEV.NTARM64]
CopyFiles = libusb_files_sys, libusb_files_dll
[LIBUSB_WIN32_DEV.NT.HW]
DelReg = libusb_del_reg_hw
AddReg = libusb_add_reg_hw
Expand All @@ -81,12 +86,19 @@ AddReg = libusb_add_reg_hw
DelReg = libusb_del_reg_hw
AddReg = libusb_add_reg_hw

[LIBUSB_WIN32_DEV.NTARM64.HW]
DelReg = libusb_del_reg_hw
AddReg = libusb_add_reg_hw

[LIBUSB_WIN32_DEV.NT.Services]
AddService = libusb0, 0x00000002, libusb_add_service

[LIBUSB_WIN32_DEV.NTAMD64.Services]
AddService = libusb0, 0x00000002, libusb_add_service

[LIBUSB_WIN32_DEV.NTARM64.Services]
AddService = libusb0, 0x00000002, libusb_add_service

; Older versions of this .inf file installed filter drivers. They are not
; needed any more and must be removed
[libusb_del_reg_hw]
Expand Down Expand Up @@ -129,3 +141,6 @@ ServiceBinary = %12%\libusb0.sys

[Devices.NTAMD64]
%DeviceName% = LIBUSB_WIN32_DEV.NTAMD64, USB\%DeviceID%

[Devices.NTARM64]
%DeviceName% = LIBUSB_WIN32_DEV.NTARM64, USB\%DeviceID%
2 changes: 1 addition & 1 deletion libwdi/libwdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ BOOL LIBWDI_API wdi_is_driver_supported(int driver_type, VS_FIXEDFILEINFO* drive
#endif
case WDI_LIBUSB0:
#if defined(LIBUSB0_DIR)
return (platform_arch == IMAGE_FILE_MACHINE_AMD64 || platform_arch == IMAGE_FILE_MACHINE_I386);
return (platform_arch == IMAGE_FILE_MACHINE_ARM64 || platform_arch == IMAGE_FILE_MACHINE_AMD64 || platform_arch == IMAGE_FILE_MACHINE_I386);
#else
return FALSE;
#endif
Expand Down
Loading