// Does the system allows us to place a lock on this file descriptor
if (fcntl(sp->fd, F_SETLK, &fl) == -1) {
// A conflicting lock is held by another process
+ free(sp);
return CLAIMED_SERIAL_PORT;
}
fl.l_start = 0;
fl.l_len = 0;
fl.l_pid = getpid();
- fcntl(spu->fd, F_SETLK, &fl);
+
+ // Does the system allows us to place a lock on this file descriptor
+ int err = fcntl(spu->fd, F_SETLK, &fl);
+ if ( err == -1) {
+ //perror("fcntl");
+ }
close(spu->fd);
free(sp);
}
// Prepare the device control
memset(&sp->dcb, 0, sizeof(DCB));
sp->dcb.DCBlength = sizeof(DCB);
- if(!BuildCommDCBA("baud=9600 data=8 parity=N stop=1",&sp->dcb)) {
- uart_close(sp);
- return INVALID_SERIAL_PORT;
- }
+ if(!BuildCommDCBA("baud=115200 parity=N data=8 stop=1",&sp->dcb)) {
+ uart_close(sp);
+ return INVALID_SERIAL_PORT;
+ }
// Update the active serial port
if(!SetCommState(sp->hPort,&sp->dcb)) {