I propose that for usb-based devices, calibre creates and maintains a file devinfo.calibre containing the following dict:
Code:
devstatus_calibre = {
'uuid' : None,
'calibre_version' : None,
'date_last_changed' : None,
}
Should there be anything else in the dict?
Details:
The device driver (usbms) will read the dict from the file when the device connects (in usbms.device.open), initializing the dict if it does not exist. It will update the file at the end of sync_booklists. A new interface function get_devstatus will be provided to fetch the dict. The interface function will not start a job. An API will be added to the device manager to call it.
The file will be JSON-encoded. Sample code is under the spoiler:
Design constraints:
1) there can be no data in the dict requiring interaction with the user.
2) the data must be JSON-serializable
3) the dict must be small (less than 512 bytes) and complexity must be low to avoid out-of-space errors or corruption-on-write problems.
4) calibre must be able to survive the file disappearing or being corrupted.