Open bcr opened 3 years ago
This will update bininfo.rs
in-place
#!/bin/sh
uf2info=`curl https://raw.githubusercontent.com/microsoft/uf2/master/utils/uf2families.json`
map=`echo $uf2info | jq -r '.[] | " \(.id) => Self::\(.short_name),"' | sed "s/\(0x.\{4\}\)/\1_/"`
perl -0777 -i -pe \
"s/(match val {\\n).*(_ => Self::UNKNOWN\(val\),\\n)/\$1$map\\n \$2/s" \
bininfo.rs
families=`echo $uf2info | jq -r '.[] | " \(.short_name),"'`
perl -0777 -i -pe \
"s/(pub enum FamilyId {\\n).*( UNKNOWN\(u32\),\\n)/\$1$families\\n\$2/s" \
bininfo.rs
Thanks! we keep the vid pid pairs over at https://github.com/jacobrosenthal/hf2-rs/blob/6c13c140956d4a96194cd06375c04b762f4354cb/hf2/src/utils/mod.rs#L193
Ill probably do something pure rust at some point, but whatever solution you come up with would be fine for now.
Well, I'm not sure how to fix the VID / PID problem -- I tried to make the family
field in the UF2 spec as normalized as I could. But as far as VID / PID I'm not sure how to approach it.
Per microsoft/uf2#46 there is now a JSON file that can be used to generate the values in
hf2/src/bininfo.rs
I can take a stab at making a script to auto-update this for you.
For your case, these work for instance: