qmk-config

qmk configs for my open-source keyboards

git clone https://9o.is/git/qmk-config.git

flash

(850B)


      1 #!/bin/bash
      2 set -e
      3 
      4 path="$(dirname "$(realpath "$0")")"
      5 model=$1
      6 
      7 function flash_chocofi {
      8     echo flashing chocofi
      9     dev="$(ls /dev/sd*1)"
     10     file="$path/.build/jul_chocofi_default.uf2"
     11     mnt_path="$path/.build/mnt"
     12 
     13     [ -e "$file" ] || { echo 'uf2 file missing'; exit 1; }
     14     [ -b "$dev" ] || { echo 'device missing'; exit 1; }
     15 
     16     mkdir -p $mnt_path
     17     sudo mount $dev $mnt_path
     18     sudo cp $file $mnt_path
     19     sudo umount $mnt_path
     20 }
     21 
     22 function flash_cygnus {
     23     echo flashing cygnus
     24     file="$path/.build/jul_cygnus_default.hex"
     25 
     26     [ -e "$file" ] || { echo 'hex file missing'; exit 1; }
     27 
     28     # qvm-copy to sys-usb
     29     # avrdude -p m32U4 -P /dev/ttyACM0 -c avr109 -U flash:w:$file
     30 }
     31 
     32 if [ $model == 'chocofi' ]; then
     33     flash_chocofi
     34 elif [ $model == 'cygnus' ]; then
     35     flash_cygnus
     36 else
     37     echo 'unknown model'
     38     exit 1
     39 fi
     40