Compare commits

...

3 Commits

Author SHA1 Message Date
18217119fc Version 2.6.9 2024-01-14 09:41:39 +01:00
b03b3119c7 Version 2.6.8 2024-01-13 19:03:25 +01:00
d259e862ba Version 2.6.7 2024-01-12 22:33:08 +01:00
7 changed files with 168 additions and 127 deletions

View File

@ -7,7 +7,7 @@ It seems the Pi 5 is unable to run in monitor mode, will keep you updated on thi
If you are using an older 32-bit version Raspberry Pi, ZeroWH, use this [fork](https://github.com/jayofelony/pwnagotchi-torch/releases/tag/v2.6.4) and make sure you download the `armhf` version. If you are using an older 32-bit version Raspberry Pi, ZeroWH, use this [fork](https://github.com/jayofelony/pwnagotchi-torch/releases/tag/v2.6.4) and make sure you download the `armhf` version.
--- ---
Download latest image file [here](https://github.com/jayofelony/pwnagotchi-bookworm/releases/tag/v2.6.2), and let it auto-update from here on out. Download latest image file [here](https://github.com/jayofelony/pwnagotchi-bookworm/releases/tag/v2.6.7), and let it auto-update from here on out.
**Use RPi imager to flash, please don't flash a new user as this will mess with logs created.** **Use RPi imager to flash, please don't flash a new user as this will mess with logs created.**

View File

@ -172,11 +172,11 @@ def pwnagotchi_cli():
% (pwnagotchi.__version__, latest_ver)) % (pwnagotchi.__version__, latest_ver))
# input validation # input validation
if user_input.lower() in ('y', 'yes'): if user_input.lower() in ('y', 'yes'):
if os.path.exists('/root/.auto-update'):
os.system("rm /root/.auto-update && systemctl restart pwnagotchi") os.system("rm /root/.auto-update && systemctl restart pwnagotchi")
os.system("systemctl restart pwnagotchi")
print("Okay, give me a couple minutes. Just watch pwnlog while you wait.") print("Okay, give me a couple minutes. Just watch pwnlog while you wait.")
elif user_input.lower() in ('n', 'no'): # using this elif for readability
print("Okay, guess not!") print("Okay, guess not!")
else:
print("You are currently on the latest release, v%s." % pwnagotchi.__version__) print("You are currently on the latest release, v%s." % pwnagotchi.__version__)
sys.exit(0) sys.exit(0)

View File

@ -1 +1 @@
__version__ = '2.6.6' __version__ = '2.6.9'

View File

