Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
push:
branches:
- master
paths:
- 'Makefile'
- 'recept.cpp'
pull_request:
paths:
- 'Makefile'
- 'recept.cpp'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: pull docker image
run: docker pull ghcr.io/toltec-dev/toolchain:v1.3.1
- name: Build
run: docker run -v $(pwd):/build -w /build ghcr.io/toltec-dev/toolchain:v1.3.1 make
- name: Save rM1
uses: actions/upload-artifact@v3
with:
name: rm1
path: build/rm1
- name: Save rM2
uses: actions/upload-artifact@v3
with:
name: rm2
path: build/rm2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.sw[pmn]
*.so
build/
55 changes: 35 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
default: compile
default: rm2 rm1

compile:
! mkdir precompiled
. /usr/local/oecore-x86_64/environment-setup-cortexa9hf-neon-oe-linux-gnueabi; \
rm2:
mkdir -p build/rm2
for rs in `seq 2 32`; \
do \
arm-oe-linux-gnueabi-g++ \
-DRING_SIZE=$$rs \
-march=armv7-a \
-mfpu=neon \
-mfloat-abi=hard \
-mcpu=cortex-a9 \
--sysroot=/usr/local/oecore-x86_64/sysroots/cortexa9hf-neon-oe-linux-gnueabi \
-Wall \
-shared \
-ldl \
-fPIC \
-O3 \
recept.cpp \
-o precompiled/librecept_rs$$rs.so; \
$(CXX) \
$(CXXFLAGS)\
-DRING_SIZE=$$rs \
-DINPUT_DEVICE=/dev/input/event1 \
-Wall \
-shared \
-ldl \
-fPIC \
recept.cpp \
-o build/rm2/librecept_rs$$rs.so; \
done

test:
scp precompiled/librecept_rs16.so root@remarkable:librecept.so
rm1:
mkdir -p build/rm1
for rs in `seq 2 32`; \
do \
$(CXX) \
$(CXXFLAGS)\
-DRING_SIZE=$$rs \
-DINPUT_DEVICE=/dev/input/event0 \
-Wall \
-shared \
-ldl \
-fPIC \
recept.cpp \
-o build/rm1/librecept_rs$$rs.so; \
done

test-rm1:
scp build/rm1/librecept_rs32.so root@remarkable:librecept.so
ssh remarkable "LD_PRELOAD=/home/root/librecept.so ls"

test-rm2:
scp build/rm2/librecept_rs16.so root@remarkable:librecept.so
ssh remarkable "LD_PRELOAD=/home/root/librecept.so ls"
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,27 @@ How does it work?
running on the tablet), `librecept` remembers the file handle. Subsequent
`read`s from this handle are transparently filtered with a moving average of
size 16 by default.

Building
--------

To build for both devices run the following:

```bash
source /opt/codex/rm10x/3.1.15/environment-setup-cortexa9hf-neon-remarkable-linux-gnueabi
make
```

To only build for rM1 run the following:

```bash
source /opt/codex/rm10x/3.1.15/environment-setup-cortexa9hf-neon-remarkable-linux-gnueabi
make rm1
```

To only build for rM1 run the following:

```bash
source /opt/codex/rm10x/3.1.15/environment-setup-cortexa9hf-neon-remarkable-linux-gnueabi
make rm2
```
9 changes: 8 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ echo
read -p "Enter the hostname or IP address of your remarkable device [remarkable]:" remarkable
remarkable=${remarkable:-remarkable}

if [[ "$(ssh root@$remarkable cat /sys/devices/soc0/machine)" == "reMarkable 2*" ]];
then \
device=rm2
else \
device=rm1
fi

