Closed mcnewton closed 8 months ago
Note I considered automatically updating the database if a v1 UID was found, but that would mean it's impossible to downgrade to v1, unless a second duplicate user was created for each card (may hit storage limits on systems with a large number of users, which would be an unexpected failure). Something automatic could be done in a later release once v2 has been out a while and v1 less likely to be found in the wild. Unfortunately it's not possible to convert a full v1 database to v2 without re-scanning cards (it should be possible to "break" the UIDs from v2 to work again in v1, though).
There are a few different automatic upgrade methods that could be used, but I think it's simplest and best to just permit old cards to work and leave it at that.
Thank you, I tried to make the upgrade to v2 as easy as possible, but I didn't notice this!
RC522 UIDs were broken in v1 - they sometimes missed '0's. This was fixed in abd0e665 and 20e4dcb7, but that means a user database from v1 will not be entirely compatible after upgrading to v2, so some users could get locked out.
To solve this we calculate both the new (correct) format and the old (broken) format. If the new format UID doesn't exist in the database we do a check for the old format as well, and continue with that if it exists. This allows a seamless upgrade to v2.