This method takes advantage of the fact that you can send the UF2 firmware to the microcontroller by simply writing it to the block device the firmware exposes, without mounting the vfat filesystem. This avoids the microcontroller causing issues when it abruptly disappears as soon as the file copy is complete, rather than waiting for the filesystem to be unmounted and the device ejected.
~I still need to write documentation for this, and I plan to update this PR with a commit adding that documentation.~
Setup is as follows:
First is the installation of the udev rule. On NixOS that can be done by using the new nixosModule output.
This is an alternative to https://github.com/lilyinstarlight/zmk-nix/pull/80, however they are not mutually exclusive and both could be adopted.
This method takes advantage of the fact that you can send the UF2 firmware to the microcontroller by simply writing it to the block device the firmware exposes, without mounting the vfat filesystem. This avoids the microcontroller causing issues when it abruptly disappears as soon as the file copy is complete, rather than waiting for the filesystem to be unmounted and the device ejected.
~I still need to write documentation for this, and I plan to update this PR with a commit adding that documentation.~
Setup is as follows:
First is the installation of the udev rule. On NixOS that can be done by using the new nixosModule output.
For Non-NixOS use, the user should copy the uf2-block.rules file to /etc/udev/rules.d/{priority}-uf2-block.rules.
Then change the flash command in the user zmk-config: