We have just updated our system to the newest version of legato and yocto for wp0x devices. In doing this we now have trouble setting the adc2 as bootsource through legato. I have debugged this to a point where I can see that the le_ulpm file tries writing a decimal number to the above and below files like 800.0000 and 1800.0000 whereas it seems the driver does only support integers.
I have solved this by bypassing the ulpm layer in legato and writing directly to the files, but maybe this should be investigated further.
I wrote this code a couple of years ago. At the time, there was debate about whether the le_ulpm.api should have double or int32 typed parameters for the thresholds and whether they should be volts or millivolts. I found evidence that the sysfs files should accept floating point values based on hwmon conventions and I suggested that change, but the issue has never been resolved. The way the interface works today is that it takes a double which is expected to be in millivolts.
components/powerMgr/le_ulpm.c:le_ulpm_BootOnAdc() calls WriteAdcLevel() which first formats the argument as a floating point value with 4 decimal places and tries to write that to the sysfs file. If that write fails with LE_BAD_PARAMETER, then the value is rounded and formatted into a string as an integer. Then a second attempt is made to write to the sysfs file. This write should succeed. If you look at the WriteToSysfs() function, you will see that after the write has been attempted, an errno value of EINVAL is mapped to the LE_BAD_PARAMETER return value.
Well my issue have been solved by a workaround (I have stopped using legato for this). But I’m not certain anything has been done in the legato handling of the device drivers.