peripheralman: fix uart data available api
Signed-off-by: Sanrio Alvares <sanrio.alvares@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
badf25f289
commit
d50b646c35
@@ -247,8 +247,26 @@ mraa_pman_uart_set_timeout_replace(mraa_uart_context dev, int read, int write, i
|
|||||||
static mraa_boolean_t
|
static mraa_boolean_t
|
||||||
mraa_pman_uart_data_available_replace(mraa_uart_context dev, unsigned int millis)
|
mraa_pman_uart_data_available_replace(mraa_uart_context dev, unsigned int millis)
|
||||||
{
|
{
|
||||||
// FIXME! We probably should say yes sometimes ;-)
|
int fd = -1;
|
||||||
return 0;
|
|
||||||
|
if (AUartDevice_getPollingFd(dev->buart, &fd)) {
|
||||||
|
syslog(LOG_ERR, "peripheralman: failed to get the fd");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct pollfd poller = {
|
||||||
|
.fd = fd,
|
||||||
|
.events = POLLIN | POLLERR,
|
||||||
|
.revents = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (poll(&poller, 1, millis) > 0) {
|
||||||
|
syslog(LOG_INFO, "peripheralman: received an event");
|
||||||
|
AUartDevice_ackInputEvent(fd);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static mraa_result_t
|
static mraa_result_t
|
||||||
|
|||||||
Reference in New Issue
Block a user