
On Tue, 16 Sep 2008, Wolfgang Denk wrote:
b) Guennadi, I think it would be nice, user-friendly behaviour if fw_setenv did not unconditional locking, but would instead leave the flash in the same state it found it. Do you think it would be possible to test the state first, and then perform the unlock / lock operations only when the flash sectors were already locked when fw_setenv was called?
I am not sure if this is possible with the current MTD ABI, it looks like it is not. There is a flags member in struct mtd_info_user, which can take value MTD_WRITEABLE, but I think it means something different - whether this mtd-device is writable in principle. So, it looks like the only way to find out whether the specific sector is locked is to try to write / erase it:-(
Thanks Guennadi --- Guennadi Liakhovetski, Ph.D.
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de