What the *heck* is he trying to do?!?! Obviously the access to /dev/tty
and /dev/console is denied in X. It *must* be denied in X. It may not
even be related to the terminal the user is sitting at(1)!!!
X manages the keyboard. LET IT DO IT'S JOB! If you need it to tell you
when a (specific) key is pressed globally, just grab it (XGrabKey). If
you want to know when a key is pressed and no application was
interested, listen on the root window. If you want to know when a key is
pressed when particular window has focus, listen on that window. You can
also become an input method, which sees everything that goes on on the
keyboard.
(1) There can be more than one display and more than one keyboard
attached to a computer and each may have different X-server running. But
only one of them might have any console associated. Or the console might
be on a serial port. Or you might be running on one machnie, but the
user might be sitting in front of an X-terminal half a world away...