Skip to content

Commit

Permalink
Update for qmk userspace, modern homebrew, homebrew hidapi
Browse files Browse the repository at this point in the history
  • Loading branch information
rhruiz committed Jun 16, 2024
1 parent ff38a98 commit e424fe8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
OSNAME:=$(shell uname -s)

CFLAGS=-I/usr/local/lib -Wno-write-strings -I../qmk_firmware -lc
CFLAGS=-Wno-write-strings -I../qmk_userspace -lc

# Order of LDFLAGS matters! Remember, linking happens after compiling.
LDFLAGS=

ifeq ($(OSNAME),Darwin)
CFLAGS += -lhidapi
BREW_PREFIX:=$(shell brew --prefix)
CFLAGS += -I$(BREW_PREFIX)/include -I$(BREW_PREFIX)/lib -I/usr/local/lib -DOS_DARWIN
LDFLAGS += -L$(BREW_PREFIX)/lib -lhidapi
else
CFLAGS += -I/usr/local/include/hidapi
LDFLAGS += -lhidapi-libusb
Expand Down
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,16 @@ This asumes `qmk` is cloned next to this folder:

```
git clone [email protected]:rhruiz/hid_send.git
git clone [email protected]:rhruiz/qmk_firmware.git
git clone [email protected]:rhruiz/qmk-userspace.git qmk_userspace
```

### macOS setup

Install patched version of hidapi:

```shell
git clone https://github.com/signal11/hidapi.git
cd hidapi
git remote add dylanmckay https://github.com/dylanmckay/hidapi.git
git fetch dylanmckay
git checkout mac-hid-interface-support
./bootstrap
./configure
make
sudo make install
cd ../
brew instal hidapi # brew qmk/qmk/qmk already installed this
```


## Building

Just run:
Expand Down
4 changes: 4 additions & 0 deletions hid_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
#include <string.h>
#include <stdbool.h>
#include <sys/queue.h>
#ifdef OS_DARWIN
#include <hidapi/hidapi_darwin.h>
#else
#include <hidapi/hidapi.h>
#endif

// qmk includes
#include <users/rhruiz/raw_hid/api.h>
Expand Down

0 comments on commit e424fe8

Please sign in to comment.