Skip to content

Commit

Permalink
fix: Resolve invalid SSID of access point for Wi-Fi config
Browse files Browse the repository at this point in the history
  • Loading branch information
marcullo committed Jul 17, 2020
1 parent 51a0f18 commit 3e0482c
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions libs/reset_device/reset.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
import RPi.GPIO as GPIO
import os
import re
import time
import subprocess
import reset_lib

def get_serial():
pattern = r'^Serial\s*:\s*(\w+)$'
cpuinfo = subprocess.check_output(['cat', '/proc/cpuinfo']).decode()
lines = cpuinfo.split('\n')

for line in lines:
match = re.match(pattern, line.strip())
if not match:
continue
return match.group(1)

return ''


GPIO.setmode(GPIO.BCM)
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 = get_serial()
serial_last_four = serial_last_four[-4:] if len(serial_last_four) > 4 else serial_last_four # get last 4 characters of serial
config_hash = reset_lib.config_file_hash()
ssid_prefix = config_hash['ssid_prefix'] + " "
ssid_prefix = config_hash['ssid_prefix']
reboot_required = False


Expand Down

0 comments on commit 3e0482c

Please sign in to comment.