Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Windows

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -r requirements.txt

- name: Build with PyInstaller
run: |
pyinstaller spec/Windows.spec

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: USBToolBox-Windows
path: dist/Windows.exe
2 changes: 1 addition & 1 deletion Scripts/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from Scripts._build import BUILD

VERSION = "0.2"
VERSION = "0.3.1"

if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
current_dir = Path(sys.executable).parent
Expand Down
21 changes: 17 additions & 4 deletions base.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,14 +532,25 @@ def build_kext(self):
]["_items"][0]["machine_model"]
else:
model_menu = utils.TUIOnlyPrint(
"Enter Model Identifier",
"Enter the model identifier: ",
"Enter Model Identifier or config.plist",
"Enter the model identifier or drag config.plist here: ",
[
"You are seeing this as you have selected to use native classes. Model identifier autodetection is unavailable as you are not on macOS.",
"Please enter the model identifier of the target system below. You can find it in System Information or with 'system_profiler -detailLevel mini SPHardwareDataType'.",
"Please enter the model identifier of the target system, or drag your config.plist here to auto-detect it.",
],
).start()
model_identifier = model_menu.strip()
user_input = model_menu.strip().strip('"').strip("'")

if Path(user_input).is_file() and user_input.lower().endswith(".plist"):
try:
plist_data = plistlib.load(open(user_input, "rb"))
model_identifier = plist_data.get("PlatformInfo", {}).get("Generic", {}).get("SystemProductName", "")
if not model_identifier:
model_identifier = input("SystemProductName not found. Enter manually: ").strip()
except Exception:
model_identifier = input("Failed to parse config.plist. Enter manually: ").strip()
else:
model_identifier = user_input

ignore = response == "I"

Expand Down Expand Up @@ -607,7 +618,9 @@ def build_kext(self):

personality["IOProviderMergeProperties"]["ports"][port_name] = {
"port": binascii.a2b_hex(hexswap(hex(port["index"])[2:].zfill(8))),
"usb-port-number": binascii.a2b_hex(hexswap(hex(port["index"])[2:].zfill(8))),
"UsbConnector": port["type"] or port["guessed"],
"usb-port-type": port["type"] or port["guessed"],
}

if self.settings["add_comments_to_map"] and port["comment"]:
Expand Down