Skip to content

Commit

Permalink
Do not use buffered io channel reads for chunked device input
Browse files Browse the repository at this point in the history
The wakelock avare evdev drivers hold a wakelock only until all
clients have read all events. If buffered reads are used, we might
hit automatic suspend before having chance to obtain user space
wakelock for the duration of actually processing the input.
  • Loading branch information
spiiroin committed Nov 8, 2012
1 parent 727a59c commit da37f2e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mce-io.c
Expand Up @@ -1221,6 +1221,13 @@ gconstpointer mce_register_io_monitor_chunk(const gint fd,
/* We only read this file in binary form */
(void)g_io_channel_set_encoding(iomon->iochan, NULL, &error);

/* No buffering since we're using this for reading data from
* device drivers and need to keep the i/o state in sync
* between kernel and user space for the automatic suspend
* prevention via wakelocks to work
*/
g_io_channel_set_buffered(iomon->iochan, FALSE);

/* Reset errno,
* to avoid false positives down the line
*/
Expand Down

0 comments on commit da37f2e

Please sign in to comment.