ddcctl icon indicating copy to clipboard operation
ddcctl copied to clipboard

Error: Failed to parse WindowServer's preferences

Open detlefs opened this issue 4 years ago • 17 comments

Running the tool I get the following output:

sudo ./ddcctl -d 1 -i 17                                                                                                                             
D: CGDisplay 51EAD488-736E-344F-3D19-FC1626C9B248 dispID(#1) (3440x1440 0°) 109.00 DPI
I: found 1 external display
E: Failed to parse WindowServer's preferences! (/Library/Preferences/com.apple.windowserver.plist)
I: polling EDID for #1 (ID 1 => (null))
E: Failed to poll display!

I'm using a M1 Mac mini with macOS Big Sur (11.1) I downloaded the latest release of the tool.

I couldn't find a file /Library/Preferences/com.apple.windowserver.plist on my system, but a file /Library/Preferences/com.apple.windowserver.displays.plist. Maybe the name was changed for Big Sur?

Running it with -h option, I get the following result:

sudo ./ddcctl -h                                                                                                                                     
D: CGDisplay 51EAD488-736E-344F-3D19-FC1626C9B248 dispID(#1) (3440x1440 0°) 109.00 DPI
I: found 1 external display
2021-01-20 11:28:45.833 ddcctl[27476:1447428] ddcctl 0.1x - Usage:
...

detlefs avatar Jan 20 '21 12:01 detlefs

Same issue here on Mac Mini M1 2020, MacOS Big Sur 11.1.

I'm not a native development expert, but for me, it looks like the reason for this is this hardcoded string in there:

https://github.com/kfix/ddcctl/blob/72c1f3413776b3758177d104ae92cf22ce410aac/src/ddcctl.m#L50

wich either should be a system variable, or, if no system variable exists, it should search check which macos version is being used and then decide which path it should take.

I will try to build it my own and if it works, I post the results in here.

madebyfabian avatar Feb 06 '21 15:02 madebyfabian

Is this fixable without a new release version?

kmplngj avatar Feb 07 '21 15:02 kmplngj

It seems to be not only the filename. It seems that com.apple.windowserver.displays.plist doesn't contain the structure/values required by the function. There is no DisplayID or IODisplayLocation in my file. I think it's necessary to find a new way to determine the display device location value

detlefs avatar Feb 10 '21 08:02 detlefs

In line with what you said, @detlefs, I symlinked the plist file to the old path and now I'm getting this error:

D: CGDisplay 166D886F-5A17-0E35-0857-D6964E3302DB dispID(#2) (3840x2160 0°) 139.00 DPI
I: found 1 external display
2021-05-12 12:55:43.827 ddcctl[32394:966897] -[NSTaggedPointerString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0xb3e44e1fb7bdd192
2021-05-12 12:55:43.827 ddcctl[32394:966897] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0xb3e44e1fb7bdd192'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000018640e320 __exceptionPreprocess + 240
	1   libobjc.A.dylib                     0x000000018613cc04 objc_exception_throw + 60
	2   CoreFoundation                      0x000000018649d020 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x0000000186370184 ___forwarding___ + 1444
	4   CoreFoundation                      0x000000018636fb30 _CF_forwarding_prep_0 + 96
	5   ddcctl                              0x00000001029097e0 getDisplayDeviceLocation + 280
	6   ddcctl                              0x000000010290a9ec main + 3368
	7   libdyld.dylib                       0x00000001862b1f34 start + 4
)
libc++abi.dylib: terminating with uncaught exception of type NSException

So it looks like the problem is deeper...a bit beyond me...

tslater avatar May 12 '21 18:05 tslater

Seems to be a sub-issue of #86

coriolanweihrauch avatar May 13 '21 13:05 coriolanweihrauch

I think I'm gonna rip this stuff out.

FWIW, the 1st part of it (file finding) works on my Catalina -> Big Sur MacBook, which doesn't have the .displays.plist file being mentioned.

kfix avatar Aug 15 '21 19:08 kfix

Same here on m1 Air running Monterey. I do have /Library/Preferences/com.apple.windowserver.displays.plist file, but not the /Library/Preferences/com.apple.windowserver.plist

Tried to create a symlink, to no avail:

➜  ~ ddcctl -d 1 -b 90
D: CGDisplay EE5E12D7-D9C0-0B13-0857-D6964E3302DB dispID(#2) (2560x1440 0°) HiDPI
I: found 1 external display
2022-09-20 12:36:03.836 ddcctl[19646:15501860] -[NSTaggedPointerString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x8af6716c9b7372ed
2022-09-20 12:36:03.841 ddcctl[19646:15501860] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x8af6716c9b7372ed'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001b9125198 __exceptionPreprocess + 240
	1   libobjc.A.dylib                     0x00000001b8e6fe04 objc_exception_throw + 60
	2   CoreFoundation                      0x00000001b91b8f40 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00000001b9084544 ___forwarding___ + 1764
	4   CoreFoundation                      0x00000001b9083da0 _CF_forwarding_prep_0 + 96
	5   ddcctl                              0x0000000102ba9b8c getDisplayDeviceLocation + 272
	6   ddcctl                              0x0000000102baabfc main + 2952
	7   dyld                                0x0000000102d5908c start + 520
)
libc++abi: terminating with uncaught exception of type NSException
[1]    19646 abort      ddcctl -d 1 -b 90
➜  ~

yellowmegaman avatar Sep 20 '22 09:09 yellowmegaman

FWIW, this works fine on my 2018 intel mac mini, which has the com.apple.windowserver.plist file.

ddcctl -d 1 D: CGDisplay 5C9147A3-EDE9-AC8E-ECD5-BCFB6DD77685 dispID(#458658526) (2560x1440 0°) HiDPI I: found 1 external display I: polling EDID for #1 (ID 458658526 => IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/IGPU@2/AppleIntelFramebuffer@2) I: got edid.name: LG ULTRAFINE I: got edid.serial: 102NTSUJ3070

It does not work on my mini M2 Pro, which has the com.apple.windowserver.displays.plist file.

ddcctl -d 1
D: CGDisplay 4643CDD0-144E-44E7-B7BC-3A19BCF36B13 dispID(#1) (3840x2160 0°) 139.00 DPI D: CGDisplay 030C44D6-5FEA-44DA-93B7-64CCBCE49A5F dispID(#2) (1440x2560 90°) 122.00 DPI D: CGDisplay 61D730EA-95CB-41AE-BB6A-0D157400A71B dispID(#3) (1440x2560 90°) 122.00 DPI I: found 3 external displays E: Failed to parse WindowServer's preferences! (/Library/Preferences/com.apple.windowserver.plist) E: Failed to acquire framebuffer device for display

BurpedUpChunks avatar Feb 15 '23 21:02 BurpedUpChunks

Same error here, mac book pro 13 m1:

ddcctl -d 1

D: CGDisplay BCD9991B-F48F-8EC0-0857-D6964E3302DB dispID(#2) (1920x1080 0°) 92.00 DPI
I: found 1 external display
E: Failed to parse WindowServer's preferences! (/Library/Preferences/com.apple.windowserver.plist)
E: Failed to acquire framebuffer device for display

dchimeno avatar Oct 03 '23 08:10 dchimeno

Same here... M3 with Sonoma 14.3

% ddcctl -d 1
D: CGDisplay 57B2273F-7EE4-4CFF-A898-FFFEF81C3EC8 dispID(#4) (3840x1600 0°) 111.00 DPI
I: found 1 external display
E: Failed to parse WindowServer's preferences! (/Library/Preferences/com.apple.windowserver.plist)
E: Failed to acquire framebuffer device for display

lambda-m avatar Feb 08 '24 21:02 lambda-m

Any ETAs for fixing this? It seems like ddcctl doesn't work with ARM chips

denisidoro avatar Mar 04 '24 17:03 denisidoro

I created a symlink by running the following:

sudo ln -s /Library/Preferences/com.apple.windowserver.displays.plist /Library/Preferences/com.apple.windowserver.plist

However, now I get this:

❯ ddcctl -d 1 -b 100 -c 100 -p 1

D: CGDisplay 5578120E-96C8-400C-B72F-74B384F0EEFE dispID(#3) (1920x1080 0°) 92.00 DPI
I: found 1 external display
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0xb78938e1db1e0232'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000186e7c540 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x000000018696deb4 objc_exception_throw + 60
	2   CoreFoundation                      0x0000000186f2e124 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x0000000186de6764 ___forwarding___ + 1572
	4   CoreFoundation                      0x0000000186de6080 _CF_forwarding_prep_0 + 96
	5   ddcctl                              0x000000010260da78 getDisplayDeviceLocation + 228
	6   ddcctl                              0x000000010260e83c main + 2512
	7   dyld                                0x00000001869a90e0 start + 2360
)
libc++abi: terminating due to uncaught exception of type NSException
/Users/denis.isidoro/dotfiles/scripts/system/display: line 31: 66322 Abort trap: 6           "${args[@]}"

denisidoro avatar Mar 04 '24 17:03 denisidoro

denisidoro, I got the same kind of error. I assume the new file has a different format than the old one.

BurpedUpChunks avatar Mar 05 '24 17:03 BurpedUpChunks