I'm tryin to get the serial number of an Acer monitor looking into the windows registry. I'm parsing the registry with this code in Python 3:
import winreg
from winreg import HKEY_LOCAL_MACHINE
subKey = "SYSTEM\CurrentControlSet\Enum\DISPLAY"
k = winreg.OpenKey(HKEY_LOCAL_MACHINE, subKey)
with winreg.OpenKey(HKEY_LOCAL_MACHINE, subKey) as k:
""""
Open the key 'HKLM\SYSTEM\CurrentControlSet\Enum\DISPLAY'
to get the info of all connected monitors
"""
i = 0
while True:
try:
with winreg.OpenKey(k, winreg.EnumKey(k, i)) as sk:
j = 0
while True:
try:
with winreg.OpenKey(sk, winreg.EnumKey(sk, j)) as ssk:
l = 0
while True:
try:
if (winreg.EnumKey(ssk, l) == "Control"):
try:
with winreg.OpenKey(ssk, "Device Parameters") as sssk:
strEDID = str(winreg.EnumValue(sssk, 0)[1])
try:
modelo = strEDID[strEDID.index("\\x00\\x00\\x00\\xfc") + len("\\x00\\x00\\x00\\xfc\\x00"):].split("\\")[0]
serie = strEDID[strEDID.index("\\x00\\x00\\x00\\xff") + len("\\x00\\x00\\x00\\xff\\x00"):].split("\\")[0]
except:
modelo = "Not Found"
serie = "Not Found"
print ("Modelo:", modelo)
print ("Serie:", serie, "\n")
fo = open("salTest.txt", "a")
fo.write(modelo + "\n")
fo.write(serie + "\n\n")
fo.close()
except OSError:
print ("Error")
break
else:
l += 1
except OSError:
break
j += 1
except OSError:
break
i += 1
except OSError:
break
As result i get an output in the cmd window like this:
Modelo: AL1716
Serie: L4802017396L
The problem is that the "Serie" isn't the real serial number (an Acer monitor serial number have 22 characters and looks like "ETL480201781700F4B396L")
There is a way to build the real serial number with the "Serie" and the SNID that identify the monitor too.
Here is an example of two Acer monitors:
S/N ORIGINAL: ETL48020178170 (0F4B)396L | # ETL480201781700F4B396L
------------------------------------------------------------------------------------
SNID: 8170 (0F4B)=03915 | 39 # 81700391539
S/N FROM SCRIPT: L4802017 396L | # L4802017396L
S/N ORIGINAL: ETL48020178170 (2C98)396L | # ETL480201781702C98396L
------------------------------------------------------------------------------------
SNID: 8170 (2C98)=11416 | 39 # 81701141639
S/N FROM SCRIPT: L4802017 396L | # L4802017396L
Anyone know how to get this info?
Thanks!