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:
@@ -1027,8 +1027,12 @@ mraa_add_subplatform(mraa_platform_t subplatformtype, const char* uart_dev)
|
|||||||
#if defined(FIRMATA)
|
#if defined(FIRMATA)
|
||||||
if (subplatformtype == MRAA_GENERIC_FIRMATA) {
|
if (subplatformtype == MRAA_GENERIC_FIRMATA) {
|
||||||
if (plat->sub_platform != NULL) {
|
if (plat->sub_platform != NULL) {
|
||||||
syslog(LOG_NOTICE, "mraa: Failed to add firmata subplatform");
|
if (plat->sub_platform->platform_type == subplatformtype) {
|
||||||
return MRAA_ERROR_INVALID_PARAMETER;
|
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) {
|
if (mraa_firmata_platform(plat, uart_dev) == MRAA_GENERIC_FIRMATA) {
|
||||||
syslog(LOG_NOTICE, "mraa: Added firmata subplatform");
|
syslog(LOG_NOTICE, "mraa: Added firmata subplatform");
|
||||||
|
|||||||
Reference in New Issue
Block a user