Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
57 changes: 57 additions & 0 deletions .github/workflows/on-printer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: On-printer HID tool
on:
push:
pull_request:
workflow_call:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
- name: Check embedded canonical payload and shell contracts
run: |
python on-printer/generate_payload.py --check
python -m unittest discover -s tests -p test_on_printer.py -v
sh -n on-printer/payload/installer.sh
- name: Install native build tools
run: |
rustup toolchain install 1.85.1 --profile minimal --component clippy --target armv7-unknown-linux-musleabihf
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf qemu-user
- name: Test native protocol and compile static ARMv7 binary
env:
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_LINKER: arm-linux-gnueabihf-gcc
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_RUNNER: qemu-arm
run: |
cargo +1.85.1 test --locked --manifest-path on-printer/Cargo.toml
cargo +1.85.1 clippy --locked --manifest-path on-printer/Cargo.toml --all-targets -- -D warnings
cargo +1.85.1 test --locked --manifest-path on-printer/Cargo.toml --target armv7-unknown-linux-musleabihf
cargo +1.85.1 build --locked --manifest-path on-printer/Cargo.toml --release --target armv7-unknown-linux-musleabihf
- name: Check static linking and smoke-test executable
run: |
mkdir -p dist
cp on-printer/target/armv7-unknown-linux-musleabihf/release/cc2camera-hid dist/cc2camera-hid-armv7-linux
file dist/cc2camera-hid-armv7-linux
if readelf -l dist/cc2camera-hid-armv7-linux | grep -q INTERP; then exit 1; fi
if readelf -d dist/cc2camera-hid-armv7-linux | grep -q NEEDED; then exit 1; fi
qemu-arm dist/cc2camera-hid-armv7-linux --help
if qemu-arm dist/cc2camera-hid-armv7-linux install; then exit 1; fi
cd dist
sha256sum cc2camera-hid-armv7-linux > cc2camera-hid-armv7-linux.sha256
wc -c cc2camera-hid-armv7-linux
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cc2camera-hid-armv7-linux
path: |
dist/cc2camera-hid-armv7-linux
dist/cc2camera-hid-armv7-linux.sha256
if-no-files-found: error
18 changes: 15 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build release executable
name: Build release executables

on:
release:
Expand Down Expand Up @@ -41,8 +41,13 @@ jobs:
dist/cc2camera.exe.sha256
if-no-files-found: error

on-printer:
uses: $/.github/workflows/on-printer.yml
permissions:
contents: read

attach:
needs: build
needs: [build, on-printer]
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
Expand All @@ -52,9 +57,16 @@ jobs:
with:
name: release-executable
path: dist
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: cc2camera-hid-armv7-linux
path: dist
- name: Attach to the existing manually published release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: gh release upload "$RELEASE_TAG" dist/cc2camera.exe dist/cc2camera.exe.sha256
run: |
gh release upload "$RELEASE_TAG" \
dist/cc2camera.exe dist/cc2camera.exe.sha256 \
dist/cc2camera-hid-armv7-linux dist/cc2camera-hid-armv7-linux.sha256
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ Thumbs.db
*.swp
*~
*.spec

# Native on-printer builds
on-printer/target/
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ dump to your device.
> It has produced the expected result in two tested cases, but if you have any
> doubts, independently audit the tools before using them on your hardware.

## Already have a root shell on the printer?

The [experimental on-printer HID installer](on-printer/README.md) can install
and verify the startup fix while a working camera stays connected inside the
CC2. It needs neither ADB nor Python on the printer. It does **not** export a

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs neither ADB nor Python on the printer.

THEN DON'T WASTE A SENTENCE IN THE MAIN README ON THAT

backup or check safely erased configuration space; a failed write may require
an external programmer. Read that guide's risks and prerequisites before use.
It has been tested on a previously modified camera; volunteers are still needed
for a first install on an unmodified, supported camera. If you try it, please
[open an issue](https://github.com/OpenCentauri/cc2_camera_fix/issues/new) to share
results, get help, and guide any needed tool adjustments.

## First identify your camera

The known failure affects one 8 MiB flash-layout variant of the
Expand Down
Loading
Loading