Private
Public Access
2
0

chardev: boards need to specify chardev support explicitly before runtime check is performed

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Mihai Tudor Panu
2018-03-14 12:37:41 -07:00
parent 7021096fd7
commit cf2e69a8ea
2 changed files with 9 additions and 3 deletions

View File

@@ -102,16 +102,21 @@ mraa_set_log_level(int level)
mraa_boolean_t mraa_is_kernel_chardev_interface_compatible()
{
if (mraa_get_number_of_gpio_chips() <= 0) {
syslog(LOG_NOTICE, "gpio: platform supports chardev but kernel doesn't, falling back to sysfs");
return 0;
}
return 1;
}
/* TODO: Add all relevant checks here and return the overall result. */
mraa_boolean_t mraa_is_platform_chardev_interface_capable()
{
return mraa_is_kernel_chardev_interface_compatible();
if (plat->chardev_capable) {
return mraa_is_kernel_chardev_interface_compatible();
}
syslog(LOG_NOTICE, "gpio: platform doesn't support chardev, falling back to sysfs");
return 0;
}
/**
@@ -236,7 +241,7 @@ imraa_init()
plat->chardev_capable = mraa_is_platform_chardev_interface_capable();
if (plat->chardev_capable) {
syslog(LOG_NOTICE, "libmraa: support for chardev interface is activated");
syslog(LOG_NOTICE, "gpio: support for chardev interface is activated");
}
syslog(LOG_NOTICE, "libmraa initialised for platform '%s' of type %d", mraa_get_platform_name(), mraa_get_platform_type());

View File

@@ -43,6 +43,7 @@ mraa_joule_expansion_board()
b->platform_name = PLATFORM_NAME;
b->phy_pin_count = MRAA_INTEL_JOULE_EXPANSION_PINCOUNT;
b->chardev_capable = 1;
b->aio_count = 0;
b->adc_raw = 0;
b->adc_supported = 0;