Recent

Author Topic: GetMonitorsInfo - please help update the database  (Read 1929 times)

domasz

  • Sr. Member
  • ****
  • Posts: 437
GetMonitorsInfo - please help update the database
« on: November 12, 2022, 01:27:51 pm »
With help from the forum users I created a small library to get PPI, resolutions and diameters of monitors.
I created a Github repository for the library (MIT licence):
https://github.com/PascalVault/GetMonitorsInfo

Monitors also return a 3-letter manufacturer code. I used the list from:
https://uefi.org/pnp_id_list
which is supposed to be an official list of all 3-letter codes but I noticed it lacks many companies so I started adding them manually.

If you have a few seconds please download the sample project:
https://github.com/PascalVault/GetMonitorsInfo
run it and paste here contents of Memo1 if:
1) returned values are not valid for you
OR
2) instead of full manufacturer name you only see 3-letter code

The library works only on Windows since it grabs EDID data from the Registry.

kirchfritz

  • Jr. Member
  • **
  • Posts: 53
  • WIN10 LAZ 2.2.4 FPC 3.2.2
Re: GetMonitorsInfo - please help update the database
« Reply #1 on: November 12, 2022, 07:16:04 pm »
This is my HP-Notebook-Monitor:
Monitor: #0
Resolution: 1920 x 1080 px
Size: 34,40 x 19,30 cm
Diag: 15,53 inch
PPI: 141,86
Dot Pitch: 0,18 mm
Aspect Ratio: 16:9 (1,78:1)
Year: 2017
Manufacturer: DO NOT USE - AUO
PNP: AUO38ED
-----------
 

domasz

  • Sr. Member
  • ****
  • Posts: 437
Re: GetMonitorsInfo - please help update the database
« Reply #2 on: November 12, 2022, 09:42:27 pm »
Manufacturer: DO NOT USE - AUO
Thanks! That's a weird one. I updated the code.

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: GetMonitorsInfo - please help update the database
« Reply #3 on: November 12, 2022, 11:44:44 pm »
Just cloned your repo and noticed that it does not compile due to missing closing string quotes in the company list at 'AUO'.

sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
Re: GetMonitorsInfo - please help update the database
« Reply #4 on: November 13, 2022, 01:01:23 am »
Laptop Lenovo:

Monitor: #0
Resolution: 1920 x 1080 px
Size: 34,40 x 19,40 cm
Diag: 15,55 inch
PPI: 141,68
Dot Pitch: 0,18 mm
Aspect Ratio: 16:9 (1,77:1)
Year: 2018
Manufacturer: BOE
PNP: BOE0812
-----------
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9900
  • Debugger - SynEdit - and more
    • wiki
Re: GetMonitorsInfo - please help update the database
« Reply #5 on: November 13, 2022, 01:05:22 am »
Monitors also return a 3-letter manufacturer code. I used the list from:
https://uefi.org/pnp_id_list
which is supposed to be an official list of all 3-letter codes but I noticed it lacks many companies so I started adding them manually.

There is another list (probably many...)
https://github.com/linuxhw/EDID


IT has the BOE08112 https://github.com/linuxhw/EDID/blob/master/Digital/BOE/BOE0812/27B7A857515D
« Last Edit: November 13, 2022, 01:10:55 am by Martin_fr »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2079
  • Fifty shades of code.
    • Delphi & FreePascal
