Device-LaCrosse-WS23xx
view release on metacpan or search on metacpan
int portstatus, fdflags;
PPCODE:
//Setup serial port
if ((fh = open(path, O_RDWR | O_NONBLOCK | O_SYNC)) < 0)
{
// fprintf(stderr,"\nUnable to open serial device %s\n", path);
XSRETURN_UNDEF;
}
if ( flock(fh, LOCK_EX|LOCK_NB) < 0 ) {
fprintf(stderr,"Serial device is locked by other program\n");
close(fh);
XSRETURN_UNDEF;
}
if ((fdflags = fcntl(fh, F_GETFL)) == -1 ||
fcntl(fh, F_SETFL, fdflags & ~O_NONBLOCK) < 0)
{
perror("couldn't reset non-blocking mode");
exit(EXIT_FAILURE);
}
( run in 0.269 second using v1.01-cache-2.11-cpan-49f99fa48dc )