selfdrived: remove redundant sound card check (#33767)

rm
This commit is contained in:
Adeeb Shihadeh 2024-10-11 09:30:53 -07:00 committed by GitHub
parent 21a8f9e9ba
commit 7150c145ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 2 additions and 25 deletions

View File

@ -80,7 +80,6 @@ struct OnroadEvent @0xc4fa6047f024e718 {
commIssueAvgFreq @44; commIssueAvgFreq @44;
tooDistracted @45; tooDistracted @45;
posenetInvalid @46; posenetInvalid @46;
soundsUnavailable @47;
preLaneChangeLeft @48; preLaneChangeLeft @48;
preLaneChangeRight @49; preLaneChangeRight @49;
laneChange @50; laneChange @50;
@ -126,6 +125,8 @@ struct OnroadEvent @0xc4fa6047f024e718 {
espActive @90; espActive @90;
personalityChanged @91; personalityChanged @91;
aeb @92; aeb @92;
soundsUnavailableDEPRECATED @47;
} }
} }

View File

@ -724,11 +724,6 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
Priority.LOWER, VisualAlert.none, AudibleAlert.none, .2, creation_delay=600.) Priority.LOWER, VisualAlert.none, AudibleAlert.none, .2, creation_delay=600.)
}, },
EventName.soundsUnavailable: {
ET.PERMANENT: NormalPermanentAlert("Speaker not found", "Reboot your Device"),
ET.NO_ENTRY: NoEntryAlert("Speaker not found"),
},
EventName.tooDistracted: { EventName.tooDistracted: {
ET.NO_ENTRY: NoEntryAlert("Distraction Level Too High"), ET.NO_ENTRY: NoEntryAlert("Distraction Level Too High"),
}, },

View File

@ -21,7 +21,6 @@ from openpilot.selfdrive.selfdrived.state import StateMachine
from openpilot.selfdrive.selfdrived.alertmanager import AlertManager, set_offroad_alert from openpilot.selfdrive.selfdrived.alertmanager import AlertManager, set_offroad_alert
from openpilot.selfdrive.controls.lib.latcontrol import MIN_LATERAL_CONTROL_SPEED from openpilot.selfdrive.controls.lib.latcontrol import MIN_LATERAL_CONTROL_SPEED
from openpilot.system.hardware import HARDWARE
from openpilot.system.version import get_build_metadata from openpilot.system.version import get_build_metadata
REPLAY = "REPLAY" in os.environ REPLAY = "REPLAY" in os.environ
@ -88,9 +87,6 @@ class SelfdriveD:
self.is_metric = self.params.get_bool("IsMetric") self.is_metric = self.params.get_bool("IsMetric")
self.is_ldw_enabled = self.params.get_bool("IsLdwEnabled") self.is_ldw_enabled = self.params.get_bool("IsLdwEnabled")
# detect sound card presence and ensure successful init
sounds_available = HARDWARE.get_sound_card_online()
car_recognized = self.CP.carName != 'mock' car_recognized = self.CP.carName != 'mock'
# cleanup old params # cleanup old params
@ -129,8 +125,6 @@ class SelfdriveD:
elif self.CP.secOcRequired and not self.CP.secOcKeyAvailable: elif self.CP.secOcRequired and not self.CP.secOcKeyAvailable:
self.startup_event = EventName.startupNoSecOcKey self.startup_event = EventName.startupNoSecOcKey
if not sounds_available:
self.events.add(EventName.soundsUnavailable, static=True)
if not car_recognized: if not car_recognized:
self.events.add(EventName.carUnrecognized, static=True) self.events.add(EventName.carUnrecognized, static=True)
set_offroad_alert("Offroad_CarUnrecognized", True) set_offroad_alert("Offroad_CarUnrecognized", True)

View File

@ -41,10 +41,6 @@ class HardwareBase(ABC):
def get_device_type(self): def get_device_type(self):
pass pass
@abstractmethod
def get_sound_card_online(self):
pass
@abstractmethod @abstractmethod
def get_imei(self, slot) -> str: def get_imei(self, slot) -> str:
pass pass

View File

@ -14,9 +14,6 @@ class Pc(HardwareBase):
def get_device_type(self): def get_device_type(self):
return "pc" return "pc"
def get_sound_card_online(self):
return True
def reboot(self, reason=None): def reboot(self, reason=None):
print("REBOOT!") print("REBOOT!")

View File

@ -123,12 +123,6 @@ class Tici(HardwareBase):
def get_device_type(self): def get_device_type(self):
return get_device_type() return get_device_type()
def get_sound_card_online(self):
if os.path.isfile('/proc/asound/card0/state'):
with open('/proc/asound/card0/state') as f:
return f.read().strip() == 'ONLINE'
return False
def reboot(self, reason=None): def reboot(self, reason=None):
subprocess.check_output(["sudo", "reboot"]) subprocess.check_output(["sudo", "reboot"])