Compare commits

..

2 Commits

Author SHA1 Message Date
744a50aa67 Update defaults.toml
Signed-off-by: wpa-2 <9049886+wpa-2@users.noreply.github.com>
2024-02-28 19:09:14 +00:00
eb6e229d36 Update defaults.toml
added some bluetooth information 

Signed-off-by: wpa-2 <9049886+wpa-2@users.noreply.github.com>
2024-02-28 17:57:04 +00:00
19 changed files with 424 additions and 396 deletions

View File

@ -7,7 +7,6 @@ import sys
import toml import toml
import requests import requests
import os import os
import re
import pwnagotchi import pwnagotchi
from pwnagotchi import utils from pwnagotchi import utils
@ -134,8 +133,6 @@ if __name__ == '__main__':
help="Print the configuration.") help="Print the configuration.")
# Jayofelony added these # Jayofelony added these
parser.add_argument('--wizard', dest="wizard", action="store_true", default=False,
help="Interactive installation of your personal configuration.")
parser.add_argument('--check-update', dest="check_update", action="store_true", default=False, parser.add_argument('--check-update', dest="check_update", action="store_true", default=False,
help="Check for updates on Pwnagotchi. And tells current version.") help="Check for updates on Pwnagotchi. And tells current version.")
parser.add_argument('--donate', dest="donate", action="store_true", default=False, parser.add_argument('--donate', dest="donate", action="store_true", default=False,
@ -160,102 +157,6 @@ if __name__ == '__main__':
print(pwnagotchi.__version__) print(pwnagotchi.__version__)
sys.exit(0) sys.exit(0)
if args.wizard:
def is_valid_hostname(hostname):
if len(hostname) > 255:
return False
if hostname[-1] == ".":
hostname = hostname[:-1] # strip exactly one dot from the right, if present
allowed = re.compile("(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE)
return all(allowed.match(x) for x in hostname.split("."))
pwn_restore = input("Do you want to restore the previous configuration? [Y/N]\n")
if pwn_restore in ('y', 'yes'):
os.system("cp -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml")
print("Your previous configuration is restored, and I will restart in 5 seconds.")
time.sleep(5)
os.system("service pwnagotchi restart")
else:
pwn_check = input("This will create a new configuration file and overwrite your current backup, are you sure? [Y/N]\n")
if pwn_check.lower() in ('y', 'yes'):
os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak")
with open("/etc/pwnagotchi/config.toml", "a+") as f:
f.write("# Do not edit this file if you do not know what you are doing!!!\n\n")
# Set pwnagotchi name
print("Welcome to the interactive installation of your personal Pwnagotchi configuration!\n"
"My name is Jayofelony, how may I call you?\n")
pwn_name = input("Pwnagotchi name (no spaces): ")
if pwn_name == "":
pwn_name = "Pwnagotchi"
print("I shall go by Pwnagotchi from now on!")
pwn_name = f"main.name = \"{pwn_name}\"\n"
f.write(pwn_name)
else:
if is_valid_hostname(pwn_name):
print(f"I shall go by {pwn_name} from now on!")
pwn_name = f"main.name = \"{pwn_name}\"\n"
f.write(pwn_name)
else:
print("You have chosen an invalid name. Please start over.")
exit()
pwn_whitelist = input("How many networks do you want to whitelist? "
"We will also ask a MAC for each network?\n"
"Each SSID and BSSID count as 1 network. \n\n"
"Be sure to use digits as your answer.\n\n"
"Amount of networks: ")
if int(pwn_whitelist) > 0:
f.write("main.whitelist = [\n")
for x in range(int(pwn_whitelist)):
ssid = input("SSID (Name): ")
bssid = input("BSSID (MAC): ")
f.write(f"\t\"{ssid}\",\n")
f.write(f"\t\"{bssid}\",\n")
f.write("]\n")
# set bluetooth tether
pwn_bluetooth = input("Do you want to enable BT-Tether? [Y/N] ")
if pwn_bluetooth.lower() in ('y', 'yes'):
f.write("main.plugins.bt-tether.enabled = true\n\n")
pwn_bluetooth_device = input("What device do you use? Android or iOS? ")
if pwn_bluetooth_device.lower() == "android":
f.write("main.plugins.bt-tether.devices.android-phone.enabled = true\n")
pwn_bluetooth_mac = input("What is the bluetooth MAC of your device? ")
if pwn_bluetooth_mac != "":
f.write(f"main.plugins.bt-tether.devices.android-phone.mac = \"{pwn_bluetooth_mac}\"\n")
elif pwn_bluetooth_device.lower() == "ios":
f.write("main.plugins.bt-tether.devices.ios-phone.enabled = true\n")
pwn_bluetooth_mac = input("What is the bluetooth MAC of your device? ")
if pwn_bluetooth_mac != "":
f.write(f"main.plugins.bt-tether.devices.ios-phone.mac = \"{pwn_bluetooth_mac}\"\n")
# set up display settings
pwn_display_enabled = input("Do you use a display? [Y/N] ")
if pwn_display_enabled.lower() in ('y', 'yes'):
f.write("ui.display.enabled = true\n")
pwn_display_type = input("What display do you use?\n\n"
"Be sure to check for the correct display type @ \n"
"https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431\n")
if pwn_display_type != "":
f.write(f"ui.display.type = \"{pwn_display_type}\"\n")
pwn_display_invert = input("Do you want to invert the display colors? [Y/N]\n\n"
"N = Black background\n"
"Y = White background\n")
if pwn_display_invert.lower() in ('y', 'yes'):
f.write("ui.invert = true\n")
f.close()
if pwn_bluetooth.lower() in ('y', 'yes'):
if pwn_bluetooth_device.lower == "android":
print("To visit the webui when connected with your phone, visit: http://192.168.44.44:8080\n"
"Your configuration is done, and I will restart in 5 seconds.")
elif pwn_bluetooth_device.lower == "ios":
print("To visit the webui when connected with your phone, visit: http://172.20.10.6:8080\n"
"Your configuration is done, and I will restart in 5 seconds.")
else:
print("Your configuration is done, and I will restart in 5 seconds.")
time.sleep(5)
os.system("service pwnagotchi restart")
else:
print("Ok, doing nothing.")
sys.exit(0)
if args.donate: if args.donate:
print("Donations can made @ \n " print("Donations can made @ \n "
"https://www.patreon.com/pwnagotchi_torch \n " "https://www.patreon.com/pwnagotchi_torch \n "
@ -271,7 +172,7 @@ if __name__ == '__main__':
local = version_to_tuple(pwnagotchi.__version__) local = version_to_tuple(pwnagotchi.__version__)
remote = version_to_tuple(latest_ver) remote = version_to_tuple(latest_ver)
if remote > local: if remote > local:
user_input = input("There is a new version available! Update from v%s to v%s?\n[Y/N] " user_input = input("There is a new version available! Update from v%s to v%s?\n[y(es)/n(o)]"
% (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'):

View File

@ -383,11 +383,6 @@
block: | block: |
export GOPATH=$HOME/go export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
alias custom='cd /usr/local/share/pwnagotchi/custom-plugins/'
alias config='sudo nano /etc/pwnagotchi/config.toml'
alias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered "s/,[[:digit:]]\\{3\\}\\]//g" | cut -d " " -f 2-'
alias pwnver='python3 -c "import pwnagotchi as p; print(p.__version__)"'
alias pwnkill='sudo killall -USR1 pwnagotchi'
when: golang.changed when: golang.changed
- name: download pwngrid - name: download pwngrid
@ -456,7 +451,7 @@
# Add your configuration overrides on this file any configuration changes done to default.toml will be lost! # Add your configuration overrides on this file any configuration changes done to default.toml will be lost!
# Example: # Example:
# ui.display.enabled = true # ui.display.enabled = true
# ui.display.type = "waveshare_4" # ui.display.type = "waveshare_2"
when: not user_config.stat.exists when: not user_config.stat.exists
- name: Delete motd 10-uname - name: Delete motd 10-uname
@ -499,6 +494,24 @@
regexp: '(.*)$' regexp: '(.*)$'
line: '\1 modules-load=dwc2,g_ether' line: '\1 modules-load=dwc2,g_ether'
- name: Add pwnlog alias
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'"
insertafter: EOF
- name: Add pwnver alias
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'"
insertafter: EOF
- name: Add pwnkill alias to restart pwnagotchi with a signal
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnkill='sudo killall -USR1 pwnagotchi'"
insertafter: EOF
- name: add firmware packages to hold - name: add firmware packages to hold
dpkg_selections: dpkg_selections:
name: "{{ item }}" name: "{{ item }}"

View File

@ -2,7 +2,7 @@ _show_complete()
{ {
local cur opts node_names all_options opt_line local cur opts node_names all_options opt_line
all_options=" all_options="
pwnagotchi -h --help -C --config -U --user-config --manual --skip-session --clear --debug --version --print-config --wizard --check-update --donate {plugins,google} pwnagotchi -h --help -C --config -U --user-config --manual --skip-session --clear --debug --version --print-config --check-update --donate {plugins,google}
pwnagotchi plugins -h --help {list,install,enable,disable,uninstall,update,upgrade} pwnagotchi plugins -h --help {list,install,enable,disable,uninstall,update,upgrade}
pwnagotchi plugins list -i --installed -h --help pwnagotchi plugins list -i --installed -h --help
pwnagotchi plugins install -h --help pwnagotchi plugins install -h --help

View File

@ -20,7 +20,6 @@ echo " I'm managed by systemd. Here are some basic commands."
echo echo
echo " If you want to know what I'm doing, you can check my logs with the command" echo " If you want to know what I'm doing, you can check my logs with the command"
echo " - pwnlog" echo " - pwnlog"
echo " - sudo pwnagotchi --wizard, to help set up a config.toml"
echo " - sudo pwnagotchi --version, to check the current version" echo " - sudo pwnagotchi --version, to check the current version"
echo " - sudo pwnagotchi --donate, to see how you can donate to this project" echo " - sudo pwnagotchi --donate, to see how you can donate to this project"
echo " - sudo pwnagotchi --check-update, to see if there is a new version available" echo " - sudo pwnagotchi --check-update, to see if there is a new version available"

View File

@ -180,12 +180,6 @@
update_cache: yes update_cache: yes
install_recommends: false install_recommends: false
- name: update pip3, setuptools, wheel
shell: "python3 -m pip install --upgrade pip setuptools wheel --break-system-packages"
args:
executable: /bin/bash
chdir: /usr/local/src
# Now we set up /boot/firmware # Now we set up /boot/firmware
- name: Create pi user - name: Create pi user
copy: copy:
@ -497,11 +491,6 @@
block: | block: |
export GOPATH=$HOME/go export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
alias custom='cd /usr/local/share/pwnagotchi/custom-plugins/'
alias config='sudo nano /etc/pwnagotchi/config.toml'
alias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered "s/,[[:digit:]]\\{3\\}\\]//g" | cut -d " " -f 2-'
alias pwnver='python3 -c "import pwnagotchi as p; print(p.__version__)"'
alias pwnkill='sudo killall -USR1 pwnagotchi'
when: golang.changed when: golang.changed
- name: download pwngrid - name: download pwngrid
@ -590,7 +579,7 @@
# Add your configuration overrides on this file any configuration changes done to default.toml will be lost! # Add your configuration overrides on this file any configuration changes done to default.toml will be lost!
# Example: # Example:
# ui.display.enabled = true # ui.display.enabled = true
# ui.display.type = "waveshare_4" # ui.display.type = "waveshare_2"
when: not user_config.stat.exists when: not user_config.stat.exists
- name: Delete motd - name: Delete motd
@ -603,6 +592,24 @@
state: absent state: absent
path: /etc/update-motd.d/10-uname path: /etc/update-motd.d/10-uname
- name: Add pwnlog alias
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'"
insertafter: EOF
- name: Add pwnver alias
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'"
insertafter: EOF
- name: Add pwnkill alias to restart pwnagotchi with a signal
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnkill='sudo killall -USR1 pwnagotchi'"
insertafter: EOF
- name: add firmware packages to hold - name: add firmware packages to hold
dpkg_selections: dpkg_selections:
name: "{{ item }}" name: "{{ item }}"

View File

@ -1 +1 @@
__version__ = '2.8.6' __version__ = '2.8.5'

View File

@ -24,27 +24,30 @@ main.plugins.auto-update.interval = 1
main.plugins.bt-tether.enabled = false main.plugins.bt-tether.enabled = false
# Configuration for Android Phone
main.plugins.bt-tether.devices.android-phone.enabled = false main.plugins.bt-tether.devices.android-phone.enabled = false
main.plugins.bt-tether.devices.android-phone.search_order = 1 main.plugins.bt-tether.devices.android-phone.search_order = 1
main.plugins.bt-tether.devices.android-phone.mac = "" main.plugins.bt-tether.devices.android-phone.mac = "" # Bluetooth MAC address of the Android phone
main.plugins.bt-tether.devices.android-phone.ip = "192.168.44.44" main.plugins.bt-tether.devices.android-phone.ip = "192.168.44.44" # Static IP of the Pwnagotchi
main.plugins.bt-tether.devices.android-phone.netmask = 24 main.plugins.bt-tether.devices.android-phone.netmask = 24 # Netmask of the PAN
main.plugins.bt-tether.devices.android-phone.interval = 1 main.plugins.bt-tether.devices.android-phone.interval = 1 # Search interval in minutes
main.plugins.bt-tether.devices.android-phone.scantime = 10 main.plugins.bt-tether.devices.android-phone.scantime = 10 # Duration of each search in seconds
main.plugins.bt-tether.devices.android-phone.max_tries = 10 main.plugins.bt-tether.devices.android-phone.max_tries = 10 # Maximum attempts to find the phone
main.plugins.bt-tether.devices.android-phone.share_internet = true main.plugins.bt-tether.devices.android-phone.share_internet = false # Enable internet sharing via Bluetooth
main.plugins.bt-tether.devices.android-phone.priority = 1 main.plugins.bt-tether.devices.android-phone.priority = 1 # Priority level for tethering
# Configuration for iOS Phone
main.plugins.bt-tether.devices.ios-phone.enabled = false main.plugins.bt-tether.devices.ios-phone.enabled = false
main.plugins.bt-tether.devices.ios-phone.search_order = 2 main.plugins.bt-tether.devices.ios-phone.search_order = 1
main.plugins.bt-tether.devices.ios-phone.mac = "" main.plugins.bt-tether.devices.ios-phone.mac = "" # Bluetooth MAC address of the iOS phone
main.plugins.bt-tether.devices.ios-phone.ip = "172.20.10.6" main.plugins.bt-tether.devices.ios-phone.ip = "" # Static IP of the Pwnagotchi when tethered to iOS
main.plugins.bt-tether.devices.ios-phone.netmask = 24 main.plugins.bt-tether.devices.ios-phone.netmask = 24 # Netmask of the PAN
main.plugins.bt-tether.devices.ios-phone.interval = 5 main.plugins.bt-tether.devices.ios-phone.interval = 1 # Search interval in minutes
main.plugins.bt-tether.devices.ios-phone.scantime = 20 main.plugins.bt-tether.devices.ios-phone.scantime = 10 # Duration of each search in seconds
main.plugins.bt-tether.devices.ios-phone.max_tries = 0 main.plugins.bt-tether.devices.ios-phone.max_tries = 10 # Maximum attempts to find the phone
main.plugins.bt-tether.devices.ios-phone.share_internet = true main.plugins.bt-tether.devices.ios-phone.share_internet = false # Enable internet sharing via Bluetooth
main.plugins.bt-tether.devices.ios-phone.priority = 999 main.plugins.bt-tether.devices.ios-phone.priority = 1 # Priority level for tethering (edited)
main.plugins.fix_services.enabled = true main.plugins.fix_services.enabled = true
@ -154,8 +157,6 @@ personality.throttle_d = 0.9
personality.clear_on_exit = true # clear display when shutting down cleanly personality.clear_on_exit = true # clear display when shutting down cleanly
ui.invert = false # false = black background, true = white background
ui.fps = 0.0 ui.fps = 0.0
ui.font.name = "DejaVuSansMono" # for japanese: fonts-japanese-gothic ui.font.name = "DejaVuSansMono" # for japanese: fonts-japanese-gothic
ui.font.size_offset = 0 # will be added to the font size ui.font.size_offset = 0 # will be added to the font size

View File

@ -199,9 +199,6 @@ def list_plugins(args, config, pattern='*'):
available_not_installed = set(available.keys()) - set(installed.keys()) available_not_installed = set(available.keys()) - set(installed.keys())
max_len_list = available_and_installed if args.installed else available_not_installed max_len_list = available_and_installed if args.installed else available_not_installed
if not max_len_list:
print('Maybe try: sudo pwnagotchi plugins update')
return 1
max_len = max(map(len, max_len_list)) max_len = max(map(len, max_len_list))
header = line.format(name='Plugin', width=max_len, version='Version', enabled='Active', status='Status') header = line.format(name='Plugin', width=max_len, version='Version', enabled='Active', status='Status')
line_length = max(max_len, len('Plugin')) + len(header) - len('Plugin') - 12 # lol line_length = max(max_len, len('Plugin')) + len(header) - len('Plugin') - 12 # lol
@ -242,7 +239,7 @@ def list_plugins(args, config, pattern='*'):
print('-' * line_length) print('-' * line_length)
if not found: if not found:
print('Maybe try: sudo pwnagotchi plugins update') logging.info('Maybe try: pwnagotchi plugins update')
return 1 return 1
return 0 return 0

View File

@ -29,7 +29,6 @@ def check(version, repo, native=True):
latest = resp.json() latest = resp.json()
info['available'] = latest_ver = latest['tag_name'].replace('v', '') info['available'] = latest_ver = latest['tag_name'].replace('v', '')
is_armhf = info['arch'].startswith('arm') is_armhf = info['arch'].startswith('arm')
is_aarch = info['arch'].startswith('aarch')
local = version_to_tuple(info['current']) local = version_to_tuple(info['current'])
remote = version_to_tuple(latest_ver) remote = version_to_tuple(latest_ver)
@ -45,14 +44,6 @@ def check(version, repo, native=True):
(info['arch'] in download_url or (is_armhf and 'armhf' in download_url))): (info['arch'] in download_url or (is_armhf and 'armhf' in download_url))):
info['url'] = download_url info['url'] = download_url
break break
elif is_aarch:
# check if this release is compatible with arm64/aarch64
for asset in latest['assets']:
download_url = asset['browser_download_url']
if (download_url.endswith('.zip') and
(info['arch'] in download_url or (is_aarch and 'aarch' in download_url))):
info['url'] = download_url
break
return info return info

View File

@ -35,11 +35,14 @@ 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
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):
@ -47,27 +50,31 @@ class FixServices(plugins.Plugin):
stdout=subprocess.PIPE).stdout))[-10:]) stdout=subprocess.PIPE).stdout))[-10:])
try: try:
cmd_output = subprocess.check_output("ip link show wlan0mon", shell=True) cmd_output = subprocess.check_output("ip link show wlan0mon", shell=True)
logging.debug("[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.debug("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.')
display.update(force=True) display.update(force=True)
logging.debug('[Fix_Services] Blind-Bug detected. Restarting.') logging.info('[Fix_Services] Blind-Bug detected. Restarting.')
try: try:
self._tryTurningItOffAndOnAgain(agent) self._tryTurningItOffAndOnAgain(agent)
except Exception as err: except Exception as err:
logging.warning("[Fix_Services turnOffAndOn] %s" % repr(err)) logging.warning("[Fix_Services turnOffAndOn] %s" % repr(err))
else: else:
logging.debug("[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))
@ -77,12 +84,12 @@ class FixServices(plugins.Plugin):
# apparently this only gets messages from bettercap going to syslog, not from syslog # apparently this only gets messages from bettercap going to syslog, not from syslog
def on_bcap_sys_log(self, agent, event): def on_bcap_sys_log(self, agent, event):
if re.search('wifi error while hopping to channel', event['data']['Message']): if re.search('wifi error while hopping to channel', event['data']['Message']):
logging.debug("[Fix_Services]SYSLOG MATCH: %s" % event['data']['Message']) logging.info("[Fix_Services]SYSLOG MATCH: %s" % event['data']['Message'])
logging.debug("[Fix_Services]**** restarting wifi.recon") logging.info("[Fix_Services]**** restarting wifi.recon")
try: try:
result = agent.run("wifi.recon off; wifi.recon on") result = agent.run("wifi.recon off; wifi.recon on")
if result["success"]: if result["success"]:
logging.debug("[Fix_Services] wifi.recon flip: success!") logging.info("[Fix_Services] wifi.recon flip: success!")
if hasattr(agent, 'view'): if hasattr(agent, 'view'):
display = agent.view() display = agent.view()
if display: if display:
@ -114,12 +121,12 @@ class FixServices(plugins.Plugin):
# Look for pattern 1 # Look for pattern 1
if len(self.pattern.findall(last_lines)) >= 3: if len(self.pattern.findall(last_lines)) >= 3:
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines) logging.info("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
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.')
display.update(force=True) display.update(force=True)
logging.debug('[Fix_Services] Blind-Bug detected. Restarting.') logging.info('[Fix_Services] Blind-Bug detected. Restarting.')
try: try:
self._tryTurningItOffAndOnAgain(agent) self._tryTurningItOffAndOnAgain(agent)
except Exception as err: except Exception as err:
@ -127,19 +134,20 @@ class FixServices(plugins.Plugin):
# Look for pattern 2 # Look for pattern 2
elif len(self.pattern2.findall(other_last_lines)) >= 5: elif len(self.pattern2.findall(other_last_lines)) >= 5:
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines) logging.info("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
if hasattr(agent, 'view'): if hasattr(agent, 'view'):
display = agent.view() display = agent.view()
display.set('status', 'Wifi channel stuck. Restarting recon.') display.set('status', 'Wifi channel stuck. Restarting recon.')
display.update(force=True) display.update(force=True)
logging.debug('[Fix_Services] Wifi channel stuck. Restarting recon.') logging.info('[Fix_Services] Wifi channel stuck. Restarting recon.')
try: try:
result = agent.run("wifi.recon off; wifi.recon on") result = agent.run("wifi.recon off; wifi.recon on")
if result["success"]: if result["success"]:
logging.debug("[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!")
@ -151,7 +159,7 @@ class FixServices(plugins.Plugin):
# Look for pattern 3 # Look for pattern 3
elif len(self.pattern3.findall(other_last_lines)) >= 1: elif len(self.pattern3.findall(other_last_lines)) >= 1:
logging.debug("[Fix_Services] Firmware has halted or crashed. Restarting wlan0mon.") logging.info("[Fix_Services] Firmware has halted or crashed. Restarting wlan0mon.")
if hasattr(agent, 'view'): if hasattr(agent, 'view'):
display = agent.view() display = agent.view()
display.set('status', 'Firmware has halted or crashed. Restarting wlan0mon.') display.set('status', 'Firmware has halted or crashed. Restarting wlan0mon.')
@ -159,13 +167,13 @@ class FixServices(plugins.Plugin):
try: try:
# Run the monstart command to restart wlan0mon # Run the monstart command to restart wlan0mon
cmd_output = subprocess.check_output("monstart", shell=True) cmd_output = subprocess.check_output("monstart", shell=True)
logging.debug("[Fix_Services monstart]: %s" % repr(cmd_output)) logging.info("[Fix_Services monstart]: %s" % repr(cmd_output))
except Exception as err: except Exception as err:
logging.error("[Fix_Services monstart]: %s" % repr(err)) logging.error("[Fix_Services monstart]: %s" % repr(err))
# Look for pattern 4 # Look for pattern 4
elif len(self.pattern4.findall(other_other_last_lines)) >= 3: elif len(self.pattern4.findall(other_other_last_lines)) >= 3:
logging.debug("[Fix_Services] wlan0 is down!") logging.info("[Fix_Services] wlan0 is down!")
if hasattr(agent, 'view'): if hasattr(agent, 'view'):
display = agent.view() display = agent.view()
display.set('status', 'Restarting wlan0 now!') display.set('status', 'Restarting wlan0 now!')
@ -173,7 +181,7 @@ class FixServices(plugins.Plugin):
try: try:
# Run the monstart command to restart wlan0mon # Run the monstart command to restart wlan0mon
cmd_output = subprocess.check_output("monstart", shell=True) cmd_output = subprocess.check_output("monstart", shell=True)
logging.debug("[Fix_Services monstart]: %s" % repr(cmd_output)) logging.info("[Fix_Services monstart]: %s" % repr(cmd_output))
except Exception as err: except Exception as err:
logging.error("[Fix_Services monstart]: %s" % repr(err)) logging.error("[Fix_Services monstart]: %s" % repr(err))
@ -189,7 +197,7 @@ class FixServices(plugins.Plugin):
elif level == "debug": elif level == "debug":
logging.debug(message) logging.debug(message)
else: else:
logging.debug(message) logging.info(message)
if ui: if ui:
ui.update(force=force, new_data=displayData) ui.update(force=force, new_data=displayData)
@ -204,16 +212,17 @@ class FixServices(plugins.Plugin):
# avoid overlapping restarts, but allow it if it's been a while # avoid overlapping restarts, but allow it if it's been a while
# (in case the last attempt failed before resetting "isReloadingMon") # (in case the last attempt failed before resetting "isReloadingMon")
if self.isReloadingMon and (time.time() - self.LASTTRY) < 180: if self.isReloadingMon and (time.time() - self.LASTTRY) < 180:
logging.debug("[Fix_Services] Duplicate attempt ignored") logging.info("[Fix_Services] Duplicate attempt ignored")
else: else:
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",
"face": faces.BORED}) "brcmfmac_status": self._status, "face": faces.BORED})
else: else:
display = None display = None
@ -229,9 +238,9 @@ class FixServices(plugins.Plugin):
# is it up? # is it up?
try: try:
cmd_output = subprocess.check_output("ip link show wlan0mon", shell=True) cmd_output = subprocess.check_output("ip link show wlan0mon", shell=True)
logging.debug("[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.debug("wlan0mon is up. Skip reset?") logging.info("wlan0mon is up. Skip reset?")
# not reliable, so don't skip just yet # not reliable, so don't skip just yet
# print("wlan0mon is up. Skipping reset.") # print("wlan0mon is up. Skipping reset.")
# self.isReloadingMon = False # self.isReloadingMon = False
@ -252,10 +261,11 @@ class FixServices(plugins.Plugin):
except Exception as err: except Exception as err:
logging.error("[Fix_Services wifi.recon off] error %s" % (repr(err))) logging.error("[Fix_Services wifi.recon off] error %s" % (repr(err)))
logging.debug("[Fix_Services] recon paused. Now trying wlan0mon reload") logging.info("[Fix_Services] recon paused. Now trying wlan0mon reload")
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:
@ -275,6 +285,7 @@ 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"
# reload the module # reload the module
try: try:
@ -282,24 +293,28 @@ 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"
# success! now make the mon0 # success! now make the mon0
try: try:
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"
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.debug("[Fix_Services set wifi.interface wlan0mon worked!") logging.info("[Fix_Services set wifi.interface wlan0mon worked!")
self._status = ""
self._count = self._count + 1
# stop looping and get back to recon # stop looping and get back to recon
break break
else: else:
logging.debug( logging.info(
"[Fix_Services set wifi.interfaceface wlan0mon] failed? %s" % repr(result)) "[Fix_Services set wifi.interfaceface wlan0mon] failed? %s" % repr(result))
except Exception as err: except Exception as err:
logging.debug( logging.info(
"[Fix_Services set wifi.interface wlan0mon] except: %s" % repr(err)) "[Fix_Services set wifi.interface wlan0mon] except: %s" % repr(err))
except Exception as cerr: # except Exception as cerr: #
if not display: if not display:
@ -318,38 +333,41 @@ class FixServices(plugins.Plugin):
tries = tries + 1 tries = tries + 1
if tries < 3: if tries < 3:
logging.debug("[Fix_Services] wlan0mon didn't make it. trying again") logging.info("[Fix_Services] wlan0mon didn't make it. trying again")
if not display: if not display:
print(" wlan0mon didn't make it. trying again") print(" wlan0mon didn't make it. trying again")
else: else:
logging.debug("[Fix_Services] wlan0mon loading failed, no choice but to reboot ..") logging.info("[Fix_Services] wlan0mon loading failed, no choice but to reboot ..")
pwnagotchi.reboot() pwnagotchi.reboot()
# exited the loop, so hopefully it loaded # exited the loop, so hopefully it loaded
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...")
logging.debug("[Fix_Services] wlan0mon back up") logging.info("[Fix_Services] wlan0mon back up")
else: else:
self.LASTTRY = time.time() self.LASTTRY = time.time()
time.sleep(8 + tries * 2) # give it a bit before restarting recon in bettercap time.sleep(8 + tries * 2) # give it a bit before restarting recon in bettercap
self.isReloadingMon = False self.isReloadingMon = False
logging.debug("[Fix_Services] re-enable recon") logging.info("[Fix_Services] re-enable recon")
try: try:
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")
logging.debug("[Fix_Services] wifi.recon on") logging.info("[Fix_Services] wifi.recon on")
self.LASTTRY = time.time() + 120 # 2-minute pause until next time. self.LASTTRY = time.time() + 120 # 2-minute pause until next time.
else: else:
logging.error("[Fix_Services] wifi.recon did not start up") logging.error("[Fix_Services] wifi.recon did not start up")
@ -370,14 +388,25 @@ class FixServices(plugins.Plugin):
else: else:
pos = (ui.width() / 2 + 35, ui.height() - 11) pos = (ui.width() / 2 + 35, ui.height() - 11)
logging.debug("Got here") logging.info("Got here")
ui.add_element('brcmfmac_status', Text(color=BLACK, value='--', position=pos, font=fonts.Small))
# called when the ui is updated # called when the ui is updated
def on_ui_update(self, ui): def on_ui_update(self, ui):
return # 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):
return with ui._lock:
try:
ui.remove_element('brcmfmac_status')
logging.info("[Fix_Services] unloaded")
except Exception as err:
logging.info("[Fix_Services] unload err %s " % repr(err))
pass
# run from command line to brute force a reload # run from command line to brute force a reload

View File

@ -34,7 +34,9 @@ class Waveshare154(DisplayImpl):
logging.info("initializing waveshare v1in54 display") logging.info("initializing waveshare v1in54 display")
from pwnagotchi.ui.hw.libs.waveshare.v1in54.epd1in54 import EPD from pwnagotchi.ui.hw.libs.waveshare.v1in54.epd1in54 import EPD
self._display = EPD() self._display = EPD()
self._display.init(self._display.lut_partial_update) self._display.init(0)
self._display.Clear()
self._display.init(1)
self._display.Clear() self._display.Clear()
def render(self, canvas): def render(self, canvas):

View File

@ -9,38 +9,81 @@ class WaveshareV1(DisplayImpl):
super(WaveshareV1, self).__init__(config, 'waveshare_1') super(WaveshareV1, self).__init__(config, 'waveshare_1')
def layout(self): def layout(self):
fonts.setup(10, 8, 10, 35, 25, 9) if self.config['color'] == 'black':
self._layout['width'] = 250 fonts.setup(10, 9, 10, 35, 25, 9)
self._layout['height'] = 122 self._layout['width'] = 250
self._layout['face'] = (0, 40) self._layout['height'] = 122
self._layout['name'] = (5, 20) self._layout['face'] = (0, 40)
self._layout['channel'] = (0, 0) self._layout['name'] = (5, 20)
self._layout['aps'] = (28, 0) self._layout['channel'] = (0, 0)
self._layout['uptime'] = (185, 0) self._layout['aps'] = (28, 0)
self._layout['line1'] = [0, 14, 250, 14] self._layout['uptime'] = (185, 0)
self._layout['line2'] = [0, 108, 250, 108] self._layout['line1'] = [0, 14, 250, 14]
self._layout['friend_face'] = (0, 92) self._layout['line2'] = [0, 108, 250, 108]
self._layout['friend_name'] = (40, 94) self._layout['friend_face'] = (0, 92)
self._layout['shakes'] = (0, 109) self._layout['friend_name'] = (40, 94)
self._layout['mode'] = (225, 109) self._layout['shakes'] = (0, 109)
self._layout['status'] = { self._layout['mode'] = (225, 109)
'pos': (125, 20), self._layout['status'] = {
'font': fonts.status_font(fonts.Medium), 'pos': (125, 20),
'max': 20 'font': fonts.status_font(fonts.Medium),
} 'max': 20
}
else:
fonts.setup(10, 8, 10, 25, 25, 9)
self._layout['width'] = 212
self._layout['height'] = 104
self._layout['face'] = (0, 26)
self._layout['name'] = (5, 15)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['uptime'] = (147, 0)
self._layout['line1'] = [0, 12, 212, 12]
self._layout['line2'] = [0, 92, 212, 92]
self._layout['friend_face'] = (0, 76)
self._layout['friend_name'] = (40, 78)
self._layout['shakes'] = (0, 93)
self._layout['mode'] = (187, 93)
self._layout['status'] = {
'pos': (91, 15),
'font': fonts.status_font(fonts.Medium),
'max': 20
}
return self._layout return self._layout
def initialize(self): def initialize(self):
logging.info("initializing waveshare v2in13_V1 display in monochromatic mode") if self.config['color'] == 'black':
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13 import EPD logging.info("initializing waveshare v2in13_V1 display in monochromatic mode")
self._display = EPD() from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13 import EPD
self._display.init(self._display.lut_full_update) self._display = EPD()
self._display.Clear(0xFF) self._display.init(self._display.lut_full_update)
self._display.init(self._display.lut_partial_update) self._display.Clear(0xFF)
self._display.init(self._display.lut_partial_update)
elif self.config['color'] == 'fastAndFurious':
logging.info("initializing waveshare v2in13_V1 3-color display in FAST MODE")
logging.info("THIS MAY BE POTENTIALLY DANGEROUS. NO WARRANTY IS PROVIDED")
logging.info("USE THIS DISPLAY IN THIS MODE AT YOUR OWN RISK")
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13bcFAST import EPD
self._display = EPD()
self._display.init()
self._display.Clear()
else:
logging.info("initializing waveshare v2in13_V1 display 3-color mode")
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13bc import EPD
self._display = EPD()
self._display.init()
self._display.Clear()
def render(self, canvas): def render(self, canvas):
buf = self._display.getbuffer(canvas) if self.config['color'] == 'black':
self._display.display(buf) buf = self._display.getbuffer(canvas)
self._display.display(buf)
elif self.config['color'] == 'fastAndFurious':
buf_black = self._display.getbuffer(canvas)
self._display.DisplayPartial(buf_black)
else:
buf_black = self._display.getbuffer(canvas)
self._display.displayBlack(buf_black)
def clear(self): def clear(self):
self._display.Clear(0xff) self._display.Clear(0xff)

View File

@ -9,25 +9,47 @@ class WaveshareV2(DisplayImpl):
super(WaveshareV2, self).__init__(config, 'waveshare_2') super(WaveshareV2, self).__init__(config, 'waveshare_2')
def layout(self): def layout(self):
fonts.setup(10, 8, 10, 35, 25, 9) if self.config['color'] == 'black':
self._layout['width'] = 250 fonts.setup(10, 9, 10, 35, 25, 9)
self._layout['height'] = 122 self._layout['width'] = 250
self._layout['face'] = (0, 40) self._layout['height'] = 122
self._layout['name'] = (5, 20) self._layout['face'] = (0, 40)
self._layout['channel'] = (0, 0) self._layout['name'] = (5, 20)
self._layout['aps'] = (28, 0) self._layout['channel'] = (0, 0)
self._layout['uptime'] = (185, 0) self._layout['aps'] = (28, 0)
self._layout['line1'] = [0, 14, 250, 14] self._layout['uptime'] = (185, 0)
self._layout['line2'] = [0, 108, 250, 108] self._layout['line1'] = [0, 14, 250, 14]
self._layout['friend_face'] = (0, 92) self._layout['line2'] = [0, 108, 250, 108]
self._layout['friend_name'] = (40, 94) self._layout['friend_face'] = (0, 92)
self._layout['shakes'] = (0, 109) self._layout['friend_name'] = (40, 94)
self._layout['mode'] = (225, 109) self._layout['shakes'] = (0, 109)
self._layout['status'] = { self._layout['mode'] = (225, 109)
'pos': (125, 20), self._layout['status'] = {
'font': fonts.status_font(fonts.Medium), 'pos': (125, 20),
'max': 20 'font': fonts.status_font(fonts.Medium),
} 'max': 20
}
else:
fonts.setup(10, 8, 10, 25, 25, 9)
self._layout['width'] = 212
self._layout['height'] = 104
self._layout['face'] = (0, 26)
self._layout['name'] = (5, 15)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['status'] = (91, 15)
self._layout['uptime'] = (147, 0)
self._layout['line1'] = [0, 12, 212, 12]
self._layout['line2'] = [0, 92, 212, 92]
self._layout['friend_face'] = (0, 76)
self._layout['friend_name'] = (40, 78)
self._layout['shakes'] = (0, 93)
self._layout['mode'] = (187, 93)
self._layout['status'] = {
'pos': (125, 20),
'font': fonts.status_font(fonts.Medium),
'max': 14
}
return self._layout return self._layout
def initialize(self): def initialize(self):

View File

@ -10,25 +10,47 @@ class Waveshare2in13bV3(DisplayImpl):
super(Waveshare2in13bV3, self).__init__(config, 'waveshare2in13b_v3') super(Waveshare2in13bV3, self).__init__(config, 'waveshare2in13b_v3')
def layout(self): def layout(self):
fonts.setup(10, 9, 10, 35, 25, 9) if self.config['color'] == 'black':
self._layout['width'] = 250 fonts.setup(10, 9, 10, 35, 25, 9)
self._layout['height'] = 122 self._layout['width'] = 250
self._layout['face'] = (0, 40) self._layout['height'] = 122
self._layout['name'] = (5, 20) self._layout['face'] = (0, 40)
self._layout['channel'] = (0, 0) self._layout['name'] = (5, 20)
self._layout['aps'] = (28, 0) self._layout['channel'] = (0, 0)
self._layout['uptime'] = (185, 0) self._layout['aps'] = (28, 0)
self._layout['line1'] = [0, 14, 250, 14] self._layout['uptime'] = (185, 0)
self._layout['line2'] = [0, 108, 250, 108] self._layout['line1'] = [0, 14, 250, 14]
self._layout['friend_face'] = (0, 92) self._layout['line2'] = [0, 108, 250, 108]
self._layout['friend_name'] = (40, 94) self._layout['friend_face'] = (0, 92)
self._layout['shakes'] = (0, 109) self._layout['friend_name'] = (40, 94)
self._layout['mode'] = (225, 109) self._layout['shakes'] = (0, 109)
self._layout['status'] = { self._layout['mode'] = (225, 109)
'pos': (125, 20), self._layout['status'] = {
'font': fonts.status_font(fonts.Medium), 'pos': (125, 20),
'max': 20 'font': fonts.status_font(fonts.Medium),
} 'max': 20
}
else:
fonts.setup(10, 8, 10, 25, 25, 9)
self._layout['width'] = 212
self._layout['height'] = 104
self._layout['face'] = (0, 26)
self._layout['name'] = (5, 15)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['status'] = (91, 15)
self._layout['uptime'] = (147, 0)
self._layout['line1'] = [0, 12, 212, 12]
self._layout['line2'] = [0, 92, 212, 92]
self._layout['friend_face'] = (0, 76)
self._layout['friend_name'] = (40, 78)
self._layout['shakes'] = (0, 93)
self._layout['mode'] = (187, 93)
self._layout['status'] = {
'pos': (125, 20),
'font': fonts.status_font(fonts.Medium),
'max': 14
}
return self._layout return self._layout
def initialize(self): def initialize(self):

View File

@ -10,25 +10,47 @@ class Waveshare213bV4(DisplayImpl):
super(Waveshare213bV4, self).__init__(config, 'waveshare2in13b_v4') super(Waveshare213bV4, self).__init__(config, 'waveshare2in13b_v4')
def layout(self): def layout(self):
fonts.setup(10, 9, 10, 35, 25, 9) if self.config['color'] == 'black':
self._layout['width'] = 250 fonts.setup(10, 9, 10, 35, 25, 9)
self._layout['height'] = 122 self._layout['width'] = 250
self._layout['face'] = (0, 40) self._layout['height'] = 122
self._layout['name'] = (5, 20) self._layout['face'] = (0, 40)
self._layout['channel'] = (0, 0) self._layout['name'] = (5, 20)
self._layout['aps'] = (28, 0) self._layout['channel'] = (0, 0)
self._layout['uptime'] = (185, 0) self._layout['aps'] = (28, 0)
self._layout['line1'] = [0, 14, 250, 14] self._layout['uptime'] = (185, 0)
self._layout['line2'] = [0, 108, 250, 108] self._layout['line1'] = [0, 14, 250, 14]
self._layout['friend_face'] = (0, 92) self._layout['line2'] = [0, 108, 250, 108]
self._layout['friend_name'] = (40, 94) self._layout['friend_face'] = (0, 92)
self._layout['shakes'] = (0, 109) self._layout['friend_name'] = (40, 94)
self._layout['mode'] = (225, 109) self._layout['shakes'] = (0, 109)
self._layout['status'] = { self._layout['mode'] = (225, 109)
'pos': (125, 20), self._layout['status'] = {
'font': fonts.status_font(fonts.Medium), 'pos': (125, 20),
'max': 20 'font': fonts.status_font(fonts.Medium),
} 'max': 20
}
else:
fonts.setup(10, 8, 10, 25, 25, 9)
self._layout['width'] = 212
self._layout['height'] = 104
self._layout['face'] = (0, 26)
self._layout['name'] = (5, 15)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['status'] = (91, 15)
self._layout['uptime'] = (147, 0)
self._layout['line1'] = [0, 12, 212, 12]
self._layout['line2'] = [0, 92, 212, 92]
self._layout['friend_face'] = (0, 76)
self._layout['friend_name'] = (40, 78)
self._layout['shakes'] = (0, 93)
self._layout['mode'] = (187, 93)
self._layout['status'] = {
'pos': (125, 20),
'font': fonts.status_font(fonts.Medium),
'max': 14
}
return self._layout return self._layout
def initialize(self): def initialize(self):

View File

@ -35,11 +35,13 @@ class Waveshare27inchV2(DisplayImpl):
from pwnagotchi.ui.hw.libs.waveshare.v2in7_v2.epd2in7_V2 import EPD from pwnagotchi.ui.hw.libs.waveshare.v2in7_v2.epd2in7_V2 import EPD
self._display = EPD() self._display = EPD()
self._display.init() self._display.init()
# this must have changed by waveshare
# remove the 0xFF(Clear(0xFF)) other wise it errors. can't pass oxff and self
self._display.Clear() self._display.Clear()
def render(self, canvas): def render(self, canvas):
buf = self._display.getbuffer(canvas) buf = self._display.getbuffer(canvas)
self._display.display_Fast(buf) self._display.display_Partial(buf, 0, 0, 176, 264)
def clear(self): def clear(self):
# This line also removes the 0xFF # This line also removes the 0xFF

View File

@ -23,21 +23,7 @@ ROOT = None
class View(object): class View(object):
def __init__(self, config, impl, state=None): def __init__(self, config, impl, state=None):
global ROOT, BLACK, WHITE global ROOT
self.invert = 0
self._black = 0xFF
self._white = 0x00
if 'invert' in config['ui'] and config['ui']['invert'] == True:
logging.debug("INVERT BLACK/WHITES:" + str(config['ui']['invert']))
self.invert = 1
BLACK = 0x00
WHITE - 0xFF
self._black = 0x00
self._white = 0xFF
# setup faces from the configuration in case the user customized them # setup faces from the configuration in case the user customized them
faces.load_from_config(config['ui']['faces']) faces.load_from_config(config['ui']['faces'])
@ -112,11 +98,6 @@ class View(object):
self._state.has_element(key) self._state.has_element(key)
def add_element(self, key, elem): def add_element(self, key, elem):
if self.invert is 1 and elem.color:
if elem.color == 0xff:
elem.color = 0x00
elif elem.color == 0x00:
elem.color = 0xff
self._state.add_element(key, elem) self._state.add_element(key, elem)
def remove_element(self, key): def remove_element(self, key):
@ -390,7 +371,7 @@ class View(object):
state = self._state state = self._state
changes = state.changes(ignore=self._ignore_changes) changes = state.changes(ignore=self._ignore_changes)
if force or len(changes): if force or len(changes):
self._canvas = Image.new('1', (self._width, self._height), self._white) self._canvas = Image.new('1', (self._width, self._height), WHITE)
drawer = ImageDraw.Draw(self._canvas) drawer = ImageDraw.Draw(self._canvas)
plugins.on('ui_update', self) plugins.on('ui_update', self)

View File

@ -238,60 +238,14 @@ def load_config(args):
config = merge_config(additional_config, config) config = merge_config(additional_config, config)
# 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
# NON E-INK DISPLAYS---------------------------------------------------------------
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'
elif config['ui']['display']['type'] in 'oledhat': elif config['ui']['display']['type'] in 'oledhat':
config['ui']['display']['type'] = 'oledhat' config['ui']['display']['type'] = 'oledhat'
elif config['ui']['display']['type'] in 'lcdhat':
config['ui']['display']['type'] = 'lcdhat'
elif config['ui']['display']['type'] in ('dfrobot_1', 'df1'):
config['ui']['display']['type'] = 'dfrobot_1'
elif config['ui']['display']['type'] in ('dfrobot_2', 'df2'):
config['ui']['display']['type'] = 'dfrobot_2'
elif config['ui']['display']['type'] in ('waveshare144lcd', 'ws_144', 'ws144', 'waveshare_144', 'waveshare144'):
config['ui']['display']['type'] = 'waveshare144lcd'
elif config['ui']['display']['type'] in ('spotpear24inch'):
config['ui']['display']['type'] = 'spotpear24inch'
elif config['ui']['display']['type'] in ('displayhatmini'):
config['ui']['display']['type'] = 'displayhatmini'
elif config['ui']['display']['type'] in ('waveshare35lcd'):
config['ui']['display']['type'] = 'waveshare35lcd'
# E-INK DISPLAYS ------------------------------------------------------------------------
elif config['ui']['display']['type'] in ('waveshare1in02', 'ws1in02', 'ws102', 'waveshare_102', 'waveshare_1in02'):
config['ui']['display']['type'] = 'waveshare1in02'
elif config['ui']['display']['type'] in ('ws_154inch', 'waveshare1in54', 'ws154inch', 'waveshare_154', 'waveshare154'):
config['ui']['display']['type'] = 'waveshare1in54'
elif config['ui']['display']['type'] in ('ws_154inchb', 'waveshare1in54b', 'ws154inchb', 'waveshare_154b', 'waveshare154b'):
config['ui']['display']['type'] = 'waveshare1in54b'
elif config['ui']['display']['type'] in ('waveshare1in54c', 'ws1in54c', 'ws154c', 'waveshare_154c', 'waveshare_1in54c'):
config['ui']['display']['type'] = 'waveshare1in54c'
elif config['ui']['display']['type'] in ('ws_154inchbv2', 'waveshare1in54bv2', 'waveshare1in54b_v2', 'ws154inchbv2', 'waveshare_154bv2', 'waveshare154bv2'):
config['ui']['display']['type'] = 'waveshare1in54b_v2'
elif config['ui']['display']['type'] in ('ws_154inchv2', 'waveshare1in54v2', 'ws154inchv2', 'waveshare_154inchv2', 'waveshare154v2', "waveshare1in54_v2"):
config['ui']['display']['type'] = 'waveshare1in54_v2'
elif config['ui']['display']['type'] in ('waveshare1in64g', 'ws1in64g', 'ws164g', 'waveshare_164g', 'waveshare_1in64g'):
config['ui']['display']['type'] = 'waveshare1in64g'
elif config['ui']['display']['type'] in ('ws_1', 'ws1', 'waveshare_1', 'waveshare1'): elif config['ui']['display']['type'] in ('ws_1', 'ws1', 'waveshare_1', 'waveshare1'):
config['ui']['display']['type'] = 'waveshare_1' config['ui']['display']['type'] = 'waveshare_1'
@ -304,14 +258,50 @@ 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 ('waveshare2in13b_v3', 'waveshare2in13b_v3', 'ws213bv3', 'waveshare_213bv3', 'waveshare213inb_v3'): elif config['ui']['display']['type'] in ('ws_27inch', 'ws27inch', 'waveshare2in7', 'waveshare_27inch', 'waveshare27inch'):
config['ui']['display']['type'] = 'waveshare2in13b_v3' config['ui']['display']['type'] = 'waveshare2in7'
elif config['ui']['display']['type'] in ('ws_213bv4', 'waveshare2in13b_v4', 'ws213bv4', 'waveshare_213bv4', 'waveshare213inb_v4'): elif config['ui']['display']['type'] in ('ws_27inchv2', 'waveshare2in7_v2', 'ws27inchv2', 'waveshare_27inchv2', 'waveshare27inchv2'):
config['ui']['display']['type'] = 'waveshare2in13b_v4' config['ui']['display']['type'] = 'waveshare2in7_v2'
elif config['ui']['display']['type'] in ('ws_213bc', 'ws213bc', 'waveshare2in13bc', 'waveshare_213bc', 'waveshare213bc'): elif config['ui']['display']['type'] in ('ws_27inchbv2', 'waveshare2in7b_v2', 'ws27inchbv2', 'waveshare_27inchbv2', 'waveshare27inchbv2'):
config['ui']['display']['type'] = 'waveshare2in13bc' 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':
config['ui']['display']['type'] = 'lcdhat'
elif config['ui']['display']['type'] in ('dfrobot_1', 'df1'):
config['ui']['display']['type'] = 'dfrobot_1'
elif config['ui']['display']['type'] in ('dfrobot_2', 'df2'):
config['ui']['display']['type'] = 'dfrobot_2'
elif config['ui']['display']['type'] in ('ws_154inch', 'waveshare1in54', 'ws154inch', 'waveshare_154inch', 'waveshare154inch'):
config['ui']['display']['type'] = 'waveshare1in54'
elif config['ui']['display']['type'] in ('ws_154inchb', 'waveshare1in54b', 'ws154inchb', 'waveshare_154inchb', 'waveshare154inchb'):
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', "waveshare1in54_v2"):
config['ui']['display']['type'] = 'waveshare1in54_v2'
elif config['ui']['display']['type'] in ('waveshare144lcd', 'ws_144inch', 'ws144inch', 'waveshare_144inch', 'waveshare144inch'):
config['ui']['display']['type'] = 'waveshare144lcd'
elif config['ui']['display']['type'] in ('ws_213d', 'ws213d', 'waveshare2in13d', 'waveshare_213d', 'waveshare213d'): elif config['ui']['display']['type'] in ('ws_213d', 'ws213d', 'waveshare2in13d', 'waveshare_213d', 'waveshare213d'):
config['ui']['display']['type'] = 'waveshare2in13d' config['ui']['display']['type'] = 'waveshare2in13d'
@ -319,115 +309,121 @@ def load_config(args):
elif config['ui']['display']['type'] in ('ws_213g', 'waveshare2in13g', 'waveshare213g', 'ws213g', 'waveshare_213g'): elif config['ui']['display']['type'] in ('ws_213g', 'waveshare2in13g', 'waveshare213g', 'ws213g', 'waveshare_213g'):
config['ui']['display']['type'] = 'waveshare2in13g' config['ui']['display']['type'] = 'waveshare2in13g'
elif config['ui']['display']['type'] in ('ws_2in36g', 'waveshare2in36g', 'waveshare236g', 'ws236g', 'waveshare_236g'): elif config['ui']['display']['type'] in ('ws_213bc', 'ws213bc', 'waveshare2in13bc', 'waveshare_213bc', 'waveshare213bc'):
config['ui']['display']['type'] = 'waveshare2in36g' config['ui']['display']['type'] = 'waveshare2in13bc'
elif config['ui']['display']['type'] in ('ws_2in66', 'waveshare2in66', 'waveshare266', 'ws266', 'waveshare_266'): elif config['ui']['display']['type'] in ('ws_213bv4', 'waveshare2in13b_v4', 'ws213bv4', 'waveshare_213bv4', 'waveshare213inb_v4'):
config['ui']['display']['type'] = 'waveshare2in66' config['ui']['display']['type'] = 'waveshare2in13b_v4'
elif config['ui']['display']['type'] in ('ws_2in66b', 'waveshare2in66b', 'waveshare266b', 'ws266b', 'waveshare_266b'): elif config['ui']['display']['type'] in 'spotpear24inch':
config['ui']['display']['type'] = 'waveshare2in66b' config['ui']['display']['type'] = 'spotpear24inch'
elif config['ui']['display']['type'] in ('ws_2in66g', 'waveshare2in66g', 'waveshare266g', 'ws266g', 'waveshare_266g'): elif config['ui']['display']['type'] in 'displayhatmini':
config['ui']['display']['type'] = 'waveshare2in66g' config['ui']['display']['type'] = 'displayhatmini'
elif config['ui']['display']['type'] in ('ws_27inch', 'ws27inch', 'waveshare2in7', 'waveshare_27inch', 'waveshare27'): elif config['ui']['display']['type'] in 'waveshare35lcd':
config['ui']['display']['type'] = 'waveshare2in7' config['ui']['display']['type'] = 'waveshare35lcd'
elif config['ui']['display']['type'] in ('ws_2in7v2', 'waveshare2in7_v2', 'waveshare2in7v2', 'ws27inchv2', 'waveshare_27v2', 'waveshare27v2'): elif config['ui']['display']['type'] in 'waveshare1in54c':
config['ui']['display']['type'] = 'waveshare2in7_v2' config['ui']['display']['type'] = 'waveshare1in54c'
elif config['ui']['display']['type'] in ('ws_2in7bv2', 'waveshare2in7b_v2', 'waveshare2in7bv2', 'ws27inchbv2', 'waveshare_27bv2', 'waveshare27bv2'): elif config['ui']['display']['type'] in 'waveshare1in64g':
config['ui']['display']['type'] = 'waveshare2in7b_v2' config['ui']['display']['type'] = 'waveshare1in64g'
elif config['ui']['display']['type'] in ('ws_2in9', 'waveshare2in9', 'ws29inch', 'waveshare_29inch', 'waveshare29inch'): elif config['ui']['display']['type'] in 'waveshare1in02':
config['ui']['display']['type'] = 'waveshare2in9' config['ui']['display']['type'] = 'waveshare1in02'
elif config['ui']['display']['type'] in ('ws_2in9bc', 'waveshare2in9bc', 'ws2in9bc', 'ws29bc', 'waveshare_29bc', 'waveshare_2in9bc'): elif config['ui']['display']['type'] in 'waveshare2in9bc':
config['ui']['display']['type'] = 'waveshare2in9bc' config['ui']['display']['type'] = 'waveshare2in9bc'
elif config['ui']['display']['type'] in ('ws_2in9d', 'waveshare2in9d', 'ws2in9d', 'ws29d', 'waveshare_29d', 'waveshare_2in9d'): elif config['ui']['display']['type'] in 'waveshare2in9d':
config['ui']['display']['type'] = 'waveshare2in9d' config['ui']['display']['type'] = 'waveshare2in9d'
elif config['ui']['display']['type'] in ('ws_2in9v2', 'waveshare2in9_v2', 'waveshare2in9v2', 'ws2in9v2', 'waveshare_29v2', 'waveshare29v2'): elif config['ui']['display']['type'] in 'waveshare2in13b_v3':
config['ui']['display']['type'] = 'waveshare2in9_v2' config['ui']['display']['type'] = 'waveshare2in13b_v3'
elif config['ui']['display']['type'] in ('ws_2in9bv3', 'waveshare2in9b_v3', 'waveshare2in9bv3', 'ws2in9bv3', 'waveshare_29bv3', 'waveshare29bv3'): elif config['ui']['display']['type'] in 'waveshare2in36g':
config['ui']['display']['type'] = 'waveshare2in9b_v3' config['ui']['display']['type'] = 'waveshare2in36g'
elif config['ui']['display']['type'] in ('ws_2in9bv4', 'waveshare2in9b_v4', 'waveshare2in9bv4', 'ws2in9bv4', 'waveshare_29bv4', 'waveshare29bv4'): elif config['ui']['display']['type'] in 'waveshare2in66':
config['ui']['display']['type'] = 'waveshare2in9b_v4' config['ui']['display']['type'] = 'waveshare2in66'
elif config['ui']['display']['type'] in ('ws_3in0g', 'waveshare3in0g', 'ws3in0g', 'waveshare_30g', 'waveshare30g'): elif config['ui']['display']['type'] in 'waveshare2in66b':
config['ui']['display']['type'] = 'waveshare2in66b'
elif config['ui']['display']['type'] in 'waveshare2in66g':
config['ui']['display']['type'] = 'waveshare2in66g'
elif config['ui']['display']['type'] in 'waveshare3in0g':
config['ui']['display']['type'] = 'waveshare3in0g' config['ui']['display']['type'] = 'waveshare3in0g'
elif config['ui']['display']['type'] in ('ws_3in7', 'waveshare3in7', 'ws3in7', 'waveshare_37', 'waveshare37'): elif config['ui']['display']['type'] in 'waveshare3in7':
config['ui']['display']['type'] = 'waveshare3in7' config['ui']['display']['type'] = 'waveshare3in7'
elif config['ui']['display']['type'] in ('ws_3in52', 'waveshare3in52', 'ws3in52', 'waveshare_352', 'waveshare352'): elif config['ui']['display']['type'] in 'waveshare3in52':
config['ui']['display']['type'] = 'waveshare3in52' config['ui']['display']['type'] = 'waveshare3in52'
elif config['ui']['display']['type'] in ('ws_4in01f', 'waveshare4in01f', 'ws4in01f', 'waveshare_401f', 'waveshare401f'): elif config['ui']['display']['type'] in 'waveshare4in01f':
config['ui']['display']['type'] = 'waveshare4in01f' config['ui']['display']['type'] = 'waveshare4in01f'
elif config['ui']['display']['type'] in ('ws_4in2', 'waveshare4in2', 'ws4in2', 'waveshare_42', 'waveshare42'): elif config['ui']['display']['type'] in 'waveshare4in2':
config['ui']['display']['type'] = 'waveshare4in2' config['ui']['display']['type'] = 'waveshare4in2'
elif config['ui']['display']['type'] in ('ws_4in2v2', 'waveshare4in2v2', 'ws4in2v2', 'waveshare_42v2', 'waveshare42v2'): elif config['ui']['display']['type'] in 'waveshare4in2_v2':
config['ui']['display']['type'] = 'waveshare4in2_v2' config['ui']['display']['type'] = 'waveshare4in2_v2'
elif config['ui']['display']['type'] in ('ws_4in2bv2', 'waveshare4in2bv2', 'ws4in2bv2', 'waveshare_42bv2', 'waveshare42bv2'): elif config['ui']['display']['type'] in 'waveshare4in2b_v2':
config['ui']['display']['type'] = 'waveshare4in2b_v2' config['ui']['display']['type'] = 'waveshare4in2b_v2'
elif config['ui']['display']['type'] in ('ws_4in2bc', 'waveshare4in2bc', 'ws4in2bc', 'waveshare_42bc', 'waveshare42bc'): elif config['ui']['display']['type'] in 'waveshare4in2bc':
config['ui']['display']['type'] = 'waveshare4in2bc' config['ui']['display']['type'] = 'waveshare4in2bc'
elif config['ui']['display']['type'] in ('ws_4in26', 'waveshare4in26', 'ws4in26', 'waveshare_426', 'waveshare426'): elif config['ui']['display']['type'] in 'waveshare4in26':
config['ui']['display']['type'] = 'waveshare4in26' config['ui']['display']['type'] = 'waveshare4in26'
elif config['ui']['display']['type'] in ('ws_4in37g', 'waveshare4in37g', 'ws4in37g', 'waveshare_37g', 'waveshare437g'): elif config['ui']['display']['type'] in 'waveshare4in37g':
config['ui']['display']['type'] = 'waveshare4in37g' config['ui']['display']['type'] = 'waveshare4in37g'
elif config['ui']['display']['type'] in ('ws_5in65f', 'waveshare5in65f', 'ws5in65f', 'waveshare_565f', 'waveshare565f'): elif config['ui']['display']['type'] in 'waveshare5in65f':
config['ui']['display']['type'] = 'waveshare5in65f' config['ui']['display']['type'] = 'waveshare5in65f'
elif config['ui']['display']['type'] in ('ws_5in83', 'waveshare5in83', 'ws5in83', 'waveshare_583', 'waveshare583'): elif config['ui']['display']['type'] in 'waveshare5in83':
config['ui']['display']['type'] = 'waveshare5in83' config['ui']['display']['type'] = 'waveshare5in83'
elif config['ui']['display']['type'] in ('ws_5in83v2', 'waveshare5in83v2', 'ws5in83v2', 'waveshare_583v2', 'waveshare583v2'): elif config['ui']['display']['type'] in 'waveshare5in83_v2':
config['ui']['display']['type'] = 'waveshare5in83_v2' config['ui']['display']['type'] = 'waveshare5in83_v2'
elif config['ui']['display']['type'] in ('ws_5in83bv2', 'waveshare5in83bv2', 'ws5in83bv2', 'waveshare_583bv2', 'waveshare583bv2'): elif config['ui']['display']['type'] in 'waveshare5in83b_v2':
config['ui']['display']['type'] = 'waveshare5in83b_v2' config['ui']['display']['type'] = 'waveshare5in83b_v2'
elif config['ui']['display']['type'] in ('ws_5in83bc', 'waveshare5in83bc', 'ws5in83bc', 'waveshare_583bc', 'waveshare583bc'): elif config['ui']['display']['type'] in 'waveshare5in83bc':
config['ui']['display']['type'] = 'waveshare5in83bc' config['ui']['display']['type'] = 'waveshare5in83bc'
elif config['ui']['display']['type'] in ('ws_7in3f', 'waveshare7in3f', 'ws7in3f', 'waveshare_73f', 'waveshare73f'): elif config['ui']['display']['type'] in 'waveshare7in3f':
config['ui']['display']['type'] = 'waveshare7in3f' config['ui']['display']['type'] = 'waveshare7in3f'
elif config['ui']['display']['type'] in ('ws_7in3g', 'waveshare7in3g', 'ws7in3g', 'waveshare_73g', 'waveshare73g'): elif config['ui']['display']['type'] in 'waveshare7in3g':
config['ui']['display']['type'] = 'waveshare7in3g' config['ui']['display']['type'] = 'waveshare7in3g'
elif config['ui']['display']['type'] in ('ws_7in5', 'waveshare7in5', 'ws7in5', 'waveshare_75', 'waveshare75'): elif config['ui']['display']['type'] in 'waveshare7in5':
config['ui']['display']['type'] = 'waveshare7in5' config['ui']['display']['type'] = 'waveshare7in5'
elif config['ui']['display']['type'] in ('ws_7in5hd', 'waveshare7in5hd', 'ws7in5hd', 'waveshare_75hd', 'waveshare75hd'): elif config['ui']['display']['type'] in 'waveshare7in5_HD':
config['ui']['display']['type'] = 'waveshare7in5_HD' config['ui']['display']['type'] = 'waveshare7in5_HD'
elif config['ui']['display']['type'] in ('ws_7in5v2', 'waveshare7in5v2', 'ws7in5v2', 'waveshare_75v2', 'waveshare75v2'): elif config['ui']['display']['type'] in 'waveshare7in5_v2':
config['ui']['display']['type'] = 'waveshare7in5_v2' config['ui']['display']['type'] = 'waveshare7in5_v2'
elif config['ui']['display']['type'] in ('ws_7in5bhd', 'waveshare7in5bhd', 'ws7in5bhd', 'waveshare_75bhd', 'waveshare75bhd'): elif config['ui']['display']['type'] in 'waveshare7in5b_HD':
config['ui']['display']['type'] = 'waveshare7in5b_HD' config['ui']['display']['type'] = 'waveshare7in5b_HD'
elif config['ui']['display']['type'] in ('ws_7in5bv2', 'waveshare7in5bv2', 'ws7in5bv2', 'waveshare_75bv2', 'waveshare75bv2'): elif config['ui']['display']['type'] in 'waveshare7in5b_v2':
config['ui']['display']['type'] = 'waveshare7in5b_v2' config['ui']['display']['type'] = 'waveshare7in5b_v2'
elif config['ui']['display']['type'] in ('ws_7in5bc', 'waveshare7in5bc', 'ws7in5bc', 'waveshare_75bc', 'waveshare75bc'): elif config['ui']['display']['type'] in 'waveshare7in5bc':
config['ui']['display']['type'] = 'waveshare7in5bc' config['ui']['display']['type'] = 'waveshare7in5bc'
elif config['ui']['display']['type'] in ('ws_13in3k', 'waveshare13in3k', 'ws13in3k', 'waveshare_133k', 'waveshare133k'): elif config['ui']['display']['type'] in 'waveshare13in3k':
config['ui']['display']['type'] = 'waveshare13in3k' config['ui']['display']['type'] = 'waveshare13in3k'
else: else:

View File

@ -98,7 +98,7 @@ setup(name='pwnagotchi',
"install": CustomInstall, "install": CustomInstall,
}, },
scripts=['bin/pwnagotchi'], scripts=['bin/pwnagotchi'],
package_data={'pwnagotchi': ['defaults.toml', 'pwnagotchi/defaults.toml', 'locale/*/LC_MESSAGES/*.mo']}, package_data={'pwnagotchi': ['defaults.yml', 'pwnagotchi/defaults.yml', 'locale/*/LC_MESSAGES/*.mo']},
include_package_data=True, include_package_data=True,
packages=find_packages(), packages=find_packages(),
classifiers=[ classifiers=[