OK, as I just said to you in IRC - yep I give in, I failed - I'm not gonna do it
As you said, ZTEX requires USB direct control - it won't work via serial - so yeah there's no way I could write that in a day without the hardware
(If I had the hardware ... well yeah that wouldn't be an issue)
I've little experience with USB directly (and no idea why it wont work via serial like Bitforce and Icarus) but if that's the case, yep I certainly can't get the USB interface to it right without the hardware to try stuff
Oh and what I was thinking about the Frequency was to do it a little different:
Basically have a cgminer option to set the start frequency (comma list for ZTEX devices),
and use a simple lookup table based on the hardware (for unspecified on the command line) with a low value for unknown,
and step it up N (1 or 2?) every successful nonce then as soon as it gets a hardware error start stepping it down one every time you get a HW error (that would always be the case from then on, never go back up)
It would take a while to get to optimal frequency if it started too low but since that will vary from board to board, you would be setting cgminer to start close to the optimal ferquency for each board once you see what it is after an extended run
Then also add a new API option to set it to a new value (and report the current value) ... since you may want to be able to push it back up rather than restarting cgminer if conditions change (e.g. a hot day vs a cool night)
Thinking about pushing it back up automatically - I don't think that's a good idea since I'd expect in the long term that would be bad for the life of the FPGA - i.e. better to let it settle a couple of Hz below than always going up and down near HW failure (and also losing work due to every time you get a HW failure)