eclipse / upm

UPM is a high level repository that provides software drivers for a wide variety of commonly used sensors and actuators. These software drivers interact with the underlying hardware platform through calls to MRAA APIs.
MIT License
659 stars 411 forks source link

ZFM20: mraa_uart_init() failed #621

Closed Mohamad777 closed 6 years ago

Mohamad777 commented 6 years ago

I get the following error when I use upm::ZFM20 fp(0); in running time (C++):

terminate called after throwing an instance of 'std::invalid_argument'
   what():  ZFM20: mraa_uart_init() failed

I've found that it may be because of the code bellow from mraa library (It means I get the error message "uart: device path undefined" in syslog:

mraa_uart_init_raw(const char* path)
{
    mraa_result_t status = MRAA_SUCCESS;
    mraa_uart_context dev = NULL;

    if (!path) {
        syslog(LOG_ERR, "uart: device path undefined");
        status = MRAA_ERROR_INVALID_PARAMETER;
        goto init_raw_cleanup;
    }
...

In mraa library I can solve the problem by using mraa_uart_init_raw("/dev/ttyXXX"). But here I don't have access to modify the code, and ZFM20 just gets int argument.

Would yo please help me solve this problem?

Is it possible to change the source code of the library to solve this problem?

Thanks in advance.

Propanu commented 6 years ago

Hi @Mohamad777, what board are you running this on? I can merge #587 from @pylbert which adds several improvements to this library and there shouldn't be an issue adding the extra string based constructor to initialize raw devices directly.