From 90d4906aa97e542a25b89ff4c79992cc6735243c Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 4 Oct 2022 20:38:39 -0700 Subject: [PATCH] VIN: make Ford exception more explicit (#25972) * Update vin.py * only replace from end old-commit-hash: 7ed064f7baff36b08713729c9c99304ef0224a58 --- selfdrive/car/vin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/vin.py b/selfdrive/car/vin.py index ee40cf298a..cf1c25e851 100755 --- a/selfdrive/car/vin.py +++ b/selfdrive/car/vin.py @@ -28,7 +28,8 @@ def get_vin(logcan, sendcan, bus, timeout=0.1, retry=5, debug=False): vin = results.get((addr, None)) if vin is not None: # Ford pads with null bytes - vin = vin.replace(b'\x00', b'') + if len(vin) == 24: + vin = re.sub(b'\x00*$', b'', vin) # Honda Bosch response starts with a length, trim to correct length if vin.startswith(b'\x11'):