Ulpm adc bootSource invalid argument

Hi

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.

Kind regards

Andreas

Hi @andcor

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.

I did a test on my unit:

# echo 1799.99 > /sys/module/swimcu_pm/boot_source/adc/adc2/below
sh: write error: Invalid argument

Do you also get “Invalid argument” when you perform the same test or do you get a different result?

Sorry for the late answer, christmas holidays got in the way

Yes that is exactly what I see. I, however don’t see that the legato app tries again with integer parameters.

hi @andcor,
did you solve your issue?
best regards,

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.

HI @andcor,
this case has been raised internally to investigate;
keep you inform
BR