Skip to content

Commit

Permalink
arm64: add support for libusb0 on arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
dontech committed Jan 5, 2024
1 parent 90278c5 commit fa410c7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions libwdi/embedder_files.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fa410c7

Please sign in to comment.