Re: GetMonitorsInfo - please help update the database
« Reply #6 on: November 13, 2022, 03:29:52 am »
Code: Pascal  [Select][+][-]
  1. program MdTo;
  2.  
  3. {$APPTYPE CONSOLE}
  4. {$R *.res}
  5.  
  6. uses
  7.   Windows, SysUtils, Classes, uStreamIO;
  8.  
  9. type
  10.   TInfo = packed record
  11.     Short,
  12.     Full: string;
  13.   end;
  14.   TInfos = array of TInfo;
  15.  
  16. function AddRecord(var AInfos: TInfos; const AShort, AFull: string): Boolean;
  17. var
  18.   Len: Integer;
  19.   i: Integer;
  20. begin
  21.   Len := Length(AInfos);
  22.   Result := False;
  23.   for i := Low(AInfos) to High(AInfos) do
  24.     if ((AInfos[i].Short = AShort) and (AInfos[i].Full = AFull)) then
  25.       Exit;
  26.   SetLength(AInfos, Succ(Len));
  27.   AInfos[Len].Short := AShort;
  28.   AInfos[Len].Full := AFull;
  29.   Result := Len < Length(AInfos);
  30. end;
  31.  
  32. function ConvertList(const AFilename: string; var AInfos: TInfos): Boolean;
  33. var
  34.   stream: TFileStream;
  35.   F: Textfile;
  36.   s: String;
  37.   i: Integer;
  38.   cnt: Integer;
  39.   GotData: Boolean;
  40.   b1: Boolean;
  41.   s1, s2: string;
  42. Begin
  43.   Result := False;
  44.   stream := TFilestream.Create(AFilename, fmOpenRead or fmShareDenyNone );
  45.   try
  46.     AssignStream(F, stream);
  47.     Reset(F);
  48.     try
  49.       repeat
  50.         ReadLn(F, s);
  51.         cnt := 0;
  52.         b1 := False;
  53.         s1 := '';
  54.         s2 := '';
  55.         GotData := False;
  56.         if (Pos('|', s) = 1) then
  57.           for i := 1 to Length(s) do
  58.             begin
  59.               if s[i] = '|' then
  60.                 inc(cnt);
  61.               if ((not b1) and (s[i] <> '|')) then
  62.                 s1 := s1 + s[i];
  63.               if cnt > 1 then
  64.                 b1 := True;
  65.               if (b1 and (s[i] <> '|') and (Length(s2) <= 3)) then
  66.                 s2 := s2 + s[i];
  67.               if cnt >= 3 then
  68.                 begin
  69.                   GotData := ((s1 <> '') or (s2 <> ''));
  70.                   Break;
  71.                 end;
  72.             end;
  73.         if GotData then
  74.           begin
  75.             s1 := Trim(s1);
  76.             s2 := Trim(s2);
  77.             if ((s2 <> 'Mod') and (s2 <> '----')) then
  78.               AddRecord(AInfos, s2, s1);
  79.           end;
  80.       until EOF(F);
  81.     finally
  82.       CloseFile(F);
  83.     end;
  84.   finally
  85.     stream.Free;
  86.     Result := (Length(AInfos) > 0)
  87.   end;
  88. end;
  89.  
  90. function WriteList(const AFilename: string; const AInfos: TInfos): Boolean;
  91. begin
  92.  
  93. end;
  94.  
  95. var
  96.   sl: TInfos;
  97.   fn: string;
  98.   i: Integer;
  99. begin
  100.   WriteLn('MonitorInfo extractor by KodeZwerg.');
  101.  
  102.   SetLength(sl, 0);
  103.   fn := 'AnalogDisplay.md';
  104.   if ConvertList(ExtractFilePath(ParamStr(0)) + fn, sl) then
  105.     begin
  106.       WriteLn(fn, ' successful read ', Length(sl), ' entries.');
  107.       for i := Low(sl) to High(sl) do
  108.         WriteLn('[', sl[i].Short, '] - [', sl[i].Full, ']');
  109.       WriteLn(fn, ' successful read ', Length(sl), ' entries.');
  110.     end;
  111.  
  112.   SetLength(sl, 0);
  113.   fn := 'DigitalDisplay.md';
  114.   if ConvertList(ExtractFilePath(ParamStr(0)) + fn, sl) then
  115.     begin
  116.       WriteLn(fn, ' successful read ', Length(sl), ' entries.');
  117.       for i := Low(sl) to High(sl) do
  118.         WriteLn('[', sl[i].Short, '] - [', sl[i].Full, ']');
  119.       WriteLn(fn, ' successful read ', Length(sl), ' entries.');
  120.     end;
  121.   ReadLn;
  122. end.
  123.  
Here is a template to convert the files from
https://raw.githubusercontent.com/linuxhw/EDID/master/AnalogDisplay.md
and
https://raw.githubusercontent.com/linuxhw/EDID/master/DigitalDisplay.md
into the needed record format.
A write-to-file is missing since I am not that happy with the results as you can see when you execute the app.
(Basic Idea was to switch from internal usage to .inc file format for the class string definitions.)
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

domasz

  • Sr. Member
  • ****
  • Posts: 437
Re: GetMonitorsInfo - please help update the database
« Reply #7 on: November 13, 2022, 01:08:29 pm »
There is another list (probably many...)
https://github.com/linuxhw/EDID
Thanks! I looked for other lists but they were just copies of the official one. I even e-mailed the guys behind the official one but I haven't heard from them yet.

