From 25b9ce7ac42080ec469c9ade4a48da45f8ef3b33 Mon Sep 17 00:00:00 2001 From: kalmanbendeguz <61018403+kalmanbendeguz@users.noreply.github.com> Date: Thu, 9 Sep 2021 11:12:38 +0200 Subject: [PATCH] Update reset.py to correct serial The previous command (cat /proc/cpuinfo) was incorrect, because the last line is the "Model" description, and not serial. With the command I wrote, it will always be serial number. Works on at least RPi 2,3B,3B+,4. See https://raspberrypi.stackexchange.com/a/106501 --- libs/reset_device/reset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/reset_device/reset.py b/libs/reset_device/reset.py index 950db042..7b96b128 100644 --- a/libs/reset_device/reset.py +++ b/libs/reset_device/reset.py @@ -8,7 +8,7 @@ GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) counter = 0 -serial_last_four = subprocess.check_output(['cat', '/proc/cpuinfo'])[-5:-1].decode('utf-8') +serial_last_four = subprocess.check_output(['cat', '/sys/firmware/devicetree/base/serial-number'])[-5:-1].decode('utf-8') config_hash = reset_lib.config_file_hash() ssid_prefix = config_hash['ssid_prefix'] + " " reboot_required = False