Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Resolve invalid SSID of access point for Wi-Fi config #1

Merged
merged 1 commit into from
Jul 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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