Sfoglia il codice sorgente

ReversePuck CI build and readme

Jari 4 mesi fa
parent
commit
2d14e08be1
4 ha cambiato i file con 54 aggiunte e 4 eliminazioni
  1. 22 2
      .github/workflows/build.yml
  2. 25 0
      .github/workflows/release.yml
  3. 5 1
      README.md
  4. 2 1
      ReversePuck/README.md

+ 22 - 2
.github/workflows/build.yml

@@ -47,15 +47,29 @@ jobs:
             --build-property "build.extra_flags=-DNRF52840_XXAA {build.flags.usb} -DCFG_TUD_HID=4" \
             OpenPuck
 
-      - name: Generate UF2
+      - name: Generate UF2 (OpenPuck)
         # The Adafruit nRF52 core leaves its UF2 objcopy recipe commented out in
         # platform.txt, so arduino-cli only emits .hex/.zip. Convert the .hex to
         # a drag-and-drop .uf2 ourselves.
         run: ./gen_uf2.sh build/openpuck/OpenPuck.ino.hex build/openpuck/OpenPuck.ino.uf2
 
+      - name: Compile ReversePuckFirmware
+        run: |
+          mkdir -p build/reversepuck build/cache/reversepuck
+          arduino-cli compile \
+            -b adafruit:nrf52:feather52840 \
+            --clean \
+            --build-path build/cache/reversepuck \
+            --output-dir build/reversepuck \
+            --build-property "build.extra_flags=-DNRF52840_XXAA {build.flags.usb}" \
+            ReversePuckFirmware
+
+      - name: Generate UF2 (ReversePuckFirmware)
+        run: ./gen_uf2.sh build/reversepuck/ReversePuckFirmware.ino.hex build/reversepuck/ReversePuckFirmware.ino.uf2
+
       - name: List build outputs
         run: |
-          find build/openpuck -maxdepth 1 -type f -print | sort
+          find build/openpuck build/reversepuck -maxdepth 1 -type f -print | sort
 
       - name: Upload build artifacts
         uses: actions/upload-artifact@v4
@@ -69,3 +83,9 @@ jobs:
             build/openpuck/*.elf
             build/openpuck/*.map
             build/openpuck/*.zip
+            build/reversepuck/*.uf2
+            build/reversepuck/*.bin
+            build/reversepuck/*.hex
+            build/reversepuck/*.elf
+            build/reversepuck/*.map
+            build/reversepuck/*.zip

+ 25 - 0
.github/workflows/release.yml

@@ -51,6 +51,20 @@ jobs:
       - name: Generate UF2 (standard)
         run: ./gen_uf2.sh build/openpuck/OpenPuck.ino.hex build/openpuck/OpenPuck.ino.uf2
 
+      - name: Compile ReversePuckFirmware
+        run: |
+          mkdir -p build/reversepuck build/cache/reversepuck
+          arduino-cli compile \
+            -b adafruit:nrf52:feather52840 \
+            --clean \
+            --build-path build/cache/reversepuck \
+            --output-dir build/reversepuck \
+            --build-property "build.extra_flags=-DNRF52840_XXAA {build.flags.usb}" \
+            ReversePuckFirmware
+
+      - name: Generate UF2 (ReversePuckFirmware)
+        run: ./gen_uf2.sh build/reversepuck/ReversePuckFirmware.ino.hex build/reversepuck/ReversePuckFirmware.ino.uf2
+
       - name: Compile recovery build
         run: |
           mkdir -p build/openpuck-recovery build/cache/openpuck-recovery
@@ -88,6 +102,14 @@ jobs:
             fi
             cp "$f" "release_assets/OpenPuck-${VERSION}-${flavor}.${ext}"
           done
+
+          find build/reversepuck \
+            -maxdepth 1 -type f \
+            \( -name '*.uf2' -o -name '*.zip' \) \
+            -print | while read -r f; do
+            ext="${f##*.}"
+            cp "$f" "release_assets/ReversePuckFirmware-${VERSION}.${ext}"
+          done
           test -n "$(find release_assets -maxdepth 1 -type f -print -quit)"
           ls -la release_assets
 
@@ -107,6 +129,9 @@ jobs:
 
             ### Files included:
 
+            - `OpenPuck-*-standard.*` — puck firmware (standard)
+            - `OpenPuck-*-factory-reset.*` — puck firmware (factory reset)
+            - `ReversePuckFirmware-*.*` — reverse-puck firmware (controller emulator)
             - `.zip` files for Adafruit DFU tool
             - `.uf2` files for drag-and-drop flashing (BOOT/UF2 drive)
         env:

+ 5 - 1
README.md

@@ -66,9 +66,13 @@ A webusb based configuration UI is available [here](https://safijari.github.io/o
 - [StonnedModder](https://www.printables.com/model/1760684-openpuck-promicro-nrf52840-case) built a case meant to accomodate a USB C to USB A adapter which you can find [here](https://www.printables.com/model/1760684-openpuck-promicro-nrf52840-case).
 - Another plain case for these pro micros can be found [here](https://www.printables.com/model/1285346-pro-micro-nicenano-nrf52840-dongle-case/collections).
 
+# ReversePuck
+This is a tool to emulate a Steam Controller 2 with almost all of its inputs (except grip) using a Steam Deck and allow it to connect over a low latency 2.4ghz connection to OpenPuck (this does not work with the official puck). Flash the firmware onto an NRF52840 Pro Micro and copy over the ReversePuck folder onto the Steam Deck (you'll need to install UV). Then add the ReversePuck script as a non steam game. Attach both the dongle and OpenPuck to the same machine and do pairing through Steam (which will say pairing has failed but it's actually fine). Then connect the OpenPuck to whatever machine you want to use your controllers on and the dongle to the Steam Deck. Launch the ReversePuck app in gamemode and you'll see the serial number of the OpenPuck show up in green. Press it and it'll turn blue at which point the Deck will show up as a controller on the host device. See video below for a demonstration of this in action (yes, other Steam Controllers can be connected to the same OpenPuck at the same time).
+
+[![ReversePuck Demo](https://img.youtube.com/vi/gSaqO9oqq9s/0.jpg)](https://www.youtube.com/watch?v=gSaqO9oqq9s)
+
 # Future work
 - Find a way to make Xinput mode and mouse work together on all platforms
-- Multi-controller support is now working in Steam/Lizard mode (up to 4 controllers, see the `U` CDC command for a per-slot status dump). Non-puck modes (Xbox, Switch, PS5, DS4) remain single-controller by design — the user can pair one controller and use the appropriate mode.
 - Design the charging portion (and make it short proof)
 
 # Contributions

+ 2 - 1
ReversePuck/README.md

@@ -44,7 +44,8 @@ analog offsets in `input_source.py` if anything's off. The IMU axis remap (`IMU_
 
 The `ReversePuck` launcher runs the app via [`uv`](https://docs.astral.sh/uv/), which provisions its own
 Python and the three deps (`pyserial` + `pygame` + `pyusb`, all prebuilt wheels; `pyusb` uses the system
-`libusb-1.0.so`) into uv's cache — **nothing touches the read-only rootfs**.
+`libusb-1.0.so`) into uv's cache — **nothing touches the read-only rootfs**. You might need to install this
+before ReversePuck will function.
 
 ```bash
 # one-time: install uv (lands in ~/.local/bin, no root)