#!/bin/bash # Installation script for dreader-hal hardware drivers # # This script installs all the external driver dependencies needed # for running DReader on e-ink hardware. set -e # Exit on error echo "================================" echo "DReader Hardware Driver Installer" echo "================================" echo "" # Check if we're in a virtual environment if [ -z "$VIRTUAL_ENV" ]; then echo "⚠️ Warning: No virtual environment detected!" echo "It's recommended to activate your virtual environment first:" echo " source venv/bin/activate" echo "" read -p "Continue anyway? (y/N) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi fi # Initialize submodules if not already done echo "Step 1: Initializing git submodules..." git submodule update --init --recursive echo "✓ Submodules initialized" echo "" # Install dreader-hal main package echo "Step 2: Installing dreader-hal..." pip install -e external/dreader-hal echo "✓ dreader-hal installed" echo "" # Install external drivers echo "Step 3: Installing external driver libraries..." echo " - Installing IT8951 (E-ink display driver)..." pip install -e external/dreader-hal/external/IT8951 echo " - Installing PyBMA400 (Accelerometer)..." pip install -e external/dreader-hal/external/PyBMA400 echo " - Installing PyFTtxx6 (Touch panel)..." pip install -e external/dreader-hal/external/PyFTtxx6/pyft5xx6 echo " - Installing PyPCF8523 (RTC)..." pip install -e external/dreader-hal/external/PyPCF8523 echo " - Installing pi_ina219 (Power monitor)..." pip install -e external/dreader-hal/external/pi_ina219 echo "✓ All drivers installed" echo "" # Summary echo "================================" echo "Installation Complete!" echo "================================" echo "" echo "Installed packages:" echo " ✓ dreader-hal (main HAL library)" echo " ✓ IT8951 (e-ink display)" echo " ✓ PyBMA400 (accelerometer)" echo " ✓ PyFTtxx6 (touch panel)" echo " ✓ PyPCF8523 (RTC)" echo " ✓ pi_ina219 (power monitor)" echo "" echo "Next steps:" echo " 1. Wire up your hardware according to HARDWARE_SETUP.md" echo " 2. Check your display's VCOM voltage (on label)" echo " 3. Run: python examples/run_on_hardware.py /path/to/books --vcom YOUR_VCOM" echo "" echo "Example:" echo " python examples/run_on_hardware.py ~/Books --vcom -2.06" echo ""