domasz

  • Sr. Member
  • ****
  • Posts: 437
Re: GetMonitorsInfo - please help update the database
« Reply #8 on: November 13, 2022, 01:10:06 pm »
Here is a template to convert the files from
https://raw.githubusercontent.com/linuxhw/EDID/master/AnalogDisplay.md
and
https://raw.githubusercontent.com/linuxhw/EDID/master/DigitalDisplay.md
into the needed record format.
Thank you! I updated the code and now there are 2674 companies.
« Last Edit: November 13, 2022, 01:54:49 pm by domasz »

domasz

  • Sr. Member
  • ****
  • Posts: 437
Re: GetMonitorsInfo - please help update the database
« Reply #9 on: November 13, 2022, 02:04:25 pm »
Just cloned your repo and noticed that it does not compile due to missing closing string quotes in the company list at 'AUO'.
Thanks, fixed.

Manufacturer: BOE
PNP: BOE0812
-----------
Thank you! Added to the DB as "BOE Technology Group Co., Ltd"

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2079
  • Fifty shades of code.
    • Delphi & FreePascal
Re: GetMonitorsInfo - please help update the database
« Reply #10 on: November 14, 2022, 01:53:07 am »
Updated, sorry I missed your manual changes, in attached archive you have all the important files.
Whats changed:
Renamed my tool into "MonitorListImport".
Added support to add all above named sources to be converted.
Added save/generate new "uMonitorInfo.inc" file feature.

removed from original unit the complete string company 3 digit code stuff and replaced with a simple {$I}
(now source is also better readable, less scrolling...)

Now updates are more easy to handle is my thinking (outside of code, in its own file),
I would like to add a 4th list called "Overwrite.txt", for manual changes that are not included in above "master"-files,
to keep list updated after generated from scratch.

Thanks domasz for inventing.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

domasz

  • Sr. Member
  • ****
  • Posts: 437
Re: GetMonitorsInfo - please help update the database
« Reply #11 on: November 14, 2022, 09:37:30 am »
Updated, sorry I missed your manual changes, in attached archive you have all the important files.
Your database is not sorted so it won't work properly. There is a binary search function which requires sorted data.
https://github.com/PascalVault/GetMonitorsInfo/blob/main/uMonitorInfo.pas
Also syncing automatically with the Linux EDID repo makes little sense because the repo is of poor quality and I'm going to manually update everything from the repo.
« Last Edit: November 14, 2022, 09:44:32 am by domasz »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2079
  • Fifty shades of code.
    • Delphi & FreePascal
Re: GetMonitorsInfo - please help update the database
« Reply #12 on: November 14, 2022, 11:52:55 am »
Your database is not sorted so it won't work properly. There is a binary search function which requires sorted data.
Updated again. Whats new?
- output from all 3 supplier files are now sorted
- fixed little string bugs that the original lists had (html text attributes)
- fixed a small bug of me where my app created, for unknown reason, longer than 3 chars identifiers

Also syncing automatically with the Linux EDID repo makes little sense because the repo is of poor quality and I'm going to manually update everything from the repo.
More is better, no?
And for your manual update, exact for that I told I would need a 4th file that can be loaded in as first file in the converter app...

Okies, enjoy or delete, from my side its looking final now to me (the converter app)
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2079
  • Fifty shades of code.
    • Delphi & FreePascal
Re: GetMonitorsInfo - please help update the database
« Reply #13 on: November 14, 2022, 12:02:32 pm »
And a small note, your current list has exemplary as first entry:
(Short: '"VQ'; Full: 'Vision Quest'),
what is incorrect, it should be
(Short: 'VQ@'; Full: 'Vision Quest'),

(my current converter fix all errors like such.)
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: GetMonitorsInfo - please help update the database
« Reply #14 on: December 20, 2022, 08:48:01 am »
I attach a project which has some small changes and optimisations, removing redundant code, and cleaning up the Manufacturer database (removing some obvious typos, lowercase codes etc.)
This is now recast as an enormous jump table, giving almost instantaneous lookup for the 3-character manufacturer code.
Note that as in earlier offerings this is Windows-only code, dependent on Registry entries being correctly populated.
« Last Edit: December 20, 2022, 01:04:12 pm by howardpc »

 

TinyPortal © 2005-2018