Diags needs a matching diags kernel. Main needs a matching main kernel. Main and diags do not need to match. There are a bunch of DIFFERENT versions of v5.1.0 (all different but all with the save major and minor version numbers). The latest v5.1.0 DELETES the SSH files from the kindle when it boots. So after installing an image, ssh can quit working after the next OTA update pushed from amazon.
Starting with v5.1.0, they broke a lot of our hacks, and they made programs compiled for v5.1.0 not work with v5.0.x in many cases (and vice versa). And now they are deleting files that we use. Bad amazon!
Anyway, like I said in PREVIOUS posts, be sure that you install matching diags_ssh and diags kernel version. Then it should work. You did not say you flashed the matching kernel.
You will probably continue to fail in your efforts if you continue to NOT follow my instructions.
What diags KERNEL version are you using?