sbabic / libubootenv

Generic library and tools to access and modify U-Boot environment from User Space
72 stars 39 forks source link

Fix file reading/writing when the environment is in EEPROM #10

Closed AdrianBunk closed 4 years ago

AdrianBunk commented 4 years ago

Trying to use fw_printenv/fw_setenv with /sys/bus/i2c/devices/0-0050/eeprom always fails for me:

$ fw_printenv Cannot read environment, using default Cannot read default environment from file $

The problem is that fileread() and filewrite() in src/uboot_env.c read/write once, and callers treat it as error if they did read/write fewer bytes than requested.

In C it is not an error if fewer bytes get read/written than requested, the caller is supposed to retry with the remaining bytes until everything is done or an error occurs.

sbabic commented 4 years ago

Hi Adrian,

patch is fine but your Signed-off-by is missing.

I just add your Signed-off based on your e-mail : Signed-off-by: Adrian Bunk bunk@stusta.de

Please check README in the project and "how to contribute" for the next time. Pull request in github are usually ignored, and patches are collected by patchworks.