mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 08:53:41 +08:00
StarPort: Add experimental phone services fix for 2018 Honda Fit
This commit is contained in:
@@ -16,7 +16,8 @@ OPEN_SENSORS = "open_sensors" # open the car-data channel (driving
|
||||
OPEN_VENDOR = "open_vendor" # open the car's vendor channel; nothing is sent on it
|
||||
REQUEST_BT_PAIRING = "request_bt_pairing" # send the Bluetooth pairing request with this comma's own address
|
||||
UNACKED_VIDEO = "unacked_video" # send video without waiting for acknowledgments; the car's pings show it is there
|
||||
ACTIONS = (OPEN_BLUETOOTH, OPEN_PHONE_STATUS, OPEN_SENSORS, OPEN_VENDOR, REQUEST_BT_PAIRING, UNACKED_VIDEO)
|
||||
OPEN_PHONE_SERVICES = "open_phone_services" # open the car-data and Bluetooth channels together, as a phone does
|
||||
ACTIONS = (OPEN_BLUETOOTH, OPEN_PHONE_STATUS, OPEN_SENSORS, OPEN_VENDOR, REQUEST_BT_PAIRING, UNACKED_VIDEO, OPEN_PHONE_SERVICES)
|
||||
|
||||
# ServiceDiscoveryResponse field numbers (JSON turns them into strings).
|
||||
SDR_LABELS = {"2": "car_make", "3": "car_model", "4": "car_year", "7": "head_unit_make", "8": "head_unit_model",
|
||||
@@ -63,6 +64,14 @@ RULES: tuple[Rule, ...] = (
|
||||
("2026-11-16 sessions 1-15",)),
|
||||
ladder=(UNACKED_VIDEO,),
|
||||
summary="This car shows a still picture for a few seconds, then reconnects, over and over."),
|
||||
Rule(id="honda_fit_t5a_83_01d", label="2018 Honda Fit (83.01D.00.B.1021 build)",
|
||||
match={"car_make": "Honda", "car_model": "T5A", "car_year": "2018", "head_unit_make": "HONDA/06",
|
||||
"head_unit_model": "39100-T5A-L313-M1", "head_unit_software_version": "83.01D.00.B.1021"},
|
||||
transports=(WIRED,), status=EXPERIMENTAL,
|
||||
evidence=Evidence("The car answers the screen request with its own screen and stays silent when the Android Auto tile is tapped.",
|
||||
("2026-11-22 sessions 1, 6-9", "2026-11-22 after-tap sessions 1, 3")),
|
||||
ladder=(OPEN_PHONE_SERVICES,),
|
||||
summary="This car connects but never shows the Android Auto screen."),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -894,6 +894,10 @@ class ProjectionSession(Session):
|
||||
done = False
|
||||
if action == "open_bluetooth":
|
||||
done = self.bluetooth_channel is not None or self._open_bluetooth(pair=False)
|
||||
elif action == "open_phone_services":
|
||||
sensors = self.sensor_channel is not None or self._open_sensors()
|
||||
bluetooth = self.bluetooth_channel is not None or self._open_bluetooth(pair=False)
|
||||
done = sensors and bluetooth
|
||||
elif action == "open_phone_status":
|
||||
if self.phone_status_channel is None:
|
||||
self.phone_status_channel = self._open_service(PHONE_STATUS_SERVICE, "phone_status")
|
||||
|
||||
@@ -97,6 +97,19 @@ def test_gates_block_selection(kwargs):
|
||||
assert pick(CFG_ON, **kwargs) is None
|
||||
|
||||
|
||||
FIT = {"car_make": "Honda", "car_model": "T5A", "car_year": "2018", "head_unit_make": "HONDA/06",
|
||||
"head_unit_model": "39100-T5A-L313-M1", "head_unit_software_version": "83.01D.00.B.1021"}
|
||||
FIT_ON = {"head_unit_experiments": True, "head_unit_experiment_rules": ["honda_fit_t5a_83_01d"]}
|
||||
|
||||
|
||||
def test_fit_rule_opens_phone_services_on_wired_only():
|
||||
selection = pick(FIT_ON, FIT, transport="wired", key="usb:fit")
|
||||
assert selection is not None and selection.actions == (hf.OPEN_PHONE_SERVICES,)
|
||||
assert pick(FIT_ON, FIT, transport="wireless") is None
|
||||
assert pick(FIT_ON, {**FIT, "head_unit_software_version": "83.01E.00.B.1021"}, transport="wired", key="usb:fit") is None
|
||||
assert pick({"head_unit_experiments": True}, FIT, transport="wired", key="usb:fit") is None
|
||||
|
||||
|
||||
def test_wired_selection_with_key():
|
||||
assert pick(CFG_ON, transport="wired", key="usb:x") is not None
|
||||
|
||||
|
||||
@@ -74,6 +74,21 @@ def test_ladder_adds_one_channel_per_level(identity, tmp_path):
|
||||
assert VENDOR_CHANNEL in hu.opened and hu.pairing_requests == []
|
||||
|
||||
|
||||
def test_phone_services_action_opens_sensors_and_bluetooth_without_pairing(identity, tmp_path):
|
||||
hu = FakeHeadUnit(identity, bolt=True)
|
||||
session = connect(hu, identity)
|
||||
session.on_discovered = lambda info: (hf.OPEN_PHONE_SERVICES,)
|
||||
session.authenticate()
|
||||
session.start("StarPilot", "comma.ai")
|
||||
pump_until(session, lambda: session.focused, timeout=8.0)
|
||||
session.shutdown()
|
||||
session.peer.close()
|
||||
hu.thread.join(5)
|
||||
assert hu.error is None, hu.error
|
||||
assert sorted(hu.opened) == [1, 3, SENSOR_CHANNEL, BLUETOOTH_CHANNEL]
|
||||
assert hu.sensor_requests and hu.pairing_requests == []
|
||||
|
||||
|
||||
def test_pairing_request_only_at_the_last_level(identity, tmp_path):
|
||||
hu, _ = run(identity, tmp_path, ON, level=5)
|
||||
assert hu.pairing_requests == [("39:90:21:64:07:00", 2)]
|
||||
|
||||
Reference in New Issue
Block a user