How to receive information about pressing/releasing a key on the keyboard in Haiku OS? My code is:
type
{$PACKRECORDS C}
TRawKeyInfo = record
TimeStamp : Int64;
KeyCode : DWord;
IsKeyDown : Boolean;
end;
const
KB_READ = 9999;
var
fd:LongInt;
S:TRawKeyInfo;
begin
fd:=fpopen('/dev/input/keyboard/at/0',O_RDWR);
if fd>=0 then
repeat
if LnxIoCtl(fd,KB_READ,@S)=0 then
WriteLn(S.TimeStamp,' ',S.IsKeyDown,' ',S.KeyCode)
until False;
end.
My code is not working. What am I doing wrong?
[Edited title to add Haiku.]