Serial numbers of displays (for snap areas)

Hi

I'm building some scripts to automatically create and manage snap areas (I have a lot of them).

It's working fine for the built-in screen (and also for sidecar iPads), but I have a problem with an external display.

(I assume that) BTT uses the display serial number to uniquely identify the screen. All tools I use in python, Swift, ioreg etc reports one serial number. But if I have BTT create a snap area on that display and export the preset, there's another serial number there.

So where does BTT get that serial from?

ioreg:

"Metadata" = {
  "ProductID"=30605,
  "BranchDeviceID"="pHDMIg",
  "Year of Manufacture"=2025,
  "SerialNumber"=811029297,
  "ProductName"="Odyssey G91SD",
  "Week of Manufacture"=17,
  "BranchDeviceOUI"=<0010fa>,
  "DFP Type"=3,
  "DFP Type Description"="HDMI",
  "ManufacturerName"="SAM"
}

BTT:

      "BTTDisplayID" : 3,
      "BTTDisplayModel" : 30605,
      "BTTDisplayResolution" : "{5120, 1440}",
      "BTTDisplayScreenFrame" : "{{-668, 2234}, {5120, 1440}}",
      "BTTDisplayScreenSize" : "{1193.1008995126147, 338.66666158040368}",
      "BTTDisplaySerialNumber" : "809845575",
      "BTTDisplayVendorID" : 19501,

If I try importing a preset using serial 811029297 it won't work, so I need to figure out how to get 809845575.

Regards
/P

I've now tried everything I can think of, without finding any reference to 809845575 anywhere, not as a decimal number, not as a hex number (0x30454347) and not as ASCII (GCE0 or 0ECG depending on endian). And I did some XOR and CRC32 magic. None of it produced 809845575.

BetterDisplay -> export display information, including EDID exports both from the OS and a direct connection.
Swift -> CoreGraphics (NSScreen,CGDisplay, CGGetOnlineDisplayList) and IOKit (IODisplayConnect)
IORegistry (AppleDisplay, EDID, tree, IODisplayConnect, DCPAVServiceProxy, IODisplayWrangler, IOHIDDevice)
system_profiler (SPDisplaysDataType, SPHardwareDataType, SPUSBDataType)
Display prefs (com.apple.windowserver)
Color sync (com.apple.colorsync.devices)
defaults (com.apple.windowserver)
Log search (DisplayServices, CoreDisplay)
File system search (plist and json files mentioning display IDs or serial numbers)

I'm running out of ideas.

I also wonder about BTTDisplayID. The built-in main display is always BTTDisplayID 1, but the other screens differ. Sometimes it's the logical 2 and 3, but I've also seen things like 1, 4 and 21.

I think I will explore asking BTT about it (through script or web API). Maybe that's the way forward.

@Andreas_Hegenberg: If you could point me to how you get the display serial, that would be a great help. Or any other way I can uniquely identify the monitor in a way that BTT will recognize when I create the bttpreset outside of BTT.