also note: if you want to send a keypress, using the KeyChar (which is simply the character in your cases) is enough. only if you want to send a keyup/down you’ll need the keycodes.
there is a bit of explanation about that at the bottom of the patch you referred to.
if that was not enough, please provide an example of what exactly you want to achieve.