@ -11,10 +11,6 @@ from pwnagotchi import plugins
import pwnagotchi.ui.faces as faces import pwnagotchi.ui.faces as faces
from pwnagotchi.bettercap import Client from pwnagotchi.bettercap import Client
from pwnagotchi.ui.components import Text
from pwnagotchi.ui.view import BLACK
import pwnagotchi.ui.fonts as fonts
class FixServices(plugins.Plugin): class FixServices(plugins.Plugin):
__author__ = 'jayofelony' __author__ = 'jayofelony'
@ -41,14 +37,12 @@ class FixServices(plugins.Plugin):
self.isReloadingMon = False self.isReloadingMon = False
self.connection = None self.connection = None
self.LASTTRY = 0 self.LASTTRY = 0
self._status = "--"
self._count = 0 self._count = 0
def on_loaded(self): def on_loaded(self):
""" """
Gets called when the plugin gets loaded Gets called when the plugin gets loaded
""" """
self._status = "ld"
logging.info("[Fix_Services] plugin loaded.") logging.info("[Fix_Services] plugin loaded.")
def on_ready(self, agent): def on_ready(self, agent):
@ -59,10 +53,8 @@ class FixServices(plugins.Plugin):
logging.info("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output)) logging.info("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
if ",UP," in str(cmd_output): if ",UP," in str(cmd_output):
logging.info("wlan0mon is up.") logging.info("wlan0mon is up.")
self._status = "up"
if len(self.pattern.findall(last_lines)) >= 3: if len(self.pattern.findall(last_lines)) >= 3:
self._status = "XX"
if hasattr(agent, 'view'): if hasattr(agent, 'view'):
display = agent.view() display = agent.view()
display.set('status', 'Blind-Bug detected. Restarting.') display.set('status', 'Blind-Bug detected. Restarting.')
@ -75,12 +67,10 @@ class FixServices(plugins.Plugin):
else: else:
logging.info("[Fix_Services] Logs look good!") logging.info("[Fix_Services] Logs look good!")
self._status = ""
except Exception as err: except Exception as err:
logging.error("[Fix_Services ip link show wlan0mon]: %s" % repr(err)) logging.error("[Fix_Services ip link show wlan0mon]: %s" % repr(err))
try: try:
self._status = "xx"
self._tryTurningItOffAndOnAgain(agent) self._tryTurningItOffAndOnAgain(agent)
except Exception as err: except Exception as err:
logging.error("[Fix_Services OffNOn]: %s" % repr(err)) logging.error("[Fix_Services OffNOn]: %s" % repr(err))
@ -115,7 +105,7 @@ class FixServices(plugins.Plugin):
other_last_lines = ''.join(list(TextIOWrapper(subprocess.Popen(['journalctl', '-n10'], other_last_lines = ''.join(list(TextIOWrapper(subprocess.Popen(['journalctl', '-n10'],
stdout=subprocess.PIPE).stdout))[-10:]) stdout=subprocess.PIPE).stdout))[-10:])
other_other_last_lines = ''.join( other_other_last_lines = ''.join(
list(TextIOWrapper(subprocess.Popen(['tail', '-n10', '/var/log/pwnagotchi.log'], list(TextIOWrapper(subprocess.Popen(['tail', '-n10', '/home/pi/logs/pwnagotchi.log'],
stdout=subprocess.PIPE).stdout))[-10:]) stdout=subprocess.PIPE).stdout))[-10:])
# don't check if we ran a reset recently # don't check if we ran a reset recently
logging.debug("[Fix_Services]**** epoch") logging.debug("[Fix_Services]**** epoch")
@ -153,7 +143,6 @@ class FixServices(plugins.Plugin):
logging.info("[Fix_Services] wifi.recon flip: success!") logging.info("[Fix_Services] wifi.recon flip: success!")
if display: if display:
display.update(force=True, new_data={"status": "Wifi recon flipped!", display.update(force=True, new_data={"status": "Wifi recon flipped!",
"brcmfmac_status": self._status,
"face": faces.COOL}) "face": faces.COOL})
else: else:
print("Wifi recon flipped\nthat was easy!") print("Wifi recon flipped\nthat was easy!")
@ -223,12 +212,11 @@ class FixServices(plugins.Plugin):
self.isReloadingMon = True self.isReloadingMon = True
self.LASTTRY = time.time() self.LASTTRY = time.time()
self._status = "BL"
if hasattr(connection, 'view'): if hasattr(connection, 'view'):
display = connection.view() display = connection.view()
if display: if display:
display.update(force=True, new_data={"status": "I'm blind! Try turning it off and on again", display.update(force=True, new_data={"status": "I'm blind! Try turning it off and on again",
"brcmfmac_status": self._status, "face": faces.BORED}) "face": faces.BORED})
else: else:
display = None display = None
@ -271,7 +259,6 @@ class FixServices(plugins.Plugin):
try: try:
cmd_output = subprocess.check_output("monstop", shell=True) cmd_output = subprocess.check_output("monstop", shell=True)
self._status = "dn"
self.logPrintView("info", "[Fix_Services] wlan0mon down and deleted: %s" % cmd_output, self.logPrintView("info", "[Fix_Services] wlan0mon down and deleted: %s" % cmd_output,
display, {"status": "wlan0mon d-d-d-down!", "face": faces.BORED}) display, {"status": "wlan0mon d-d-d-down!", "face": faces.BORED})
except Exception as nope: except Exception as nope:
@ -291,7 +278,6 @@ class FixServices(plugins.Plugin):
cmd_output = subprocess.check_output("sudo modprobe -r brcmfmac", shell=True) cmd_output = subprocess.check_output("sudo modprobe -r brcmfmac", shell=True)
self.logPrintView("info", "[Fix_Services] unloaded brcmfmac", display, self.logPrintView("info", "[Fix_Services] unloaded brcmfmac", display,
{"status": "Turning it off #%s" % tries, "face": faces.SMART}) {"status": "Turning it off #%s" % tries, "face": faces.SMART})
self._status = "ul"
time.sleep(1 + tries) time.sleep(1 + tries)
# reload the module # reload the module
@ -300,7 +286,6 @@ class FixServices(plugins.Plugin):
cmd_output = subprocess.check_output("sudo modprobe brcmfmac", shell=True) cmd_output = subprocess.check_output("sudo modprobe brcmfmac", shell=True)
self.logPrintView("info", "[Fix_Services] reloaded brcmfmac") self.logPrintView("info", "[Fix_Services] reloaded brcmfmac")
self._status = "rl"
time.sleep(10 + 4 * tries) # give it some time for wlan device to stabilize, or whatever time.sleep(10 + 4 * tries) # give it some time for wlan device to stabilize, or whatever
# success! now make the mon0 # success! now make the mon0
@ -308,14 +293,12 @@ class FixServices(plugins.Plugin):
cmd_output = subprocess.check_output("monstart", shell=True) cmd_output = subprocess.check_output("monstart", shell=True)
self.logPrintView("info", "[Fix_Services interface add wlan0mon] worked #%s: %s" self.logPrintView("info", "[Fix_Services interface add wlan0mon] worked #%s: %s"
% (tries, cmd_output)) % (tries, cmd_output))
self._status = "up"
time.sleep(tries + 5) time.sleep(tries + 5)
try: try:
# try accessing mon0 in bettercap # try accessing mon0 in bettercap
result = connection.run("set wifi.interface wlan0mon") result = connection.run("set wifi.interface wlan0mon")
if "success" in result: if "success" in result:
logging.info("[Fix_Services set wifi.interface wlan0mon] worked!") logging.info("[Fix_Services set wifi.interface wlan0mon] worked!")
self._status = ""
self._count = self._count + 1 self._count = self._count + 1
time.sleep(1) time.sleep(1)
# stop looping and get back to recon # stop looping and get back to recon
@ -354,7 +337,6 @@ class FixServices(plugins.Plugin):
if tries < 3: if tries < 3:
if display: if display:
display.update(force=True, new_data={"status": "And back on again...", display.update(force=True, new_data={"status": "And back on again...",
"brcmfmac_status": self._status,
"face": faces.INTENSE}) "face": faces.INTENSE})
else: else:
print("And back on again...") print("And back on again...")
@ -370,10 +352,8 @@ class FixServices(plugins.Plugin):
result = connection.run("wifi.clear; wifi.recon on") result = connection.run("wifi.clear; wifi.recon on")
if "success" in result: # and result["success"] is True: if "success" in result: # and result["success"] is True:
self._status = ""
if display: if display:
display.update(force=True, new_data={"status": "I can see again! (probably)", display.update(force=True, new_data={"status": "I can see again! (probably)",
"brcmfmac_status": self._status,
"face": faces.HAPPY}) "face": faces.HAPPY})
else: else:
print("I can see again") print("I can see again")
@ -388,31 +368,9 @@ class FixServices(plugins.Plugin):
logging.error("[Fix_Services wifi.recon on] %s" % repr(err)) logging.error("[Fix_Services wifi.recon on] %s" % repr(err))
pwnagotchi.reboot() pwnagotchi.reboot()
# called to setup the ui elements
def on_ui_setup(self, ui):
with ui._lock:
# add custom UI elements
if "position" in self.options:
pos = self.options['position'].split(',')
pos = [int(x.strip()) for x in pos]
else:
pos = (ui.width() / 2 + 35, ui.height() - 11)
logging.info("Got here")
ui.add_element('brcmfmac_status', Text(color=BLACK, value='--', position=pos, font=fonts.Small))
# called when the ui is updated
def on_ui_update(self, ui):
# update those elements
if self._status:
ui.set('brcmfmac_status', "wlan0mon %s" % self._status)
else:
ui.set('brcmfmac_status', "rst#%s" % self._count)
def on_unload(self, ui): def on_unload(self, ui):
with ui._lock: with ui._lock:
try: try:
ui.remove_element('brcmfmac_status')
logging.info("[Fix_Services] unloaded") logging.info("[Fix_Services] unloaded")
except Exception as err: except Exception as err:
logging.info("[Fix_Services] unload err %s " % repr(err)) logging.info("[Fix_Services] unload err %s " % repr(err))

View File

@ -141,7 +141,7 @@ class MemTemp(plugins.Plugin):
elif ui.is_inky(): elif ui.is_inky():
h_pos = (140, 68) h_pos = (140, 68)
v_pos = (160, 54) v_pos = (160, 54)
elif ui.is_waveshare27inch(): elif ui.is_waveshare2in7():
h_pos = (192, 138) h_pos = (192, 138)
v_pos = (211, 122) v_pos = (211, 122)
else: else:

View File

@ -31,7 +31,6 @@ import os
import logging import logging
import sys import sys
import time import time
import subprocess
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -46,48 +45,16 @@ class RaspberryPi:
def __init__(self): def __init__(self):
import spidev import spidev
import gpiozero import RPi.GPIO
self.GPIO = RPi.GPIO
self.SPI = spidev.SpiDev() self.SPI = spidev.SpiDev()
self.GPIO_RST_PIN = gpiozero.LED(self.RST_PIN)
self.GPIO_DC_PIN = gpiozero.LED(self.DC_PIN)
# self.GPIO_CS_PIN = gpiozero.LED(self.CS_PIN)
self.GPIO_PWR_PIN = gpiozero.LED(self.PWR_PIN)
self.GPIO_BUSY_PIN = gpiozero.Button(self.BUSY_PIN, pull_up=False)
def digital_write(self, pin, value): def digital_write(self, pin, value):
if pin == self.RST_PIN: self.GPIO.output(pin, value)
if value:
self.GPIO_RST_PIN.on()
else:
self.GPIO_RST_PIN.off()
elif pin == self.DC_PIN:
if value:
self.GPIO_DC_PIN.on()
else:
self.GPIO_DC_PIN.off()
# elif pin == self.CS_PIN:
# if value:
# self.GPIO_CS_PIN.on()
# else:
# self.GPIO_CS_PIN.off()
elif pin == self.PWR_PIN:
if value:
self.GPIO_PWR_PIN.on()
else:
self.GPIO_PWR_PIN.off()
def digital_read(self, pin): def digital_read(self, pin):
if pin == self.BUSY_PIN: return self.GPIO.input(pin)
return self.GPIO_BUSY_PIN.value
elif pin == self.RST_PIN:
return self.RST_PIN.value
elif pin == self.DC_PIN:
return self.DC_PIN.value
# elif pin == self.CS_PIN:
# return self.CS_PIN.value
elif pin == self.PWR_PIN:
return self.PWR_PIN.value
def delay_ms(self, delaytime): def delay_ms(self, delaytime):
time.sleep(delaytime / 1000.0) time.sleep(delaytime / 1000.0)
@ -99,7 +66,15 @@ class RaspberryPi:
self.SPI.writebytes2(data) self.SPI.writebytes2(data)
def module_init(self): def module_init(self):
self.GPIO_PWR_PIN.on() self.GPIO.setmode(self.GPIO.BCM)
self.GPIO.setwarnings(False)
self.GPIO.setup(self.RST_PIN, self.GPIO.OUT)
self.GPIO.setup(self.DC_PIN, self.GPIO.OUT)
self.GPIO.setup(self.CS_PIN, self.GPIO.OUT)
self.GPIO.setup(self.PWR_PIN, self.GPIO.OUT)
self.GPIO.setup(self.BUSY_PIN, self.GPIO.IN)
self.GPIO.output(self.PWR_PIN, 1)
# SPI device, bus = 0, device = 0 # SPI device, bus = 0, device = 0
self.SPI.open(0, 0) self.SPI.open(0, 0)
@ -107,21 +82,16 @@ class RaspberryPi:
self.SPI.mode = 0b00 self.SPI.mode = 0b00
return 0 return 0
def module_exit(self, cleanup=False): def module_exit(self):
logger.debug("spi end") logger.debug("spi end")
self.SPI.close() self.SPI.close()
self.GPIO_RST_PIN.off()
self.GPIO_DC_PIN.off()
self.GPIO_PWR_PIN.off()
logger.debug("close 5V, Module enters 0 power consumption ...") logger.debug("close 5V, Module enters 0 power consumption ...")
self.GPIO.output(self.RST_PIN, 0)
self.GPIO.output(self.DC_PIN, 0)
self.GPIO.output(self.PWR_PIN, 0)
if cleanup: self.GPIO.cleanup([self.RST_PIN, self.DC_PIN, self.CS_PIN, self.BUSY_PIN, self.PWR_PIN])
self.GPIO_RST_PIN.close()
self.GPIO_DC_PIN.close()
# self.GPIO_CS_PIN.close()
self.GPIO_PWR_PIN.close()
self.GPIO_BUSY_PIN.close()
class JetsonNano: class JetsonNano:
@ -260,20 +230,12 @@ class SunriseX3:
self.GPIO.cleanup([self.RST_PIN, self.DC_PIN, self.CS_PIN, self.BUSY_PIN], self.PWR_PIN) self.GPIO.cleanup([self.RST_PIN, self.DC_PIN, self.CS_PIN, self.BUSY_PIN], self.PWR_PIN)
if sys.version_info[0] == 2: if os.path.exists('/sys/bus/platform/drivers/gpiomem-bcm2835'):
process = subprocess.Popen("cat /proc/cpuinfo | grep Raspberry", shell=True, stdout=subprocess.PIPE)
else:
process = subprocess.Popen("cat /proc/cpuinfo | grep Raspberry", shell=True, stdout=subprocess.PIPE, text=True)
output, _ = process.communicate()
if sys.version_info[0] == 2:
output = output.decode(sys.stdout.encoding)
if "Raspberry" in output:
implementation = RaspberryPi() implementation = RaspberryPi()
elif os.path.exists('/sys/bus/platform/drivers/gpio-x3'): elif os.path.exists('/sys/bus/platform/drivers/gpio-x3'):
implementation = SunriseX3() implementation = SunriseX3()
else: else:
implementation = JetsonNano() implementation = RaspberryPi()
for func in [x for x in dir(implementation) if not x.startswith('_')]: for func in [x for x in dir(implementation) if not x.startswith('_')]:
setattr(sys.modules[__name__], func, getattr(implementation, func)) setattr(sys.modules[__name__], func, getattr(implementation, func))

View File

@ -240,7 +240,6 @@ def load_config(args):
# the very first step is to normalize the display name, so we don't need dozens of if/elif around # the very first step is to normalize the display name, so we don't need dozens of if/elif around
if config['ui']['display']['type'] in ('inky', 'inkyphat'): if config['ui']['display']['type'] in ('inky', 'inkyphat'):
config['ui']['display']['type'] = 'inky' config['ui']['display']['type'] = 'inky'
elif config['ui']['display']['type'] in ('papirus', 'papi'): elif config['ui']['display']['type'] in ('papirus', 'papi'):
config['ui']['display']['type'] = 'papirus' config['ui']['display']['type'] = 'papirus'
@ -259,14 +258,26 @@ def load_config(args):
elif config['ui']['display']['type'] in ('ws_4', 'ws4', 'waveshare_4', 'waveshare4'): elif config['ui']['display']['type'] in ('ws_4', 'ws4', 'waveshare_4', 'waveshare4'):
config['ui']['display']['type'] = 'waveshare_4' config['ui']['display']['type'] = 'waveshare_4'
elif config['ui']['display']['type'] in ('ws_27inch', 'ws27inch', 'waveshare_27inch', 'waveshare27inch'): elif config['ui']['display']['type'] in ('ws_27inch', 'ws27inch', 'waveshare2in7', 'waveshare_27inch', 'waveshare27inch'):
config['ui']['display']['type'] = 'waveshare27inch' config['ui']['display']['type'] = 'waveshare27inch'
elif config['ui']['display']['type'] in ('ws_27inchv2', 'ws27inchv2', 'waveshare_27inchv2', 'waveshare27inchv2'): elif config['ui']['display']['type'] in ('ws_27inchv2', 'waveshare2in7_v2', 'ws27inchv2', 'waveshare_27inchv2', 'waveshare27inchv2'):
config['ui']['display']['type'] = 'waveshare27inchv2' config['ui']['display']['type'] = 'waveshare2in7_v2'
elif config['ui']['display']['type'] in ('ws_29inch', 'ws29inch', 'waveshare_29inch', 'waveshare29inch'): elif config['ui']['display']['type'] in ('ws_27inchbv2', 'waveshare2in7b_v2', 'ws27inchbv2', 'waveshare_27inchbv2', 'waveshare27inchbv2'):
config['ui']['display']['type'] = 'waveshare29inch' config['ui']['display']['type'] = 'waveshare2in7b_v2'
elif config['ui']['display']['type'] in ('ws_29inch', 'waveshare2in9', 'ws29inch', 'waveshare_29inch', 'waveshare29inch'):
config['ui']['display']['type'] = 'waveshare2in9'
elif config['ui']['display']['type'] in ('ws_29inchv2', 'waveshare2in9_v2', 'ws29inchv2', 'waveshare_29inchv2', 'waveshare29inchv2'):
config['ui']['display']['type'] = 'waveshare2in9_v2'
elif config['ui']['display']['type'] in ('ws_29inchbv3', 'waveshare2in9b_v3', 'ws29inchbv3', 'waveshare_29inchbv3', 'waveshare29inchbv3'):
config['ui']['display']['type'] = 'waveshare2in9b_v3'
elif config['ui']['display']['type'] in ('ws_29inchbv4', 'waveshare2in9b_v4', 'ws29inchbv4', 'waveshare_29inchbv4', 'waveshare29inchbv4'):
config['ui']['display']['type'] = 'waveshare2in9b_v4'
elif config['ui']['display']['type'] in 'lcdhat': elif config['ui']['display']['type'] in 'lcdhat':
config['ui']['display']['type'] = 'lcdhat' config['ui']['display']['type'] = 'lcdhat'
@ -277,21 +288,29 @@ def load_config(args):
elif config['ui']['display']['type'] in ('dfrobot_2', 'df2'): elif config['ui']['display']['type'] in ('dfrobot_2', 'df2'):
config['ui']['display']['type'] = 'dfrobot_2' config['ui']['display']['type'] = 'dfrobot_2'
elif config['ui']['display']['type'] in ('ws_154inch', 'ws154inch', 'waveshare_154inch', 'waveshare154inch'): elif config['ui']['display']['type'] in ('ws_154inch', 'waveshare1in54', 'ws154inch', 'waveshare_154inch', 'waveshare154inch'):
config['ui']['display']['type'] = 'waveshare154inch' config['ui']['display']['type'] = 'waveshare1in54'
elif config['ui']['display']['type'] in ( elif config['ui']['display']['type'] in ('ws_154inchb', 'waveshare1in54b', 'ws154inchb', 'waveshare_154inchb', 'waveshare154inchb'):
'waveshare144lcd', 'ws_144inch', 'ws144inch', 'waveshare_144inch', 'waveshare144inch'): config['ui']['display']['type'] = 'waveshare1in54b'
elif config['ui']['display']['type'] in ('ws_154inchbv2', 'waveshare1in54bv2', 'ws154inchbv2', 'waveshare_154inchbv2', 'waveshare154inchbv2'):
config['ui']['display']['type'] = 'waveshare1in54b_v2'
elif config['ui']['display']['type'] in ('ws_154inchv2', 'waveshare1in54v2', 'ws154inchv2', 'waveshare_154inchv2', 'waveshare154inchv2'):
config['ui']['display']['type'] = 'waveshare1in54_v2'
elif config['ui']['display']['type'] in ('waveshare144lcd', 'ws_144inch', 'ws144inch', 'waveshare_144inch', 'waveshare144inch'):
config['ui']['display']['type'] = 'waveshare144lcd' config['ui']['display']['type'] = 'waveshare144lcd'
elif config['ui']['display']['type'] in ('ws_213d', 'ws213d', 'waveshare_213d', 'waveshare213d'): elif config['ui']['display']['type'] in ('ws_213d', 'ws213d', 'waveshare2in13d', 'waveshare_213d', 'waveshare213d'):
config['ui']['display']['type'] = 'waveshare213d' config['ui']['display']['type'] = 'waveshare2in13d'
elif config['ui']['display']['type'] in ('ws_213bc', 'ws213bc', 'waveshare_213bc', 'waveshare213bc'): elif config['ui']['display']['type'] in ('ws_213bc', 'ws213bc', 'waveshare2in13bc', 'waveshare_213bc', 'waveshare213bc'):
config['ui']['display']['type'] = 'waveshare213bc' config['ui']['display']['type'] = 'waveshare2in13bc'
elif config['ui']['display']['type'] in ('ws_213bv4', 'ws213bv4', 'waveshare_213bv4', 'waveshare213inb_v4'): elif config['ui']['display']['type'] in ('ws_213bv4', 'waveshare2in13b_v4', 'ws213bv4', 'waveshare_213bv4', 'waveshare213inb_v4'):
config['ui']['display']['type'] = 'waveshare213inb_v4' config['ui']['display']['type'] = 'waveshare2in13b_v4'
elif config['ui']['display']['type'] in 'spotpear24inch': elif config['ui']['display']['type'] in 'spotpear24inch':
config['ui']['display']['type'] = 'spotpear24inch' config['ui']['display']['type'] = 'spotpear24inch'
@ -302,6 +321,105 @@ def load_config(args):
elif config['ui']['display']['type'] in 'waveshare35lcd': elif config['ui']['display']['type'] in 'waveshare35lcd':
config['ui']['display']['type'] = 'waveshare35lcd' config['ui']['display']['type'] = 'waveshare35lcd'
elif config['ui']['display']['type'] in 'waveshare1in54c':
config['ui']['display']['type'] = 'waveshare1in54c'
elif config['ui']['display']['type'] in 'waveshare1in64g':
config['ui']['display']['type'] = 'waveshare1in64g'
elif config['ui']['display']['type'] in 'waveshare1in02':
config['ui']['display']['type'] = 'waveshare1in02'
elif config['ui']['display']['type'] in 'waveshare2in9bc':
config['ui']['display']['type'] = 'waveshare2in9bc'
elif config['ui']['display']['type'] in 'waveshare2in9d':
config['ui']['display']['type'] = 'waveshare2in9d'
elif config['ui']['display']['type'] in 'waveshare2in13b_v3':
config['ui']['display']['type'] = 'waveshare2in13b_v3'
elif config['ui']['display']['type'] in 'waveshare2in23g':
config['ui']['display']['type'] = 'waveshare2in23g'
elif config['ui']['display']['type'] in 'waveshare2in36g':
config['ui']['display']['type'] = 'waveshare2in36g'
elif config['ui']['display']['type'] in 'waveshare2in66':
config['ui']['display']['type'] = 'waveshare2in66'
elif config['ui']['display']['type'] in 'waveshare3in0g':
config['ui']['display']['type'] = 'waveshare3in0g'
elif config['ui']['display']['type'] in 'waveshare3in7':
config['ui']['display']['type'] = 'waveshare3in7'
elif config['ui']['display']['type'] in 'waveshare3in52':
config['ui']['display']['type'] = 'waveshare3in52'
elif config['ui']['display']['type'] in 'waveshare4in01f':
config['ui']['display']['type'] = 'waveshare4in01f'
elif config['ui']['display']['type'] in 'waveshare4in2':
config['ui']['display']['type'] = 'waveshare4in2'
elif config['ui']['display']['type'] in 'waveshare4in2_v2':
config['ui']['display']['type'] = 'waveshare4in2_v2'
elif config['ui']['display']['type'] in 'waveshare4in2b_v2':
config['ui']['display']['type'] = 'waveshare4in2b_v2'
elif config['ui']['display']['type'] in 'waveshare4in2bc':
config['ui']['display']['type'] = 'waveshare4in2bc'
elif config['ui']['display']['type'] in 'waveshare4in26':
config['ui']['display']['type'] = 'waveshare4in26'
elif config['ui']['display']['type'] in 'waveshare4in37g':
config['ui']['display']['type'] = 'waveshare4in37g'
elif config['ui']['display']['type'] in 'waveshare5in65f':
config['ui']['display']['type'] = 'waveshare5in65f'
elif config['ui']['display']['type'] in 'waveshare5in83':
config['ui']['display']['type'] = 'waveshare5in83'
elif config['ui']['display']['type'] in 'waveshare5in83_v2':
config['ui']['display']['type'] = 'waveshare5in83_v2'
elif config['ui']['display']['type'] in 'waveshare5in83b_v2':
config['ui']['display']['type'] = 'waveshare5in83b_v2'
elif config['ui']['display']['type'] in 'waveshare5in83bc':
config['ui']['display']['type'] = 'waveshare5in83bc'
elif config['ui']['display']['type'] in 'waveshare7in3f':
config['ui']['display']['type'] = 'waveshare7in3f'
elif config['ui']['display']['type'] in 'waveshare7in3g':
config['ui']['display']['type'] = 'waveshare7in3g'
elif config['ui']['display']['type'] in 'waveshare7in5':
config['ui']['display']['type'] = 'waveshare7in5'
elif config['ui']['display']['type'] in 'waveshare7in5_HD':
config['ui']['display']['type'] = 'waveshare7in5_HD'
elif config['ui']['display']['type'] in 'waveshare7in5_v2':
config['ui']['display']['type'] = 'waveshare7in5_v2'
elif config['ui']['display']['type'] in 'waveshare7in5b_HD':
config['ui']['display']['type'] = 'waveshare7in5b_HD'
elif config['ui']['display']['type'] in 'waveshare7in5b_v2':
config['ui']['display']['type'] = 'waveshare7in5b_v2'
elif config['ui']['display']['type'] in 'waveshare7in5bc':
config['ui']['display']['type'] = 'waveshare7in5bc'
elif config['ui']['display']['type'] in 'waveshare13in3k':
config['ui']['display']['type'] = 'waveshare13in3k'
else: else:
print("unsupported display type %s" % config['ui']['display']['type']) print("unsupported display type %s" % config['ui']['display']['type'])
sys.exit(1) sys.exit(1)
@ -326,7 +444,10 @@ def iface_channels(ifname):
output = subprocess.getoutput("/sbin/iw phy%s channels | grep ' MHz' | grep -v disabled | sed 's/^.*\[//g' | sed s/\].*\$//g" % phy) output = subprocess.getoutput("/sbin/iw phy%s channels | grep ' MHz' | grep -v disabled | sed 's/^.*\[//g' | sed s/\].*\$//g" % phy)
for line in output.split("\n"): for line in output.split("\n"):
line = line.strip() line = line.strip()
try:
channels.append(int(line)) channels.append(int(line))
except Exception as e:
pass
return channels return channels