This question already has an answer here:
I'm having a problem with my MacBook Pro Retina 15.
I close the screen to put it to sleep. When I open it back up, the screen wakes up, but the keyboard and trackpad do not work.
If I plug in a USB keyboard, it works fine and I see a message on the screen that says:
Bluetooth Mouse or Trackpad Setup
There isn't a wireless mouse or trackpad connected.
I'm running 10.8.5.