init commit

This commit is contained in:
Luxferre
2026-10-19 09:23:54 +03:00
commit 6942acf5cf
307 changed files with 35003 additions and 0 deletions
@@ -0,0 +1,168 @@
diff --git a/Library/firehose.py b/Library/firehose.py
index 4e7b8a4..55cf187 100644
--- a/Library/firehose.py
+++ b/Library/firehose.py
@@ -134,6 +134,17 @@ class qualcomm_firehose:
return False
+ def wait_response(self):
+ data = bytearray()
+ while b"<response" not in data:
+ try:
+ data += self.cdc.read(self.cfg.MaxXMLSizeInBytes)
+ except:
+ break
+ info = self.xml.getlog(data)
+ rsp = self.xml.getresponse(data)
+ return info, rsp
+
def cmd_write(self,physical_partition_number,start_sector,filename,Display=True):
size = os.stat(filename).st_size
with open(filename,"rb") as rf:
@@ -170,6 +181,7 @@ class qualcomm_firehose:
if (prog > old):
if Display:
print_progress(prog, 100, prefix='Progress:', suffix='Complete', bar_length=50)
+ old = prog
bytesToWrite -= wlen
pos+=wlen
#time.sleep(0.05)
@@ -177,7 +189,12 @@ class qualcomm_firehose:
print_progress(100, 100, prefix='Progress:', suffix='Complete', bar_length=50)
self.cdc.write(b'',self.cfg.MaxPayloadSizeToTargetInBytes)
time.sleep(0.2)
- info = self.xml.getlog(self.cdc.read(self.cfg.MaxXMLSizeInBytes))
+ info, rsp = self.wait_response()
+ if rsp.get("value") == "ACK":
+ return True
+ else:
+ print(f"Error:{info}")
+ return False
else:
print(f"Error:{rsp}")
return False
@@ -210,6 +227,7 @@ class qualcomm_firehose:
if (prog > old):
if Display:
print_progress(prog, 100, prefix='Progress:', suffix='Complete', bar_length=50)
+ old = prog
bytesToWrite -= wlen
pos+=wlen
#time.sleep(0.05)
@@ -217,12 +235,11 @@ class qualcomm_firehose:
print_progress(100, 100, prefix='Progress:', suffix='Complete', bar_length=50)
self.cdc.write(b'',self.cfg.MaxPayloadSizeToTargetInBytes)
time.sleep(0.2)
- info = self.xml.getlog(self.cdc.read(self.cfg.MaxXMLSizeInBytes))
- rsp=self.xml.getresponse(self.cdc.read(self.cfg.MaxXMLSizeInBytes))
- if rsp["value"]=="ACK":
+ info, rsp = self.wait_response()
+ if rsp.get("value")=="ACK":
return True
else:
- print(f"Error:{info[1]}")
+ print(f"Error:{info}")
else:
print(f"Error:{rsp}")
return False
@@ -258,12 +275,11 @@ class qualcomm_firehose:
if Display and prog!=100:
print_progress(100, 100, prefix='Progress:', suffix='Complete', bar_length=50)
time.sleep(0.2)
- info = self.xml.getlog(self.cdc.read(self.cfg.MaxXMLSizeInBytes))
- rsp=self.xml.getresponse(self.cdc.read(self.cfg.MaxXMLSizeInBytes))
- if rsp["value"]=="ACK":
+ info, rsp = self.wait_response()
+ if rsp.get("value")=="ACK":
return resData
else:
- print(f"Error:{info[1]}")
+ print(f"Error:{info}")
return ""
else:
print(f"Error:{rsp[2]}")
@@ -302,12 +318,11 @@ class qualcomm_firehose:
if Display and prog!=100:
print_progress(100, 100, prefix='Progress:', suffix='Complete', bar_length=50)
time.sleep(0.2)
- info = self.xml.getlog(self.cdc.read(self.cfg.MaxXMLSizeInBytes))
- rsp = self.xml.getresponse(self.cdc.read(self.cfg.MaxXMLSizeInBytes))
- if rsp["value"]=="ACK":
+ info, rsp = self.wait_response()
+ if rsp.get("value")=="ACK":
return tmp
else:
- print(f"Error:{tmp}")
+ print(f"Error:{info}")
return ""
else:
print(f"Error:{rsp[1]}")
diff --git a/Library/gpt.py b/Library/gpt.py
index cd972b9..c3ab4f6 100644
--- a/Library/gpt.py
+++ b/Library/gpt.py
@@ -116,6 +116,7 @@ class gpt:
self.num_part_entries = num_part_entries
self.part_entry_size = part_entry_size
self.part_entry_start_lba = part_entry_start_lba
+ self.gpt_header = list(gpt.gpt_header)
if num_part_entries is None:
self.gpt_header += [('num_part_entries', 'I'),]
if part_entry_size is None:
diff --git a/Library/utils.py b/Library/utils.py
index 06abf2c..9a61b0b 100644
--- a/Library/utils.py
+++ b/Library/utils.py
@@ -1,7 +1,13 @@
import sys
import struct
-from capstone import *
-from keystone import *
+try:
+ from capstone import *
+except ImportError:
+ pass
+try:
+ from keystone import *
+except ImportError:
+ pass
import codecs
class elf:
diff --git a/edl.py b/edl.py
old mode 100644
new mode 100755
index 6b9ecbc..f81142d
--- a/edl.py
+++ b/edl.py
@@ -6,6 +6,8 @@ Licensed under MIT License, (c) B. Kerler 2018-2019
import argparse
import time
import os
+import sys
+sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
from Library.utils import *
from Library.usb import usb_class
from Library.gpt import gpt
@@ -80,7 +82,7 @@ def main():
parser.add_argument('-maxpayload',metavar="<bytes>",help='[Option] The max bytes to transfer in firehose mode (default=1048576)', type=int, default=1048576)
parser.add_argument('-skipwrite', help='[Option] Do not write actual data to disk (use this for UFS provisioning)', action="store_true")
parser.add_argument('-skipstorageinit', help='[Option] Do not initialize storage device (use this for UFS provisioning)',action="store_true")
- parser.add_argument('-memory', metavar="<UFS/eMMC>",help='[Option] Memory type (default=UFS)',default='UFS')
+ parser.add_argument('-memory', metavar="<UFS/eMMC>",help='[Option] Memory type (default=eMMC)',default='eMMC')
parser.add_argument('-sectorsize', metavar="<bytes>",help='[Option] Define Disk Sector Size (default=512)',type=int,default=512)
parser.add_argument('-lun', metavar="<num>",help='[Option] Define LUN',type=int,default=0)
#parser.add_argument('-debug', help='[Option] Enable debug output', action="store_true")
@@ -176,7 +178,10 @@ def main():
mode="Firehose"
print("Successfully uploaded programmer :)")
else:
- sahara.bit64=True
+ if sahara.programmer and len(sahara.programmer) > 4 and sahara.programmer[:4] == b"\x7fELF":
+ sahara.bit64 = (sahara.programmer[4] == 2)
+ else:
+ sahara.bit64 = True
if mode=="Firehose":
cfg=qualcomm_firehose.cfg()
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,44 @@
--- a/devices/nokia-argon/qcom-msm8905-nokia-argon.dts 2026-10-18 12:03:41.241108254 +0300
+++ b/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts 2026-10-18 12:03:41.241443705 +0300
@@ -4,8 +4,8 @@
#address-cells = <0x01>;
#size-cells = <0x01>;
interrupt-parent = <0x01>;
- model = "Nokia 8110 4G";
- compatible = "nokia,argon", "qcom,msm8905", "qcom,msm8909";
+ model = "Nokia 2720 Flip";
+ compatible = "nokia,beatles", "nokia,argon", "qcom,msm8905", "qcom,msm8909";
chassis-type = "handset";
aliases {
@@ -1733,7 +1733,7 @@
status = "okay";
display@0 {
- compatible = "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi";
+ compatible = "nokia,beatles-gc9305-panel", "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi";
reg = <0x00>;
backlight = <0x6b>;
reset-gpios = <0x27 0x19 0x00>;
--- a/devices/nokia-argon/qcom-msm8905-nokia-argon.dts 2026-10-18 12:03:41.241108254 +0300
+++ b/devices/nokia-tough/qcom-msm8905-nokia-coconut.dts 2026-10-18 12:03:41.241598417 +0300
@@ -4,8 +4,8 @@
#address-cells = <0x01>;
#size-cells = <0x01>;
interrupt-parent = <0x01>;
- model = "Nokia 8110 4G";
- compatible = "nokia,argon", "qcom,msm8905", "qcom,msm8909";
+ model = "Nokia 800 Tough";
+ compatible = "nokia,coconut", "nokia,argon", "qcom,msm8905", "qcom,msm8909";
chassis-type = "handset";
aliases {
@@ -1733,7 +1733,7 @@
status = "okay";
display@0 {
- compatible = "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi";
+ compatible = "nokia,coconut-gc9305-panel", "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi";
reg = <0x00>;
backlight = <0x6b>;
reset-gpios = <0x27 0x19 0x00>;
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,226 @@
# Bananarchy Sxmo 240x320 Native Resolution & Physical Keypad Patch
# Targets: Nokia 8110 4G (nokia-argon), Nokia 2720 Flip (nokia-beatles),
# Nokia 800 Tough (nokia-coconut), Nokia 8000 4G (nokia-sparkler)
#
# Full modified files are tracked in overlay/rootfs/:
# - usr/bin/sxmo_deviceprofile_nokia,{argon,beatles,coconut,sparkler,leo}.sh
# - usr/share/sxmo/appcfg/{sway_template,conky.conf,wofi.config,wofi.css,foot.ini,wob.ini,dunst.conf}
# - usr/share/sxmo/default_hooks/{sxmo_hook_inputhandler.sh,sxmo_hook_start.sh}
# - home/user/.config/sxmo/{profile,sway,conky.conf}
--- a/usr/share/sxmo/appcfg/profile_template 2026-05-10 19:25:12.000000000 +0300
+++ b/overlay/rootfs/home/user/.config/sxmo/profile 2026-10-18 12:06:20.163476428 +0300
@@ -69,3 +69,10 @@
#Set to the default text for a new text message.
export SXMO_DEFAULT_DRAFT="Enter new message here."
+
+export GTK_IM_MODULE=fcitx
+export QT_IM_MODULE=fcitx
+export XMODIFIERS=@im=fcitx
+export SXMO_MENU=wofi
+
+export SXMO_BG_IMG="/usr/share/wallpapers/bananarchy.png"
--- a/usr/share/sxmo/appcfg/i3_template 2026-05-10 19:25:12.000000000 +0300
+++ b/overlay/rootfs/usr/share/sxmo/appcfg/sway_template 2026-10-18 14:06:00.979385569 +0300
@@ -1,9 +1,9 @@
-# Default config for i3
-# configversion: 7fd9eb1f82c8403c974da53df81b9d1e
+# Default config for sway
+# configversion: 076611fe8cc699bcaa01092a8e4481c0
#
-# Copy this to ~/.config/i3/config and edit it to your liking.
+# Copy this to ~/.config/sway/config and edit it to your liking.
#
-# Please see https://i3wm.org/docs/userguide.html for a complete reference!
+# Read `man 5 sway` for a complete reference.
### Variables
#
@@ -17,25 +17,59 @@
# Your preferred terminal emulator
set $term sxmo_terminal.sh
# Your preferred application launcher
-# Note: pass the final command to i3msg so that the resulting window can be opened
+# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
-set $menu dmenu_run
+set $menu bemenu-run
-font pango:Sxmo 11
+font "Sxmo 13"
+xwayland disable
+output * scale 1 bg /usr/share/wallpapers/bananarchy.png fill
+
+exec_always sxmo_swayinitconf.sh
+
+exec_always dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP
mode "menu" {
- # This is slower than remapping the keys using a keymap, but we don't need
- # to know the device names, so use it as a fallback so this functionality
- # keeps working if a deviceprofile doesn't exist.
- bindsym XF86PowerOff exec xdotool type Return
- bindsym XF86AudioRaiseVolume exec xdotool type Up
- bindsym XF86AudioLowerVolume exec xdotool type Down
+ bindsym --locked XF86PowerOff exec sh -c "sxmo_dmenu.sh close; if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; fi"
+ bindsym --locked XF86PickupPhone exec sh -c "if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; else wtype -k Return; fi"
+ bindsym --locked XF86KbdLcdMenu1 exec sh -c "sxmo_dmenu.sh close; if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; fi"
+ bindsym --locked XF86KbdLcdMenu2 exec sh -c "sxmo_dmenu.sh close; if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; fi"
+ bindsym XF86AudioRaiseVolume exec wtype -k Up
+ bindsym XF86AudioLowerVolume exec wtype -k Down
+ bindswitch --locked lid:on exec sh -c "sxmo_dmenu.sh close; brightnessctl -d white:kbd_backlight set 0; sxmo_state.sh set screenoff"
+ bindswitch --locked lid:off exec sh -c "brightnessctl -d white:kbd_backlight set 255; sxmo_state.sh set unlock; sxmo_wm.sh display on"
+}
+
+# Mode specifically for use with Nokia N900 hardware keyboard
+mode "N900" {
+ # follow the standard sxmo keybinds as far as possible
+ bindsym t exec $term; mode "default"
+ bindsym q mode "default"
+ bindsym Shift+p exec sxmo_appmenu.sh sys; mode "default"
+ bindsym p exec sxmo_appmenu.sh; mode "default"
+ bindsym d exec $menu; mode "default"
+ bindsym Shift+q kill; mode "default"
+ bindsym i exec sxmo_wmmenu.sh windowswitcher; mode "default"
+ bindsym Shift+c reload; mode "default"
+ bindsym f fullscreen; mode "default"
+ bindsym Shift+space floating toggle; mode "default"
+ bindsym a focus parent; mode "default"
}
### Key bindings
#
# Basics:
#
+ input * xkb_options compose:ralt
+
+ # Nokia N900 hardware keyboard
+ input "1:1:TWL4030_Keypad" {
+ xkb_model "nokiarx51"
+ xkb_layout "us"
+ # ralt has special meaning on N900 keyboard so do not use as
+ # compose key
+ xkb_options compose:rwin
+ }
# Start a terminal
bindsym $mod+Return exec $term
@@ -58,13 +92,13 @@
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
- floating_modifier $mod
+ floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
- # Exit i3 (logs you out of your i3 session)
- bindsym $mod+Shift+e exec i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your i3 session.' -b 'Yes, exit i3' 'i3-msg exit'
+ # Exit sway (logs you out of your Wayland session)
+ bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'sxmo_power.sh logout'
#
# Moving around:
#
@@ -157,7 +191,7 @@
#
# Scratchpad:
#
- # i3 has a "scratchpad", which is a bag of holding for windows.
+ # Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
@@ -194,48 +228,68 @@
#
# Status Bar:
#
-# Read `man 5 i3bar` for more information about this section.
+# Read `man 5 sway-bar` for more information about this section.
bar {
position top
+ height 24
+ font "Sxmo 13"
- # When the status_command prints a new line to stdout, i3bar updates.
+ # When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
- status_command sxmo_status_watch.sh -o plain
- font pango:Sxmo 11
+ status_command sxmo_status_watch.sh -o pango
- padding 0 20px 8px 8px
+ pango_markup enabled
colors {
statusline #ffffff
background #323232
inactive_workspace #323232 #323232 #ffffff
-
+ font "Sxmo 13"
}
}
-for_window [class="pinentry-.*"] floating enable
-for_window [class="st" title=".*sxmo/modem/.*/draft.txt.*"] resize set height 25
-for_window [class="megapixels"] inhibit_idle open
-for_window [class="ep[yr].*"] inhibit_idle visible
-for_window [class="tabbed"] border pixel 0
-no_focus [class="svkbd"]
-
-smart_gaps on
+for_window [app_id="pinentry-.*"] floating true
+for_window [app_id="foot" title=".*sxmo/modem/.*/draft.txt.*"] resize set height 25
+for_window [title="megapixels"] inhibit_idle open
+for_window [title="ep[yr].*"] inhibit_idle visible
+
+default_border pixel 2
+titlebar_border_thickness 2
+hide_edge_borders smart
# Need playerctl installed and running
-bindsym XF86AudioPlay exec playerctl play-pause
-bindsym XF86AudioPause exec playerctl play-pause
-bindsym XF86AudioStop exec playerctl stop
-bindsym XF86AudioNext exec playerctl next
-bindsym XF86AudioPrev exec playerctl previous
-
-bindsym XF86MonBrightnessUp exec sxmo_brightness.sh up
-bindsym XF86MonBrightnessDown exec sxmo_brightness.sh down
+bindsym --locked XF86AudioPlay exec playerctl play-pause
+bindsym --locked XF86AudioPause exec playerctl play-pause
+bindsym --locked XF86AudioStop exec playerctl stop
+bindsym --locked XF86AudioNext exec playerctl next
+bindsym --locked XF86AudioPrev exec playerctl previous
+
+bindsym --locked XF86MonBrightnessUp exec sxmo_brightness.sh up
+bindsym --locked XF86MonBrightnessDown exec sxmo_brightness.sh down
+
+# Nokia N900-specific key bindings:
+# 1. Bind lock key (XF86ScreenSaver)
+# Use keycode due to https://github.com/swaywm/sway/issues/8438
+bindcode --release --locked --input-device="1:1:gpio_keys" 160 exec sxmo_state.sh set unlock
+# 2. Workaround the lack of a free ModX key on hardware keyboard
+bindsym --input-device="1:1:TWL4030_Keypad" Shift+space mode "N900"
bindsym Print exec sxmo_screenshot.sh
bindsym button2 kill
-exec i3 --get-socketpath > "$XDG_RUNTIME_DIR"/sxmo.i3sock
+bindswitch --locked lid:on exec sh -c "brightnessctl -d white:kbd_backlight set 0; sxmo_state.sh set screenoff"
+bindswitch --locked lid:off exec sh -c "brightnessctl -d white:kbd_backlight set 255; sxmo_state.sh set unlock; sxmo_wm.sh display on"
+
+# Nokia 8110 4G hardware keypad bindings (User:Ybon)
+bindsym --locked --no-repeat XF86KbdLcdMenu1 exec sxmo_hook_inputhandler.sh menuleft_one
+bindsym --locked --no-repeat XF86KbdLcdMenu2 exec sxmo_hook_inputhandler.sh menuright_one
+bindsym --locked --no-repeat XF86PickupPhone exec sxmo_hook_inputhandler.sh enter_one
+
+include /etc/sway/config.d/*
+
+exec 'printf %s "$SWAYSOCK" > "$XDG_RUNTIME_DIR"/sxmo.swaysock'
+
+exec sxmo_hook_start.sh
-# vim: ft=i3config
+# vim: ft=swayconfig