JanLunge / pog

A Kmk firmware flashing and configuration tool
https://pog.heaper.de/
MIT License
255 stars 17 forks source link

"Install KMK" button never works the first time. #17

Closed Gadgetoid closed 1 month ago

Gadgetoid commented 1 month ago

Tested on both Linux and macOS, when I first set up a new board and hit the "Install KMK" button it finishes quickly but does not install.

On macOS it seems this downloads kmk.zip and unpacks it to kmk/kmk_firmware-master but somehow this is never copied to the device.

If I try again, either by relaunching the app or closing and re-opening its main window it will work.

If I delete kmk.zip and the kmk dir from ~/Library/Application Support/pog it will, once again, download but fail to copy.

Gadgetoid commented 1 month ago

It's some kind of async issue, since the copy is happening before the firmware is decompressed:

kmk downloaded
moving kmk into keyboard
Copying of KMK done [Error: ENOENT: no such file or directory, lstat '/Users/gadgetoid/Library/Application Support/pog/kmk/kmk_firmware-master/kmk'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/Users/gadgetoid/Library/Application Support/pog/kmk/kmk_firmware-master/kmk'
}
kmk decompressed 586
Gadgetoid commented 1 month ago

Ah it's because - and excuse my extremely rusty anything-related-to-js/ts - the copy isn't in, I guess, the .then callback of the decompress: https://github.com/JanLunge/pog/blob/4da35478ad46c710e85a2c21f89c6174bc6e8699/src/main/kmkUpdater.ts#L54-L81