Il 20/02/2013 13:30, Peter Crosthwaite ha scritto: > Ok, > > I do wonder why the address itselt in VMSDs however and my best guess > is the intention is that devices can modify their address at runtime > (phyiscally very possible and valid with I2C). So what happens if a > device changes the value of one of its props at runtime? E.G. in this > case what happens if my device decides to change its I2CSlave->address > in response to some arbitrary event? Will that play foul with VMSD or > can i just save the prop in my VMSD with the rest of my device state > to implement restoration of the modified prop?
Ok, in this case this would be valid, but the implementation is still a bit weird. What is the behavior on reset? Should it go back to the original value of the address? If so, you need to use a separate variable to store the initial value of the address and the current value. Then the initial value is immutable and thus not serialized; the current value instead is part of the VMState. More importantly, the reset callback can then reset the current address back to the initial value. Paolo