Commit e7ad4929 authored by phil's avatar phil
Browse files

removed unnecessary submodules and makefile cleanup, macos claim bugfix

parent ed4d308e
[submodule "deps/pd-lib-builder"]
path = deps/pd-lib-builder
url = https://github.com/pure-data/pd-lib-builder/
[submodule "deps/libusb"]
path = deps/libusb
url = https://github.com/libusb/libusb
[submodule "deps/hidapi"]
path = deps/hidapi
url = https://github.com/libusb/hidapi
[submodule "deps/USB-HID-Report-Parser"]
path = deps/USB-HID-Report-Parser
url = https://github.com/tschiemer/USB-HID-Report-Parser
......
PDLIBBUILDER_DIR=${CURDIR}/deps/pd-lib-builder
LIBUSB_DIR=/usr/include/libusb-1.0
HIDAPI_DIR=/usr/include/hidapi
LIBUSB_DIR=/usr/include
HIDAPI_DIR=/usr/include
HIDMAP_DIR=${CURDIR}/deps/USB-HID-Report-Parser
# using invasive detaching.... ahem.
cflags += -I${LIBUSB_DIR} -I${HIDAPI_DIR} -I${HIDMAP_DIR} -DDETACH_KERNEL_DRIVER
cflags += -I${HIDMAP_DIR} -DDETACH_KERNEL_DRIVER
ldflags += -lusb-1.0 -lhidapi-libusb -L${HIDMAP_DIR} -lusbhid_map
export PDDIR
......
PDLIBBUILDER_DIR=${CURDIR}/deps/pd-lib-builder
LIBUSB_DIR=${CURDIR}/deps/libusb
HIDAPI_DIR=${CURDIR}/deps/hidapi
HIDMAP_DIR=${CURDIR}/deps/USB-HID-Report-Parser
cflags += -I${LIBUSB_DIR}/libusb -I${HIDAPI_DIR}/hidapi -I${HIDMAP_DIR}
ldflags += -L${LIBUSB_DIR}/libusb -lusb -L${HIDAPI_DIR}/local-install/lib #-lhidapi -L${HIDMAP_DIR} #-lusbhid_map
cflags += -I${HIDMAP_DIR}
ldflags += -lusb-1.0 -lhidapi
export PDDIR
export PDLIBBUILDER_DIR
export LIBUSB_DIR
export HIDAPI_DIR
export HIDMAP_DIR
export cflags
export ldflags
all: libusb hidapi #usbhid_map
all:
$(MAKE) -C src/hid
install:
......@@ -24,33 +19,3 @@ install:
clean:
$(MAKE) -C src/hid clean
$(MAKE) -C ${LIBUSB_DIR} clean
$(MAKE) -C ${HIDAPI_DIR} clean
### libusbb
libusb: ${LIBUSB_DIR}/libusb/.libs/libusb-1.0.a
${LIBUSB_DIR}/libusb/.libs/libusb-1.0.a: ${LIBUSB_DIR}/Makefile
$(MAKE) -C ${LIBUSB_DIR}
${LIBUSB_DIR}/Makefile: ${LIBUSB_DIR}/configure
cd ${LIBUSB_DIR}; ./configure
${LIBUSB_DIR}/configure:
cd ${LIBUSB_DIR}; ./autogen.sh
### hidapi
hidapi: ${HIDAPI_DIR}/local-install/libhidapi.la
${HIDAPI_DIR}/local-install/libhidapi.la: ${HIDAPI_DIR}/Makefile
$(MAKE) -C ${HIDAPI_DIR}
$(MAKE) -C ${HIDAPI_DIR} install
${HIDAPI_DIR}/Makefile: ${HIDAPI_DIR}/configure
cd ${HIDAPI_DIR}; ./configure --prefix=${HIDAPI_DIR}/local-install
${HIDAPI_DIR}/configure:
cd ${HIDAPI_DIR}; ./bootstrap
......@@ -21,8 +21,12 @@ Tested RPi 4 (5.10.17-v7l+), in principle works but is suboptimal.
### macos
*Should* work as is..
Install dependencies:
```bash
brew install libusb hidapi
```
Compile:
```bash
git clone --recursive https://github.com/tschiemer/hid-pd-external
cd hid-pd-external/
......@@ -31,8 +35,6 @@ make -f Makefile.macos && make -f Makefile.macos install
### linux (Raspberry Pi)
A bit more troublesome.. these instructions might not get you all the way, but should be a start.
*NOTE* as it is, using libusb (in this external) on linux is somewhat invasive on USB devices as kernel
drivers might be detached for this to work. Using hidraw (as offered by hidapi) this seems to work without
further problem, but this is something that remains to be done.
......
Subproject commit e3ba71789fe84e5cd841f0abfd321b846bd41975
Subproject commit b6637729edcd833c3c9a54970ff10017f7f1782c
Subproject commit 6a01f3b4a8862b19a7ec768752ebcfc1a412f4b1
Subproject commit bda2344f5e7d460decd3968492faa7a5fb2797cd
......@@ -3,11 +3,12 @@
#include "m_pd.h"
#include "usbhid_map.h"
#include <libusb.h>
#include <hidapi.h>
//#include "report_item.h"
//#include "report_usage.h"
#include <libusb-1.0/libusb.h>
#include <hidapi/hidapi.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
......@@ -391,10 +392,13 @@ static int hid_filter_device_list(libusb_device **devs, ssize_t count, hid_devic
}
#endif
#if !__APPLE__
r = libusb_claim_interface(handle, interface_num);
if (r < 0) {
error("claim_interface(): %d", r);
} else {
} else
#endif
{
uint8_t report_desc[256];
r = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_INTERFACE,
......@@ -490,6 +494,7 @@ static int hid_filter_device_list(libusb_device **devs, ssize_t count, hid_devic
// post("usage (page) = %d (%d)", report_desc[3], report_desc[1]);
}
}
} // claimed
#ifdef DETACH_KERNEL_DRIVER
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment