You have to know jog_dial adresses in RAM for your camera. Then you can peek() them and compare. I did it for SX130IS. It follows:
if v>u then
if v<u then
if u==v then
However, you need to find your own adresses for your camera. It's to be done by reading some files of the source code, I don't remember which. Probably a kind of patch for the specific camera or something.
Function returns -1 if jogdial was turned left, +1 if turned right and 0 if it was not turned since last check. Note, that wait_click() will not work for jogdial.
It would be nice to have get_jogdial() function built in CHDK...
As I'm reading this code I'm sure, that u and v must be initialized somewhere before (otherwise v would be a nil value at start and v>u would return an error).