minor changes for macos compatibility
conditionally comment out detaching usb device kernel drivers with apple builds as macos makes this almost impossible to work - see libusb faq here: https://github.com/libusb/libusb/wiki/FAQ#how-can-i-run-libusb-applications-under-mac-os-x-if-there-is-already-a-kernel-extension-installed-for-the-device-and-claim-exclusive-access this change has been cherry picked from https://github.com/j4nn/xperable/pull/1 only the "macos port" commit from @m1zole, adapted as suggested in the comment https://github.com/j4nn/xperable/pull/1#issuecomment-3716696929
This commit is contained in:
parent
914a83b781
commit
9fd2563406
3 changed files with 4 additions and 2 deletions
2
Makefile
2
Makefile
|
|
@ -122,7 +122,7 @@ $(XPERABLE): xperable-$(CROSS_BUILD).o pe-load-$(CROSS_BUILD).o fbusb-$(CROSS_BU
|
|||
$(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lpe-parse -lusb-1.0
|
||||
|
||||
pe-load-$(CROSS_BUILD).o: pe-load.cpp pe-parse/build-$(CROSS_BUILD)/pe-parser-library/libpe-parse.a
|
||||
$(CXX) $(CFLAGS) -o $@ -c $< -Ipe-parse/pe-parser-library/include
|
||||
$(CXX) $(CFLAGS) -std=c++14 -o $@ -c $< -Ipe-parse/pe-parser-library/include
|
||||
|
||||
pe-parse/CMakeLists.txt:
|
||||
if [ -d .git ]; then git submodule update --init; \
|
||||
|
|
|
|||
2
fbusb.c
2
fbusb.c
|
|
@ -64,12 +64,14 @@ struct fbusb *fbusb_init(int vid, int pid, int iface, int epi, int epo)
|
|||
goto err_exit1;
|
||||
}
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
if (libusb_kernel_driver_active(h, 0) == 1) {
|
||||
if (libusb_detach_kernel_driver(h, 0) != 0) {
|
||||
PERR("libusb_detach_kernel_driver failed\n");
|
||||
goto err_exit2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
res = libusb_claim_interface(h, iface);
|
||||
if (res < 0) {
|
||||
|
|
|
|||
|
|
@ -1150,7 +1150,7 @@ static void show_help(void)
|
|||
}
|
||||
|
||||
|
||||
int main(int argc, unsigned char **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int res;
|
||||
|
|
|
|||
Loading…
Reference in a new issue