For a dual partition card, this appears to change the 'size' value returned by luaCB_get_partitionInfo from the size of the large partition where photos will be saved, to the size of the small (bootable) partition.
Phil.
That's partially correct. That value has nothing to do with partition info (it doesn't even return the size of a partition). Anyway, this should "fix" that.
I'm not comfortable with changing the behaviour of get_partitionInfo by adding a magic parameter, and further complicating the already messy partition code in wrappers.c.
I think it would be better to add a new Lua function to retrieve all of the SD card related information as a single table.
This would include all the data from get_partitionInfo, plus:
- free space on the photo storage partition
- sector size (although this is currently a constant I think it is worth including for completeness)
- an array of partition data, for each partition include a table with status, type, start LBA sector and sector count values
Corresponding functions in wrappers.c would return this information to the Lua code.
This way any existing script code is unaffected, and new scripts can access all of the SD card details more easily.
It can also be extended with additional data if needed.
Although this could be done by simply extending the table returned from get_partitionInfo, I think it is also worth renaming the fields to make it clearer what they are (doing this in get_partitionInfo makes it incompatible).
Field name changes could be (suggestions welcome):
- count --> partition_count
- active --> bootable_partition
- type --> bootable_partition_type
- size --> photo_partition_sizeMB
I have almost completed testing this, if there are no changes/objections I will commit over the weekend.
Phil.