Private
Public Access
2
0

mraa.c: return MRAA_SUCCESS when trying to call mraa_add_subplatform twice

If we already have a subplatform present with the same type, return success
when trying to add it again. We don't check that the tty is the same because
that is hidden inside the t_firmata* structure but we should do at some point

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2016-10-11 13:58:39 +01:00
parent 08e270818a
commit 980dfce80e

View File

@@ -1027,8 +1027,12 @@ mraa_add_subplatform(mraa_platform_t subplatformtype, const char* uart_dev)
#if defined(FIRMATA)
if (subplatformtype == MRAA_GENERIC_FIRMATA) {
if (plat->sub_platform != NULL) {
syslog(LOG_NOTICE, "mraa: Failed to add firmata subplatform");
return MRAA_ERROR_INVALID_PARAMETER;
if (plat->sub_platform->platform_type == subplatformtype) {
syslog(LOG_NOTICE, "mraa: Firmata subplatform already present");
return MRAA_SUCCESS;
}
syslog(LOG_NOTICE, "mraa: We don't support multiple firmata subplatforms!");
return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
}
if (mraa_firmata_platform(plat, uart_dev) == MRAA_GENERIC_FIRMATA) {
syslog(LOG_NOTICE, "mraa: Added firmata subplatform");