Add Dockerfile and run scripts for containerized crash cart adapter

Wraps the NOTECONS02 USB Crash Cart Adapter software (usb-crash-cart-adapter
v20240517) in an Ubuntu 16.04 Docker container to resolve incompatibilities
with modern Fedora. Includes X11/XWayland passthrough, USB device access,
and host udev rules for the crash cart adapter (vendor 152a, products 8460/8463).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-07 12:28:58 -04:00
parent 1ce321c06f
commit 5e23e78b51
8 changed files with 135 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
# The .deb package is large and proprietary — don't commit it
packages/*.deb
packages/*.rpm

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM ubuntu:16.04
# Install GTK2 and X11 runtime dependencies needed by the bundled wxWidgets 2.9
RUN apt-get update && apt-get install -y --no-install-recommends \
libgtk2.0-0 \
libsm6 \
libxxf86vm1 \
libxinerama1 \
libxrandr2 \
libxcursor1 \
libxi6 \
libxdamage1 \
libxcomposite1 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*
# Copy and install the crash cart software
# Place the .deb in packages/crash-cart.deb before building
COPY packages/crash-cart.deb /tmp/crash-cart.deb
RUN dpkg -i /tmp/crash-cart.deb && rm /tmp/crash-cart.deb
# Prefer bundled libs (libpng12, libpython2.7, libwx*, etc.) over system ones
ENV LD_LIBRARY_PATH=/opt/usb-crash-cart-adapter/20240517/guts
ENV DISPLAY=:0
ENTRYPOINT ["/opt/usb-crash-cart-adapter/20240517/wrapper"]

View File

@@ -1 +1,48 @@
# usb-crash-cart
Docker container wrapper for the NOTECONS02 USB Crash Cart Adapter software.
The vendor software (`usb-crash-cart-adapter` v20240517) was built against Ubuntu 16.04
(Python 2.7, wxWidgets 2.9/GTK2) and is incompatible with modern Fedora. This repo runs
it inside an Ubuntu 16.04 container with X11 passthrough.
## Setup
### 1. Install udev rules (once, on the host)
```bash
sudo ./install-udev-rules.sh
```
This allows the crash cart adapter (USB vendor `152a`, products `8460`/`8463`) to be
accessed without root.
### 2. Place the .deb package
Copy the vendor `.deb` to `packages/crash-cart.deb`:
```bash
cp /path/to/"Linux-X64 Crash Cart Software_1240415.deb" packages/crash-cart.deb
```
### 3. Build the image
```bash
docker build -t usb-crash-cart .
```
### 4. Run
```bash
./docker-run.sh
```
This handles X11 socket sharing and USB device passthrough automatically.
## Notes
- The container uses `ubuntu:16.04` to match the build environment.
- The app bundles its own `libpython2.7`, `libwx_gtk2u-2.9`, `libpng12`, etc. — the
container only needs GTK2 and X11 system libs from the OS.
- `LD_LIBRARY_PATH` is set to prefer the bundled libs over system ones.
- The `.deb` is excluded from git (`.gitignore`) — obtain it from the vendor package.

31
docker-run.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
set -euo pipefail
IMAGE="usb-crash-cart"
# On Fedora with Wayland, XWayland provides X11 compatibility.
# DISPLAY is still set (e.g. :0 or :1) and /tmp/.X11-unix still exists.
if [ -z "${DISPLAY:-}" ]; then
echo "Error: DISPLAY is not set. Ensure XWayland is running (it should be by default on Fedora)."
exit 1
fi
# xhost grants the container access via hostname-based access control,
# bypassing the need to pass the raw cookie in some setups.
xhost +local:docker 2>/dev/null || echo "Warning: xhost failed — display access may not work"
# Under XWayland, X11 auth is cookie-based (XAUTHORITY file).
# Pass it into the container so the app can authenticate with XWayland.
XAUTH_ARGS=()
if [ -n "${XAUTHORITY:-}" ] && [ -f "${XAUTHORITY}" ]; then
XAUTH_ARGS=(-e XAUTHORITY="${XAUTHORITY}" -v "${XAUTHORITY}:${XAUTHORITY}:ro")
fi
# Pass all USB bus devices so the app can find the crash cart adapter.
# The udev rules (install via install-udev-rules.sh) set permissions on the host.
docker run --rm \
-e DISPLAY="${DISPLAY}" \
"${XAUTH_ARGS[@]}" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--device /dev/bus/usb \
"${IMAGE}" "$@"

11
install-udev-rules.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "Installing udev rules for USB Crash Cart Adapter (vendor 152a, products 8460/8463)..."
sudo cp "$SCRIPT_DIR/udev-rules/"*.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
echo "Done. If the crash cart adapter is already plugged in, unplug and reconnect it."

0
packages/.gitkeep Normal file
View File

View File

@@ -0,0 +1,8 @@
# Copy this file into: /etc/udev/rules.d/
# (/lib/udev/ isn't consistent between ubuntu and debian)
#
# Change the permissions and create alternative name as a
# handle into our device...
#
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTRS{idProduct}=="8460", ATTRS{idVendor}=="152a", MODE:="0666", NAME:="DCC_%k"

View File

@@ -0,0 +1,8 @@
# Copy this file into: /etc/udev/rules.d/
# (/lib/udev/ isn't consistent between ubuntu and debian)
#
# Change the permissions and create alternative name as a
# handle into our device...
#
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTRS{idProduct}=="8463", ATTRS{idVendor}=="152a", MODE:="0666", NAME:="DCC_%k"