| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -4,7 +4,7 @@ import os | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import subprocess | 
					 | 
					 | 
					 | 
					import subprocess | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import time | 
					 | 
					 | 
					 | 
					import time | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from enum import IntEnum | 
					 | 
					 | 
					 | 
					from enum import IntEnum | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from functools import cached_property | 
					 | 
					 | 
					 | 
					from functools import cached_property, lru_cache | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from pathlib import Path | 
					 | 
					 | 
					 | 
					from pathlib import Path | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from cereal import log | 
					 | 
					 | 
					 | 
					from cereal import log | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -91,8 +91,12 @@ class Tici(HardwareBase): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def amplifier(self): | 
					 | 
					 | 
					 | 
					  def amplifier(self): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return Amplifier() | 
					 | 
					 | 
					 | 
					    return Amplifier() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  @cached_property | 
					 | 
					 | 
					 | 
					  def get_os_version(self): | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def model(self): | 
					 | 
					 | 
					 | 
					    with open("/VERSION") as f: | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      return f.read().strip() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  @lru_cache | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  def get_device_type(self): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    with open("/sys/firmware/devicetree/base/model") as f: | 
					 | 
					 | 
					 | 
					    with open("/sys/firmware/devicetree/base/model") as f: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      model = f.read().strip('\x00') | 
					 | 
					 | 
					 | 
					      model = f.read().strip('\x00') | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    model = model.split('comma ')[-1] | 
					 | 
					 | 
					 | 
					    model = model.split('comma ')[-1] | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -101,13 +105,6 @@ class Tici(HardwareBase): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      model = 'tici' | 
					 | 
					 | 
					 | 
					      model = 'tici' | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return model | 
					 | 
					 | 
					 | 
					    return model | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def get_os_version(self): | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    with open("/VERSION") as f: | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      return f.read().strip() | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def get_device_type(self): | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return "tici" | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def get_sound_card_online(self): | 
					 | 
					 | 
					 | 
					  def get_sound_card_online(self): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return (os.path.isfile('/proc/asound/card0/state') and | 
					 | 
					 | 
					 | 
					    return (os.path.isfile('/proc/asound/card0/state') and | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            open('/proc/asound/card0/state').read().strip() == 'ONLINE') | 
					 | 
					 | 
					 | 
					            open('/proc/asound/card0/state').read().strip() == 'ONLINE') | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -424,7 +421,7 @@ class Tici(HardwareBase): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # amplifier, 100mW at idle | 
					 | 
					 | 
					 | 
					    # amplifier, 100mW at idle | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.amplifier.set_global_shutdown(amp_disabled=powersave_enabled) | 
					 | 
					 | 
					 | 
					    self.amplifier.set_global_shutdown(amp_disabled=powersave_enabled) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if not powersave_enabled: | 
					 | 
					 | 
					 | 
					    if not powersave_enabled: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      self.amplifier.initialize_configuration(self.model) | 
					 | 
					 | 
					 | 
					      self.amplifier.initialize_configuration(self.get_device_type()) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # *** CPU config *** | 
					 | 
					 | 
					 | 
					    # *** CPU config *** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -445,7 +442,7 @@ class Tici(HardwareBase): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # boardd core | 
					 | 
					 | 
					 | 
					    # boardd core | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    affine_irq(4, "spi_geni")         # SPI | 
					 | 
					 | 
					 | 
					    affine_irq(4, "spi_geni")         # SPI | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    affine_irq(4, "xhci-hcd:usb3")    # aux panda USB (or potentially anything else on USB) | 
					 | 
					 | 
					 | 
					    affine_irq(4, "xhci-hcd:usb3")    # aux panda USB (or potentially anything else on USB) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if "tici" in self.model: | 
					 | 
					 | 
					 | 
					    if "tici" in self.get_device_type(): | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      affine_irq(4, "xhci-hcd:usb1")  # internal panda USB | 
					 | 
					 | 
					 | 
					      affine_irq(4, "xhci-hcd:usb1")  # internal panda USB | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # camerad core | 
					 | 
					 | 
					 | 
					    # camerad core | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -461,7 +458,7 @@ class Tici(HardwareBase): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      return 0 | 
					 | 
					 | 
					 | 
					      return 0 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def initialize_hardware(self): | 
					 | 
					 | 
					 | 
					  def initialize_hardware(self): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.amplifier.initialize_configuration(self.model) | 
					 | 
					 | 
					 | 
					    self.amplifier.initialize_configuration(self.get_device_type()) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # Allow thermald to write engagement status to kmsg | 
					 | 
					 | 
					 | 
					    # Allow thermald to write engagement status to kmsg | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    os.system("sudo chmod a+w /dev/kmsg") | 
					 | 
					 | 
					 | 
					    os.system("sudo chmod a+w /dev/kmsg") | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |