Get combined results from both ARP and nmap scans
()
| 8743 | """Auto-detect current hardware and recommend profile""" |
| 8744 | try: |
| 8745 | import subprocess |
| 8746 | import re |
| 8747 | |
| 8748 | # Detect Raspberry Pi model |
| 8749 | model = 'unknown' |
| 8750 | ram_mb = 0 |
| 8751 | recommended_profile = 'pi_zero_2w' # Default to most conservative |
| 8752 | |
| 8753 | try: |
| 8754 | # Read /proc/cpuinfo for model |
| 8755 | with open('/proc/cpuinfo', 'r') as f: |
| 8756 | cpuinfo = f.read() |
| 8757 | |
| 8758 | # Detect Pi model |
| 8759 | if 'Raspberry Pi Zero 2' in cpuinfo: |
| 8760 | model = 'Raspberry Pi Zero 2 W' |
| 8761 | recommended_profile = 'pi_zero_2w' |
| 8762 | elif 'Raspberry Pi 5' in cpuinfo: |
| 8763 | model = 'Raspberry Pi 5' |
| 8764 | elif 'Raspberry Pi 4' in cpuinfo: |
| 8765 | model = 'Raspberry Pi 4' |
| 8766 | elif 'Raspberry Pi 3' in cpuinfo: |
| 8767 | model = 'Raspberry Pi 3' |
| 8768 | |
| 8769 | except Exception as e: |
| 8770 | logger.warning(f"Could not read cpuinfo: {e}") |
| 8771 | |
| 8772 | # Detect RAM |
| 8773 | if psutil_available: |
| 8774 | try: |
| 8775 | mem = psutil.virtual_memory() |
| 8776 | ram_mb = int(mem.total / (1024 * 1024)) |
| 8777 | |
| 8778 | # Match to closest profile |
| 8779 | if model == 'Raspberry Pi Zero 2 W': |
| 8780 | recommended_profile = 'pi_zero_2w' |
| 8781 | elif model == 'Raspberry Pi 5': |
| 8782 | if ram_mb >= 15000: |
| 8783 | recommended_profile = 'pi_5_16gb' |
| 8784 | elif ram_mb >= 7000: |
| 8785 | recommended_profile = 'pi_5_8gb' |
| 8786 | elif ram_mb >= 3500: |
| 8787 | recommended_profile = 'pi_5_4gb' |
| 8788 | else: |
| 8789 | recommended_profile = 'pi_5_2gb' |
| 8790 | elif model == 'Raspberry Pi 4': |
| 8791 | if ram_mb >= 7000: |
| 8792 | recommended_profile = 'pi_4_8gb' |
| 8793 | elif ram_mb >= 3500: |
| 8794 | recommended_profile = 'pi_4_4gb' |
| 8795 | elif ram_mb >= 1800: |
| 8796 | recommended_profile = 'pi_4_2gb' |
| 8797 | else: |
| 8798 | recommended_profile = 'pi_4_1gb' |
| 8799 | |
| 8800 | except Exception as e: |
| 8801 | logger.warning(f"Could not detect RAM: {e}") |
| 8802 |
nothing calls this directly
no test coverage detected