Nitrokey / libnitrokey

Communicate with Nitrokey devices in a clean and easy manner
https://nitrokey.com/
GNU Lesser General Public License v3.0
65 stars 34 forks source link

Improve get_SD_usage_data function #187

Open robinkrahl opened 4 years ago

robinkrahl commented 4 years ago

Also, the documentation should be improved:

szszszsz commented 4 years ago

Hi! Good questions! Will check

szszszsz commented 4 years ago

According to the Nitrokey Storage firmware, the reads are exclusive, hence the values range probably [1].

In my understanding use case is to provide minimum/maximum range, where the data could be safely stored, thus the +1/-1 from the limits. E.g. there are some writes in the beginning of the SD card, in the very first percentile, region 0%-1%, so the value returned will be 1%. Value 0% would not have meaning here. Maybe could be useful to show that the write has not been executed in this power cycle yet, but this will bring unnecessary complexity.

[1] https://github.com/Nitrokey/nitrokey-storage-firmware/blob/f66b2e63582312717b7e45ce078b3b8fd869c51d/src/OTP/report_protocol.c#L2658