#!/bin/bash # BBeOS Hardware Testing Script # Helps test hardware components and gather system information set -e echo "BBeOS Hardware Testing Script" echo "==============================" # Function to test basic system info test_system_info() { echo "=== System Information ===" echo "CPU Info:" cat /proc/cpuinfo | grep -E "(Hardware|Processor|model name)" | head -3 echo "" echo "Memory Info:" cat /proc/meminfo | grep -E "(MemTotal|MemAvailable)" | head -2 echo "" echo "Kernel Version:" uname -a echo "" } # Function to test device tree test_device_tree() { echo "=== Device Tree Information ===" if [ -f /proc/device-tree/compatible ]; then echo "Device Compatible:" cat /proc/device-tree/compatible echo "" fi echo "Device Tree Nodes:" ls /proc/device-tree/ 2>/dev/null || echo "No device tree nodes found" echo "" } # Function to test hardware buses test_hardware_buses() { echo "=== Hardware Buses ===" echo "I2C Buses:" ls /sys/bus/i2c/devices/ 2>/dev/null || echo "No I2C devices found" echo "" echo "SPI Buses:" ls /sys/bus/spi/devices/ 2>/dev/null || echo "No SPI devices found" echo "" echo "USB Devices:" ls /sys/bus/usb/devices/ 2>/dev/null || echo "No USB devices found" echo "" } # Function to test input devices test_input_devices() { echo "=== Input Devices ===" echo "Input Devices:" ls /sys/class/input/ 2>/dev/null || echo "No input devices found" echo "" echo "Input Events:" ls /dev/input/ 2>/dev/null || echo "No input event devices found" echo "" } # Function to test display devices test_display_devices() { echo "=== Display Devices ===" echo "Framebuffer Devices:" ls /dev/fb* 2>/dev/null || echo "No framebuffer devices found" echo "" echo "DRM Devices:" ls /sys/class/drm/ 2>/dev/null || echo "No DRM devices found" echo "" echo "Display Backlight:" ls /sys/class/backlight/ 2>/dev/null || echo "No backlight devices found" echo "" } # Function to test audio devices test_audio_devices() { echo "=== Audio Devices ===" echo "ALSA Devices:" ls /proc/asound/cards 2>/dev/null || echo "No ALSA devices found" echo "" echo "Sound Devices:" ls /sys/class/sound/ 2>/dev/null || echo "No sound devices found" echo "" } # Function to test network devices test_network_devices() { echo "=== Network Devices ===" echo "Network Interfaces:" ls /sys/class/net/ 2>/dev/null || echo "No network interfaces found" echo "" echo "Wi-Fi Devices:" ls /sys/class/ieee80211/ 2>/dev/null || echo "No Wi-Fi devices found" echo "" echo "Bluetooth Devices:" ls /sys/class/bluetooth/ 2>/dev/null || echo "No Bluetooth devices found" echo "" } # Function to test storage devices test_storage_devices() { echo "=== Storage Devices ===" echo "Block Devices:" ls /sys/block/ 2>/dev/null || echo "No block devices found" echo "" echo "MMC Devices:" ls /sys/class/mmc_host/ 2>/dev/null || echo "No MMC devices found" echo "" } # Function to test GPIO test_gpio() { echo "=== GPIO Information ===" echo "GPIO Controllers:" ls /sys/class/gpio/ 2>/dev/null || echo "No GPIO controllers found" echo "" echo "GPIO Chips:" ls /sys/class/gpio/gpiochip*/ 2>/dev/null || echo "No GPIO chips found" echo "" } # Function to test interrupts test_interrupts() { echo "=== Interrupt Information ===" echo "Interrupts:" cat /proc/interrupts | head -10 echo "" } # Function to test kernel modules test_kernel_modules() { echo "=== Kernel Modules ===" echo "Loaded Modules:" lsmod | head -10 echo "" } # Function to test system devices test_system_devices() { echo "=== System Devices ===" echo "Character Devices:" cat /proc/devices | grep -E "^[0-9]+" | head -10 echo "" echo "Block Devices:" cat /proc/devices | grep -E "^[0-9]+" | tail -10 echo "" } # Function to test power management test_power_management() { echo "=== Power Management ===" echo "Battery Information:" ls /sys/class/power_supply/ 2>/dev/null || echo "No power supply devices found" echo "" echo "Thermal Zones:" ls /sys/class/thermal/ 2>/dev/null || echo "No thermal zones found" echo "" } # Main testing function run_all_tests() { echo "Running comprehensive hardware tests..." echo "" test_system_info test_device_tree test_hardware_buses test_input_devices test_display_devices test_audio_devices test_network_devices test_storage_devices test_gpio test_interrupts test_kernel_modules test_system_devices test_power_management echo "=== Test Summary ===" echo "Hardware testing complete!" echo "Check the output above for detected hardware components." echo "" echo "Next steps:" echo "1. Verify expected hardware is detected" echo "2. Check for missing drivers" echo "3. Test specific components individually" echo "4. Develop missing drivers as needed" } # Check if running on target system if [ ! -f /proc/cpuinfo ]; then echo "Error: This script must be run on the target system (BBeOS)" echo "Please run this script after booting into BBeOS" exit 1 fi # Run tests run_all_tests