I where thinking more of scanning several conventional DMR systems and they all use key ID 1. If one system use a format of TG 1-99 and another TG10,000-99,000 how would it handle TG1 to load another key instead of trating it as a key ID? Would it be possible to instead compile a version where a TG was replaced by a frequency ?
I don't have anything coded that can do it by frequency, or use frequency as a variable to create a unique key id, but it is feasible, if you were using the internal rtl dongle as input, or connected to SDR++ (or anything with rigctl) then you could poll for the current frequency. There is some code that is dormant without a #define in the nxdn code that loads scrambler keys purely based on the frequency value, which wouldn't directly help, but if needed to become a variable in a unique key id value, segments of it could be copy and pasted and reused with some tweaks.
The general idea for loading any key variable based on multiple factors would be to both create a key loading function that reads in all the metrics you want to use in a csv file, and run a calculation on all those items to produce a unique number. Then also at the time of the keyring to load a key, look at the current state of all those metrics and run the same calculation to reproduce the unique number and use it to load the key variable you want.
The long of the short is that at some point, I may revisit the keyloading situation and make it more robust and allow a more complex loading scheme based on things like frequency, system unique identifiers (like CC, NAC, SYSCODE, etc), key id (or lack thereof), alg id, and so on. Key loading was implemented with out much thought other than the key id value, but as more and more requests have poured in for situations similar to yours where you have a lot of conventional using the same key id and so on, I see a need to overhaul the entire key ringing and keystream creation process. That being said, I don't really have the time or desire to work on it now, so perhaps one day I'll visit it and work on it.
If its helpful to anybody, I found the patch file I created back when I did the Yorch patch, and was able to merge most all of it in, aside from some cosmetic things if anybody else wanted to take a crack at using it to make their own version advanced keyloading. I made a new patch that will merge with the current github code. Its attached.