Skip to content

Commit

Permalink
Merge pull request #408 from LedgerHQ/ocr_stax
Browse files Browse the repository at this point in the history
Ocr stax
  • Loading branch information
dmorais-ledger authored Jul 31, 2023
2 parents 1af74ce + eb274c1 commit 1c0b8f1
Show file tree
Hide file tree
Showing 49 changed files with 22,962 additions and 358 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
builtin: clear,rare
check_filenames: true
ignore_words_file: .codespell-ignore
skip: ./speculos/api/static/swagger/swagger-ui.css,./speculos/api/static/swagger/swagger-ui-bundle.js,./speculos/api/static/swagger/swagger-ui-standalone-preset.js
skip: ./speculos/api/static/swagger/swagger-ui.css,./speculos/api/static/swagger/swagger-ui-bundle.js,./speculos/api/static/swagger/swagger-ui-standalone-preset.js,./speculos/fonts

coverage:
name: Code coverage
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ __pycache__/
apps/*vault*
build/
core
TAGS
/speculos/resources/launcher
/speculos/resources/vnc_server

Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ COPY --from=builder /speculos/speculos/resources/ /speculos/speculos/resources/

RUN pip install --upgrade pip pipenv
RUN pipenv install --deploy --system
RUN pip install pytesseract


RUN apt-get update && apt-get install -qy \
qemu-user-static \
libvncserver-dev \
gdb-multiarch \
tesseract-ocr \
libtesseract-dev \
&& apt-get clean

RUN apt-get clean && rm -rf /var/lib/apt/lists/
Expand Down
4 changes: 1 addition & 3 deletions build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libvncserver-dev \
python3-pip \
qemu-user-static \
tesseract-ocr \
libtesseract-dev \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/

# There are issues with PYTHONHOME if using distro packages, use pip instead.
RUN pip3 install construct flake8 flask flask_restful jsonschema mnemonic pycrypto pyelftools pbkdf2 pytest Pillow requests pytesseract
RUN pip3 install construct flake8 flask flask_restful jsonschema mnemonic pycrypto pyelftools pbkdf2 pytest Pillow requests

# Create SHA256SUMS, download dependencies and verify their integrity
RUN \
Expand Down
3 changes: 1 addition & 2 deletions docs/installation/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ sudo apt install \
cmake gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gdb-multiarch \
python3-pyqt5 python3-construct python3-flask-restful python3-jsonschema \
python3-mnemonic python3-pil python3-pyelftools python3-requests \
qemu-user-static tesseract-ocr libtesseract-dev
qemu-user-static

pip install pytesseract
```

For optional VNC support, please also install `libvncserver-dev`:
Expand Down
7 changes: 1 addition & 6 deletions docs/user/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,4 @@ Launch the Bitcoin Testnet app, which requires the Bitcoin app:

## OCR

OCR is available for NanoX with built in character recognition.

Stax makes use of the Tessseract library for OCR, with known issues for detecting inverted text.

Launching Speculos with `--force-full-ocr` flag forces all text to be written in black over a white background,
having an visible effect on the display but solving the latter issue.
OCR is available for NanoX, Nanos S+ and Stax with built in character recognition.
3 changes: 2 additions & 1 deletion sdk/bolos_syscalls_unified_sdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@
#define SYSCALL_nbgl_get_font_ID_IN 0x01fa000c
#define SYSCALL_nbgl_screen_reinit_ID_IN 0x00fa000d
#define SYSCALL_nbgl_front_draw_img_rle_legacy_ID_IN 0x00fa000e // API levels 7-8-9
#define SYSCALL_nbgl_front_draw_img_rle_ID_IN 0x04fa0010
#define SYSCALL_nbgl_front_draw_img_rle_10_ID_IN 0x04fa0010 // API level 10
#define SYSCALL_nbgl_front_draw_img_rle_ID_IN 0x05fa0010 // API level_12

#define SYSCALL_ox_bls12381_sign_ID_IN 0x05000103
#define SYSCALL_cx_hash_to_field_ID_IN 0x06000104
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def run(self):
"pyelftools>=0.27,<1.0",
"pyqt5>=5.15.2,<6.0.0",
"requests>=2.25.1,<3.0.0",
"pytesseract>=0.3.10,<0.4.0",
]
+ (["dataclasses>=0.8,<0.9"] if sys.version_info <= (3, 6) else []),
extras_require={
Expand Down
Binary file added speculos/cxlib/nanosp-api-level-cx-12.elf
Binary file not shown.
Binary file added speculos/cxlib/nanox-api-level-cx-12.elf
Binary file not shown.
Binary file added speculos/cxlib/stax-api-level-cx-12.elf
Binary file not shown.
Loading

0 comments on commit 1c0b8f1

Please sign in to comment.