Skip to content

Commit

Permalink
gps: reopen the gps port on failed auto-detection
Browse files Browse the repository at this point in the history
work-around for #9461
  • Loading branch information
bkueng authored and LorenzMeier committed Jun 7, 2018
1 parent f87fa91 commit a62a71f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/drivers/gps/gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,17 @@ GPS::run()
case GPS_DRIVER_MODE_ASHTECH:
_mode = GPS_DRIVER_MODE_UBX;
usleep(500000); // tried all possible drivers. Wait a bit before next round

//FIXME: reopen the uart to work around an issue where the gps is not detected
// sometimes on startup on the mRo X2.1 board (see https://github.com/PX4/Firmware/issues/9461)
close(_serial_fd);
_serial_fd = ::open(_port, O_RDWR | O_NOCTTY);

if (_serial_fd < 0) {
PX4_ERR("failed to reopen the UART (%i)", errno);
request_stop();
}

break;

default:
Expand Down

0 comments on commit a62a71f

Please sign in to comment.