+ poll_fd = (gintptr) ((event_handle *)event_set->handles)[0];
+ mask = event_set->masks[0];
+
+ sp_free_event_set(event_set);
+
+ poll_events = 0;
+ if (mask & SP_EVENT_RX_READY)
+ poll_events |= G_IO_IN;
+ if (mask & SP_EVENT_TX_READY)
+ poll_events |= G_IO_OUT;
+ if (mask & SP_EVENT_ERROR)
+ poll_events |= G_IO_ERR;
+ /*
+ * Using serial->data as the key for the event source is not quite
+ * proper, as it makes it impossible to create another event source
+ * for the same serial port. However, these fixed keys will soon be
+ * removed from the API anyway, so this is OK for now.
+ */
+ return sr_session_fd_source_add(session, serial->data,
+ poll_fd, poll_events, timeout, cb, cb_data);