Skip to content

Commit

Permalink
selfdrived: remove redundant sound card check (commaai#33767)
Browse files Browse the repository at this point in the history
rm
  • Loading branch information
adeebshihadeh authored Oct 11, 2024
1 parent 21a8f9e commit 7150c14
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 25 deletions.
3 changes: 2 additions & 1 deletion cereal/log.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ struct OnroadEvent @0xc4fa6047f024e718 {
commIssueAvgFreq @44;
tooDistracted @45;
posenetInvalid @46;
soundsUnavailable @47;
preLaneChangeLeft @48;
preLaneChangeRight @49;
laneChange @50;
Expand Down Expand Up @@ -126,6 +125,8 @@ struct OnroadEvent @0xc4fa6047f024e718 {
espActive @90;
personalityChanged @91;
aeb @92;

soundsUnavailableDEPRECATED @47;
}
}

Expand Down
5 changes: 0 additions & 5 deletions selfdrive/selfdrived/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,6 @@ def personality_changed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging
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: {
ET.NO_ENTRY: NoEntryAlert("Distraction Level Too High"),
},
Expand Down
6 changes: 0 additions & 6 deletions selfdrive/selfdrived/selfdrived.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from openpilot.selfdrive.selfdrived.alertmanager import AlertManager, set_offroad_alert
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

REPLAY = "REPLAY" in os.environ
Expand Down Expand Up @@ -88,9 +87,6 @@ def __init__(self, CP=None):
self.is_metric = self.params.get_bool("IsMetric")
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'

# cleanup old params
Expand Down Expand Up @@ -129,8 +125,6 @@ def __init__(self, CP=None):
elif self.CP.secOcRequired and not self.CP.secOcKeyAvailable:
self.startup_event = EventName.startupNoSecOcKey

if not sounds_available:
self.events.add(EventName.soundsUnavailable, static=True)
if not car_recognized:
self.events.add(EventName.carUnrecognized, static=True)
set_offroad_alert("Offroad_CarUnrecognized", True)
Expand Down
4 changes: 0 additions & 4 deletions system/hardware/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ def get_os_version(self):
def get_device_type(self):
pass

@abstractmethod
def get_sound_card_online(self):
pass

@abstractmethod
def get_imei(self, slot) -> str:
pass
Expand Down
3 changes: 0 additions & 3 deletions system/hardware/pc/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ def get_os_version(self):
def get_device_type(self):
return "pc"

def get_sound_card_online(self):
return True

def reboot(self, reason=None):
print("REBOOT!")

Expand Down
6 changes: 0 additions & 6 deletions system/hardware/tici/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@ def get_os_version(self):
def get_device_type(self):
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):
subprocess.check_output(["sudo", "reboot"])

Expand Down

0 comments on commit 7150c14

Please sign in to comment.