leonardo as keyboard does not wake windows 7 from sleep

I got it working when I used the code:
USBDevice.wakeupHost();
UDCON |= (1 << RMWKUP);