MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _determine_feature_flags

Method _determine_feature_flags

server_capabilities.py:231–256  ·  view source on GitHub ↗

Determine which advanced features can be enabled

(self)

Source from the content-addressed store, hash-verified

229
230 try:
231 # Check device-tree model first - most reliable
232 model_path = '/sys/firmware/devicetree/base/model'
233 if os.path.exists(model_path):
234 with open(model_path, 'r') as f:
235 model = f.read().lower().strip('\x00')
236 logger.debug(f"Detected device model: {model}")
237
238 # Pi 4 and Pi 5 with sufficient RAM are server-capable
239 if 'raspberry pi 5' in model or 'raspberry pi 4' in model:
240 if self.capabilities.total_ram_gb >= 4.0:
241 logger.info(f"Detected capable Raspberry Pi: {model.strip()}")
242 self.capabilities.is_pi_zero = False
243 return
244
245 # Only mark as Pi Zero if explicitly a Zero model
246 if 'zero' in model:
247 self.capabilities.is_pi_zero = True
248 return
249
250 # Fallback: Check /proc/cpuinfo for Pi Zero signature
251 if os.path.exists('/proc/cpuinfo'):
252 with open('/proc/cpuinfo', 'r') as f:
253 content = f.read().lower()
254 # BCM2835 is Pi Zero/1 - only flag if also low RAM
255 if 'bcm2835' in content and self.capabilities.total_ram_gb < 1.0:
256 self.capabilities.is_pi_zero = True
257 return
258
259 except Exception as e:

Callers 2

detect_capabilitiesMethod · 0.95
install_missing_toolsMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected