Fixing the SayoDevice CLI on macOS When the Website Is Down
My son got a new little macro-pad / keyboard, a SayoDevice O3C. It is one of those tiny programmable keyboards with a few keys that can be mapped to whatever you want. Great idea. Simple device. Perfect little project.
Naturally, the first thing we had to do was configure it.
Also naturally, the website was down.
The normal setup flow is supposed to be through the SayoDevice web configurator. You plug the device in, open the site, let the browser talk to it over USB/HID, and program the keys. Except the site would resolve in DNS but would not actually respond. The main domain and the app subdomain both looked dead from here.
So now the “quickly program this keyboard” task had become a “why is this vendor’s CDN broken and what do I do instead?” task.
Finding the CLI
After poking around a bit, I found the official GitHub repo for the SayoDevice CLI:
https://github.com/Sayobot/Sayo_CLI
The README suggests cloning it like this:
git clone --recursive-submodules -j8 git@github.com:Sayobot/Sayo_CLI.git
That was the first problem. --recursive-submodules is not the normal Git flag. The usual option is:
--recurse-submodules
So I tried cloning it properly:
git clone --recurse-submodules -j8 https://github.com/Sayobot/Sayo_CLI.git
cd Sayo_CLI
Then I ran the macOS build script:
./build_Mac.sh
And got this:
ld: warning: search path './hidapi/src/mac' not found
ld: warning: search path './jsoncpp/build/lib' not found
ld: library 'hidapi' not found
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
That made it look like the submodules had not been pulled correctly.
So I tried the usual submodule repair commands:
git submodule sync --recursive
git submodule update --init --recursive
Git happily claimed everything was fine, but the path the build script wanted still did not exist. At that point it looked less like a Git problem and more like a stale build script problem. The script was looking for vendored libraries in paths that no longer matched the actual repo layout.
Using Homebrew Libraries Instead
Rather than keep fighting the submodules, the fix was to use the normal macOS Homebrew libraries for hidapi and jsoncpp.
Install the dependencies:
brew install hidapi jsoncpp
And then edit the build script:
#!/bin/bash
BREW_PREFIX="$(brew --prefix)"
g++ --std=c++17 \
-O2 -DRELEASE -DNDEBUG \
-I"$BREW_PREFIX/include/hidapi" \
-L"$BREW_PREFIX/lib" -lhidapi \
-I"$BREW_PREFIX/include" \
-L"$BREW_PREFIX/lib" -ljsoncpp \
-I./inc \
o2_protocol.cpp \
main.cpp \
src/http.cpp \
src/tools.cpp \
-framework IOKit \
-framework CoreFoundation \
-framework AppKit \
-o Sayo_CLI_Mac
Then build it:
./build_Mac.local.sh
And run it:
./Sayo_CLI_Mac
That worked.
And with that, we were finally able to program my son’s new keyboard.
What should have been a five-minute web configurator job turned into a CDN debugging, Git submodule, stale build script, Homebrew library adventure.
So, you know, a normal evening.