echo
echo "Chose the amount of smoothing you want to apply to pen events. Larger values will"
echo "smooth more, but will also lead to larger perceived latencies."
Expand All @@ -28,7 +35,7 @@ then \
ssh root@$remarkable "grep -qxF 'Environment=LD_PRELOAD=/usr/lib/librecept.so' /lib/systemd/system/xochitl.service && sed -i '/Environment=LD_PRELOAD=\/usr\/lib\/librecept.so/d' /lib/systemd/system/xochitl.service"
else \
echo "Installing ReCept with ring size ${ring_size}..."
scp ./precompiled/librecept_rs${ring_size}.so root@$remarkable:/usr/lib/librecept.so
scp ./build/$device/librecept_rs${ring_size}.so root@$remarkable:/usr/lib/librecept.so
ssh root@$remarkable "grep -qxF 'Environment=LD_PRELOAD=/usr/lib/librecept.so' /lib/systemd/system/xochitl.service || sed -i 's#\[Service\]#[Service]\nEnvironment=LD_PRELOAD=/usr/lib/librecept.so#' /lib/systemd/system/xochitl.service"
fi

Expand Down
Binary file removed precompiled/librecept_rs10.so
Binary file not shown.
Binary file removed precompiled/librecept_rs11.so
Binary file not shown.
Binary file removed precompiled/librecept_rs12.so
Binary file not shown.
Binary file removed precompiled/librecept_rs13.so
Binary file not shown.
Binary file removed precompiled/librecept_rs14.so
Binary file not shown.
Binary file removed precompiled/librecept_rs15.so
Binary file not shown.
Binary file removed precompiled/librecept_rs16.so
Binary file not shown.
Binary file removed precompiled/librecept_rs17.so
Binary file not shown.
Binary file removed precompiled/librecept_rs18.so
Binary file not shown.
Binary file removed precompiled/librecept_rs19.so
Binary file not shown.
Binary file removed precompiled/librecept_rs2.so
Binary file not shown.
Binary file removed precompiled/librecept_rs20.so
Binary file not shown.
Binary file removed precompiled/librecept_rs21.so
Binary file not shown.
Binary file removed precompiled/librecept_rs22.so
Binary file not shown.
Binary file removed precompiled/librecept_rs23.so
Binary file not shown.
Binary file removed precompiled/librecept_rs24.so
Binary file not shown.
Binary file removed precompiled/librecept_rs25.so
Binary file not shown.
Binary file removed precompiled/librecept_rs26.so
Binary file not shown.
Binary file removed precompiled/librecept_rs27.so
Binary file not shown.
Binary file removed precompiled/librecept_rs28.so
Binary file not shown.
Binary file removed precompiled/librecept_rs29.so
Binary file not shown.
Binary file removed precompiled/librecept_rs3.so
Binary file not shown.
Binary file removed precompiled/librecept_rs30.so
Binary file not shown.
Binary file removed precompiled/librecept_rs31.so
Binary file not shown.
Binary file removed precompiled/librecept_rs32.so
Binary file not shown.
Binary file removed precompiled/librecept_rs4.so
Binary file not shown.
Binary file removed precompiled/librecept_rs5.so
Binary file not shown.
Binary file removed precompiled/librecept_rs6.so
Binary file not shown.
Binary file removed precompiled/librecept_rs7.so
Binary file not shown.
Binary file removed precompiled/librecept_rs8.so
Binary file not shown.
Binary file removed precompiled/librecept_rs9.so
Binary file not shown.
8 changes: 7 additions & 1 deletion recept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
#ifndef RING_SIZE
#define RING_SIZE 16
#endif
#ifndef INPUT_DEVICE
#define _INPUT_DEVICE "/dev/input/event1"
#else
#define toString(_arg) #_arg
#define _INPUT_DEVICE toString(INPUT_DEVICE)
#endif

template<typename T, int Size>
class ring {
Expand Down Expand Up @@ -152,7 +158,7 @@ int open(const char* filename, int flags) {

int fd = real_open(filename, flags);

if (strcmp(filename, "/dev/input/event1") == 0) {
if (strcmp(filename, _INPUT_DEVICE) == 0) {

printf(">| someone is trying to open event1, let's remember the fd!\n");
printf(">| (psssst: it is %d)\n", fd);
Expand Down