  
    if front_camera_allowed:
      os.environ["SEND_DRIVER"] = "1"
  
    managed_processes['camerad'].start()
    frame = "wideRoadCameraState" if TICI else "roadCameraState"
    front_frame = "driverCameraState" if front_camera_allowed else None
    focus_perc_threshold = 0. if TICI else 10 / 12.
  
    rear, front = get_snapshots(frame, front_frame, focus_perc_threshold)
    managed_processes['camerad'].stop()
  
    params.put_bool("IsTakingSnapshot", False)
 
</s> remove   rear, front = get_snapshots(frame, front_frame, focus_perc_threshold)
  managed_processes['camerad'].stop()
 </s> add     rear, front = get_snapshots(frame, front_frame, focus_perc_threshold)
  finally:
    managed_processes['camerad'].stop()
    HARDWARE.set_power_save(True) </s> remove   params.put_bool("IsTakingSnapshot", False)
  set_offroad_alert("Offroad_IsTakingSnapshot", False)
 </s> add     params.put_bool("IsTakingSnapshot", False)
    set_offroad_alert("Offroad_IsTakingSnapshot", False) </s> remove from selfdrive.hardware import TICI
 </s> add from selfdrive.hardware import HARDWARE, TICI
  try:
    HARDWARE.set_power_save(False)
    managed_processes['camerad'].start()
    frame = "wideRoadCameraState" if TICI else "roadCameraState"
    front_frame = "driverCameraState" if front_camera_allowed else None
    focus_perc_threshold = 0. if TICI else 10 / 12.
  
    if front_camera_allowed:
      os.environ["SEND_DRIVER"] = "1"
  
  try:
    HARDWARE.set_power_save(False)
    managed_processes['camerad'].start()
    frame = "wideRoadCameraState" if TICI else "roadCameraState"
    front_frame = "driverCameraState" if front_camera_allowed else None
    focus_perc_threshold = 0. if TICI else 10 / 12.
  try:
    HARDWARE.set_power_save(False)
    managed_processes['camerad'].start()
    frame = "wideRoadCameraState" if TICI else "roadCameraState"
    front_frame = "driverCameraState" if front_camera_allowed else None
    focus_perc_threshold = 0. if TICI else 10 / 12.
  try:
    HARDWARE.set_power_save(False)
    managed_processes['camerad'].start()
    frame = "wideRoadCameraState" if TICI else "roadCameraState"
    front_frame = "driverCameraState" if front_camera_allowed else None
    focus_perc_threshold = 0. if TICI else 10 / 12.
  try:
    HARDWARE.set_power_save(False)
    managed_processes['camerad'].start()
    frame = "wideRoadCameraState" if TICI else "roadCameraState"
    front_frame = "driverCameraState" if front_camera_allowed else None
    focus_perc_threshold = 0. if TICI else 10 / 12.
  
    rear, front = get_snapshots(frame, front_frame, focus_perc_threshold)
    managed_processes['camerad'].stop()
  
    params.put_bool("IsTakingSnapshot", False)
keep keep keep keep replace replace replace replace keep keep keep keep keep
 fix snapshot camerad crash due to core affinity setting (#22648)

Co-authored-by: Comma Device <device@comma.ai> 
selfdrive/camerad/snapshot/snapshot.py