[add writing events Evan Martin **20060216074952] { hunk ./PowerMate.hsc 46 +eventSize = #{size struct input_event} + hunk ./PowerMate.hsc 50 - allocaBytes size $ \buf -> do - readsize <- hGetBuf handle buf size + allocaBytes eventSize $ \buf -> do + readsize <- hGetBuf handle buf eventSize hunk ./PowerMate.hsc 58 - where size = #{size struct input_event} hunk ./PowerMate.hsc 69 +writeEvent :: Handle -> Word16 -> Word16 -> Int32 -> IO () +writeEvent handle typ code value = do + allocaBytes eventSize $ \buf -> do + #{poke struct input_event, type} buf typ + #{poke struct input_event, code} buf code + #{poke struct input_event, value} buf value + hPutBuf handle buf eventSize }