mirror of
https://github.com/eclipse/upm.git
synced 2025-07-09 13:21:22 +03:00
ublox6: switch to using new mraa_uart_get_dev_path()
Signed-off-by: Jon Trulson <jtrulson@ics.com> Signed-off-by: Zion Orent <zorent@ics.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
fec3f22765
commit
809292630f
@ -29,10 +29,9 @@
|
||||
using namespace upm;
|
||||
using namespace std;
|
||||
|
||||
Ublox6::Ublox6(int uart, const char *tty) :
|
||||
m_ttyFd(-1)
|
||||
Ublox6::Ublox6(int uart)
|
||||
{
|
||||
mraa_init();
|
||||
m_ttyFd = -1;
|
||||
|
||||
if ( !(m_uart = mraa_uart_init(uart)) )
|
||||
{
|
||||
@ -40,10 +39,19 @@ Ublox6::Ublox6(int uart, const char *tty) :
|
||||
return;
|
||||
}
|
||||
|
||||
// now open the tty
|
||||
if ( (m_ttyFd = open(tty, O_RDWR)) == -1)
|
||||
// This requires a recent MRAA (1/2015)
|
||||
char *devPath = mraa_uart_get_dev_path(m_uart);
|
||||
|
||||
if (!devPath)
|
||||
{
|
||||
cerr << __FUNCTION__ << ": open of " << tty << " failed: "
|
||||
cerr << __FUNCTION__ << ": mraa_uart_get_dev_path() failed" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// now open the tty
|
||||
if ( (m_ttyFd = open(devPath, O_RDWR)) == -1)
|
||||
{
|
||||
cerr << __FUNCTION__ << ": open of " << devPath << " failed: "
|
||||
<< strerror(errno) << endl;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user