You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed that on first try, the startup.py script tries to find a pi.id file that if it is not on the directory it will create it with and random generated key and then expands the filesystem.
There are 2 things that caught my mind:
1 - Why expanding the filesystem if the file is not present? Is there a reason why the filesystem should be expanded if the file is not on the directory?
2 - If the idea of the of the id_generator() method is to create a unique, let's say, serial number maybe we can use the information on the board itself to get the unique id directly from hardware Something like this:
defid_generator():
# Extract serial from cpuinfo filecpuserial="0000000000000000"try:
f=open('/proc/cpuinfo','r')
forlineinf:
ifline[0:6]=='Serial':
cpuserial=line[10:26]
f.close()
except:
cpuserial="ERROR000000000"returncpuserial
We can even have a mix that if the try block fails we can generate it by the method you have implemented, so on the first blocks it will return the real unique serial number and in the second block it will generate it as it is generating it until now.
Best regards.
The text was updated successfully, but these errors were encountered:
IMO I don't think it is of such importance for the ID to really be unique as it is used only to get the IP and that's it. Of course serial number could work too but I consider it overkill considering the id_generator already exists.
@ilirb thanks for your comment, just wanted to help on this project and I thought maybe it was necessary to have real unique identifier. If this is not important then we can dismiss the changes.
Hello @schollz,
I have noticed that on first try, the
startup.py
script tries to find api.id
file that if it is not on the directory it will create it with and random generated key and then expands the filesystem.There are 2 things that caught my mind:
1 - Why expanding the filesystem if the file is not present? Is there a reason why the filesystem should be expanded if the file is not on the directory?
2 - If the idea of the of the
id_generator()
method is to create a unique, let's say, serial number maybe we can use the information on the board itself to get the unique id directly from hardware Something like this:We can even have a mix that if the
try
block fails we can generate it by the method you have implemented, so on the first blocks it will return the real unique serial number and in the second block it will generate it as it is generating it until now.Best regards.
The text was updated successfully, but these errors were encountered: