Skip to content

Commit

Permalink
Fix SonixQMK#12 and make Mac build again
Browse files Browse the repository at this point in the history
* Create a shell script that removes conflicting libraries
* Fix Mac package building process
* Update README.md
  • Loading branch information
tfuxu committed May 27, 2022
1 parent 00d1b4b commit e1233f5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 13 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/clean-libraries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
cd dist/sonix-flasher
rm libgobject-2.0.so.* \
libgio-2.0.so.* \
libgtk-3.so.* \
libgdk-3.so.* \
libharfbuzz.so.* \
libfontconfig.so.* \
libfreetype.so.* \
libgpg-error.so.* \
libstdc++.so.* \
libglib-2.0.so.*
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:
- name: Install dependencies
run: sudo apt-get install libusb-1.0-0-dev libudev-dev
run: sudo apt-get install qtbase5-dev libxcomposite-dev libxkbcommon-x11-dev libusb-1.0-0-dev libudev-dev

- uses: actions/checkout@v2
- uses: actions/setup-python@v1
Expand All @@ -29,6 +29,8 @@ jobs:
run: |
source venv/bin/activate
pyinstaller sonix-flasher.spec
chmod +x .github/workflows/clean-libraries.sh
.github/workflows/clean-libraries.sh
cd dist
tar cfJ flasher-linux.tar.xz "sonix-flasher"
Expand Down Expand Up @@ -56,8 +58,8 @@ jobs:
- name: Build
run: |
source venv/bin/activate
pyinstaller sonix-flasher.spec
hdiutil create -volname "sonix-flasher" -srcfolder "dist/sonix-flasher.app" -ov -format UDZO flasher-mac.dmg
pyinstaller --onefile -n "sonix-flasher" --windowed src/sonix-flasher/main.py
hdiutil create -volname "sonix-flasher" -srcfolder "dist/" -ov -format UDZO flasher-mac.dmg
- uses: actions/upload-artifact@v1
with:
Expand Down
39 changes: 29 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Sonix Flasher
[![CI](https://github.com/SonixQMK/sonix-flasher/actions/workflows/main.yml/badge.svg)](https://github.com/SonixQMK/sonix-flasher/actions/workflows/main.yml)

A simple multi-platform utility for flashing QMK firmware into SONiX microcontrolers.

<img src="https://i.imgur.com/8zckoo0.png" alt="Sonix Flasher">

## Usage
### Entering bootloader

Expand All @@ -10,7 +14,7 @@ To perform firmware flashing, you need to boot your keyboard into bootloader mod
* On flashed keyboard, you should be able to press `Fn + Esc` combination to immediately boot into bootloader
* As a last resort, you can open a keyboard and briefly short BOOT pin of the MCU with GND

**[NOTE]** If you have a jumploader, it’s strongly recommended to flash the jumploader on SN32F260 since the 260 series can become bricked if the bootloader is overrided. [See](https://github.com/SonixQMK/sonix-keyboard-bootloader#entering-the-bootloader)
**[NOTE]** It’s strongly recommended to flash the jumploader on keyboards with SN32F260 chips since the 260 series can become bricked if the bootloader is overrided. [See](https://github.com/SonixQMK/sonix-keyboard-bootloader#entering-the-bootloader)

### Flashing firmware

Expand All @@ -21,23 +25,21 @@ Put your keyboard in bootloader mode, set the correct qmk offset (which should b
* Python >= 3.7
* libusb and libudev (only in Linux)

### Linux and Mac OS
### Linux

Open terminal and type:

```sh
python3 -m venv venv
source venv/bin/activate
pip install cython # only on Mac OS
pip install wheel
pip install -r requirements.txt
pyinstaller sonix-flasher.spec
```

To run an application you need to type in Linux:
To run an application, type this in terminal:
`./dist/sonix-flasher/sonix-flasher`

And in Mac OS:
`open -n ./dist/sonix-flasher/sonix-flasher.app`

**[NOTE]** To run it for immediate use, just run `run.sh` and it'll set itself up and run. (only for Linux)

### NixOS
Expand All @@ -49,6 +51,22 @@ nix shell
fbs run
```

### Mac OS

Open terminal and type:

```sh
python -m venv venv
source venv/bin/activate
pip install cython
pip install wheel
pip install -r requirements.txt
pyinstaller --onefile -n "sonix-flasher" --windowed src/sonix-flasher/main.py
```

To run an application, type this in terminal:
`open -n ./dist/sonix-flasher/sonix-flasher.app`

### Windows

Open Powershell and type:
Expand All @@ -70,11 +88,12 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="320f", ATTR{idProduct}=="5013", TAG+="uaccess
KERNEL=="hidraw*", ATTR{idVendor}=="320f", ATTR{idProduct}=="5013", TAG+="uaccess", TAG+="udev-acl"
```

Change `ATTR{idVendor}` and `ATTR{idProduct}` to values valid for your keyboard and type in terminal: `udevadm control --reload`
Change `ATTR{idVendor}` and `ATTR{idProduct}` to values valid for your keyboard, save a file as `your-keyboard.rules` (name can be changed) in `/etc/udev/rules.d/`, and type in terminal as root: `udevadm control --reload`

## Troubleshooting
### Keyboard isn't showing in device list
Firstly check if your keyboard is plugged in properly.

Before doing anything, check if your keyboard is plugged in properly.

If you are on Windows, download [Zadig](https://zadig.akeo.ie/) to get VID and PID (first value in USB ID is VID and the second is PID).

Expand All @@ -90,4 +109,4 @@ qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
```

This means you are probably trying to run application with sudo on Wayland session. Wayland doesn't support running applications with sudo because of security reasons. You should refer to [Running with sudo](#running-with-sudo) section, or check [here](https://wiki.archlinux.org/title/Running_GUI_applications_as_root#Wayland) for a workaround.
This means that you are probably trying to run application with sudo on (X)Wayland session. (X)Wayland doesn't support running applications with sudo because of security reasons. You should refer to [Running with sudo](#running-with-sudo) section, or check [here](https://wiki.archlinux.org/title/Running_GUI_applications_as_root#Wayland) for a workaround.

0 comments on commit e1233f5

Please sign in to comment.