bounav / open-USB-display-service-utility

Reverse engineering of the apple display service utilty
GNU General Public License v2.0
2 stars 0 forks source link

Recently calibrated 21" Apple Studio Monitor #1

Open BlueJayLouche opened 3 years ago

BlueJayLouche commented 3 years ago

Hi,

I'm writing to offer any assistance I might be able to provide calibrating 21" Apple Studio Monitor.

I purchased one a few months ago and previous owner showed me how to reform the geometry via the Display settings under Mac OSX 10.6 (snow leopard) He had an Intel Mac Pro - unsure of any other specs.

When I got home I found that none of the macs at home (Mac Pro 3.2, 2.1 and Retina Macbook Pro) would open the geometry options under display settings. I rolled one back to Snow Leopard and still nothing.

I, like you, tried qemu and got close, but I think the issue with that lies in the VGA output not emulating the Apple Display.

Finally, I have borrowed an old Power Mac G4 running OSX (Tiger maybe) and hooked it up, and voila! all geometry fixed for my Dreamcast. This took some back and forth, as the display didn't want to save the changes between input changes. I can explain the workaround if needs be - basically close Preferences with CMD+Q, whilst on the output you want to calibrate for. I also power cycled the display at that time, but I'm not sure this was necessary.

Anyway, whilst I have the G4, I'd be happy to try and capture some packets for you, but might need some assistance working out how best that would be achieved (Wireshark?).

I also purchased a cheap working eMac to try and do geometry reform from - which it needs natively, but ultimately failed to find a miniVGA-VGA adapter. there are some interesting notes HERE regarding codes sent over i2c for this unit.

Anyway, hope we can help someone in the future from going though these struggles!

bounav commented 3 years ago

Hi @BlueJayLouche

Thanks for sharing your experience with that monitor.

I've tinkered a bit with mac os 7 8 and 9 on an old powermac G4 and it's been an absolute nightmare. mac os prio to v10 was so unstable and I had so many crashes of the whole OS I kind of left that project alone for while.

It's good to know support does exists what OSX (probably limited to the powerpc version I imagine). I'll have to give it a shot.

Yes, if you can capture USB communication between the your G4 and the display that would be awesome.

Thanks for sharing the link to the eMac turned in to a CRT. Maybe was wrong in assuming the was a USB link of some sort to set the geometry. It's also possible that they send some custom RAW bytes to the CRT...?

EDIT: There is a protocol named DDE that can be used to set settings on the display such as brightness and contrast: https://en.wikipedia.org/wiki/Display_Data_Channel

It would be really cool to see if this can be taped in via programming / code...

Interesting read: https://apple.stackexchange.com/questions/61045/does-apple-support-ddc-ci-for-3rd-party-displays-via-apples-thunderbolt-to-dvi

And potentially what I'm looking for: https://github.com/jontaylor/DDC-CI-Tools-for-OS-X

pash-peezy commented 3 years ago

Hi @bounav

Just writing in here to confirm that I have recently acquired one of these monitors, and started digging into methods of fully controlling the monitor other than with the appropriate Apple machine. I can confirm that the additional settings such as geometry, etc, can be adjusted on an Intel-based Mac Pro running OS X.

Additionally, I think a solution for much wider control may be closer than expected. A specification for monitor configuration over USB with a HID device class was standardised in 1998, and is used by other displays from the period, including some of those from Apple - even those that used the proprietary ADC connector. The USB Monitor Control Class Specification can be viewed here: https://www.usb.org/sites/default/files/usbmon10_0.pdf

A user named ondrej-zary has created a Linux utility to read and control the parameters listed in the specification called usbmonctl, available here: https://github.com/ondrej-zary/usbmonctl

As you can see, it has been confirmed to work with the Apple Cinema HD Display M8536, and the USB HID device in this unit that's used for the purpose of controlling the monitor's parameters bears the identifier of 0x05ac:0x9218 - very close indeed to the identifier of the HID device you identified in the Apple Studio Display 21" of 0x9210.

Use of usbmonctl involves using -l --list to automatically find any USB monitors connected and list their available controls, then using -g to get the current value of a control, and -s to set a new value for the control.

Here are a few example uses listed for usbmonctl: usbmonctl -s O,0x01,0,0=1 // degauss usbmonctl -g F,16 // get current brightness value usbmonctl -s F,0x12=10 // set contrast to 10

As you can see in the link above, these controls correspond perfectly to the USB Monitor Control Class Specification (ie 0x12 or 12h is listed as the value for Contrast), and as the Apple Cinema HD Display can be successfully controlled in this way, we know that some Apple monitors that use USB for configuration appear to comply with this specification. While the Cinema HD Display is an LCD monitor, requiring far fewer controls, the specification classifies a huge list of geometry controls, and this utility should allow for their adjustment - as it would appear to have for others that have used this utility to control their CRTs from other manufacturers.

The Cinema HD Display I mentioned is an ADC model, but was tested using Apple's own ADC -> DVI adapter. Essentially, this adapter just splits the ADC connection back up into it's separated parts, one of which is a USB connection.

So, it's my guess that if you're able to boot up a Linux installation and follow the readme to use this utility, you should be able to control your Studio Display fully, albeit via a command line. If this does work, it would be fantastic to have it ported to Windows with a GUI eventually!

I'm waiting on a DisplayPort to VGA adapter before I can connect this monitor to my machine, which should arrive within a week or so. I'll be trying this myself then, but please do let me know how you go in the meantime!

Best, Joseph

BlueJayLouche commented 3 years ago

Wow. This is a game changer for me. Thank you Joseph. I can't wait to test it.

On Tue, 8 Jun 2021 at 18:01, pash-peezy @.***> wrote:

Hi @bounav https://github.com/bounav

Just writing in here to confirm that I have recently acquired one of these monitors, and started digging into methods of fully controlling the monitor other than with the appropriate Apple machine. I can confirm that the additional settings such as geometry, etc, can be adjusted on an Intel-based Mac Pro running OS X.

Additionally, I think a solution for much wider control may be closer than expected. A specification for monitor configuration over USB with a HID device class was standardised in 1998, and is used by other displays from the period, including some of those from Apple - even those that used the proprietary ADC connector. The USB Monitor Control Class Specification can be viewed here: https://www.usb.org/sites/default/files/usbmon10_0.pdf

A user named ondrej-zary has created a Linux utility to read and control the parameters listed in the specification called usbmonctl, available here: https://github.com/ondrej-zary/usbmonctl

As you can see, it has been confirmed to work with the Apple Cinema HD Display M8536, and the USB HID device in this unit that's used for the purpose of controlling the monitor's parameters bears the identifier of 0x05ac:0x9218 - very close indeed to the identifier of the HID device you indentified in the Apple Studio Display 21" of 0x9210.

Use of usbmonctl involves using -l --list to automatically find any USB monitors connected and list their available controls, then using -g to get the current value of a control, and -s to set a new value for the control.

Here are a few example uses listed for usbmonctl: usbmonctl -s O,0x01,0,0=1 // degauss usbmonctl -g F,16 // get current brightness value usbmonctl -s F,0x12=10 // set contrast to 10

As you can see in the link above, these controls correspond perfectly to the USB Monitor Control Class Specification (ie 0x12 or 12h is listed as the value for Contrast), and as the Apple Cinema HD Display can be successfully controlled in this way, we know that some Apple monitors that use USB for configuration appear to comply to this specification. While the Cinema HD Display is an LCD monitor, requiring far fewer controls, the specification classifies a huge list of geometry controls, and this utility should allow for their adjustment - as it would appear to have for others that have used this utility to control their CRTs from other manufacturers.

The Cinema HD Display I mentioned is an ADC model, but was tested using Apple's own ADC -> DVI adapter. Essentially, this adapter just splits the ADC connection back up into it's separated parts, one of which is a USB connection.

So, it's my guess that if you're able to boot up a Linux installation and follow the readme to use this utility, you should be able to control your Studio Display fully, albeit via a command line. If this does work, it would be fantastic to have it ported to Windows with a GUI eventually!

I'm waiting on a DisplayPort to VGA adapter before I can connect this monitor to my machine, which should arrive within a week or so. I'll be trying this myself then, but please do let me know how you go in the meantime!

Best, Joseph

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bounav/open-USB-display-service-utility/issues/1#issuecomment-856978069, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB4R3IGNJ6ZSY6FO7DKSJLTRZLGXANCNFSM46HO5LKQ .

BlueJayLouche commented 3 years ago

I can confirm this works perfectly well, USB connect to laptop, running Arch Linux (Manjaro), VGA to monitor from Dreamcast. (Monitor does NOT need to be plugged into the same computer as USB). I did seem to have to plug things in in a particular order, or at least power cycle the monitor with USB plugged into laptop. The settings below are where I landed. Note you'll need to send the last command usbmonctl -s F,0xB0=1 to store the changes

These are my settings for: Vertical Pos Vertical Size Horizontal Pos Store Changes

[wfs@wfs-20hrcto1ww usbmonctl]$ sudo usbmonctl -s F,0x30=169
[wfs@wfs-20hrcto1ww usbmonctl]$ sudo usbmonctl -s F,0x32=238
[wfs@wfs-20hrcto1ww usbmonctl]$ sudo usbmonctl -s F,0x20=90
[wfs@wfs-20hrcto1ww usbmonctl]$ sudo usbmonctl -s F,0xB0=1

Big big thanks @pash-peezy !

BlueJayLouche commented 3 years ago

I've found some extra info here: https://opensource.apple.com/source/X11/X11-0.46.4/xc/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb_hid_usages

I'm considering forking usbmonctl and adding this.

128 Monitor
    0x00    Undefined
    0x01    Monitor Control
    0x02    EDID Information
    0x03    VDIF Information
    0x04    VESA Version
    0x05    On Screen Display
    0x06    Auto Size Center
    0x07    Polarity Horz Synch
    0x08    Polarity Vert Synch
    0x09    Sync Type
    0x0A    Screen Position
    0x0B    Horizontal Frequency
    0x0C    Vertical Frequency

129 Monitor Enumerated Values
    0x00    unassigned
    *   ENUM %d

130 VESA Virtual Controls
    0x10    Brightness
    0x12    Contrast
    0x16    Video Gain Red
    0x18    Video Gain Green
    0x1A    Video Gain Blue
    0x1C    Focus
    0x20    Horizontal Position
    0x22    Horizontal Size
    0x24    Horizontal Pincushion
    0x26    Horizontal Pincushion Balance
    0x28    Horizontal Misconvergence
    0x2A    Horizontal Linearity
    0x2C    Horizontal Linearity Balance
    0x30    Vertical Position
    0x32    Vertical Size
    0x34    Vertical Pincushion
    0x36    Vertical Pincushion Balance
    0x38    Vertical Misconvergence
    0x3A    Vertical Linearity
    0x3C    Vertical Linearity Balance
    0x40    Parallelogram Distortion
    0x42    Trapezoidal Distortion
    0x44    Tilt
    0x46    Top Corner Distortion Control
    0x48    Top Corner Distortion Balance
    0x4A    Bottom Corner Distortion Control
    0x4C    Bottom Corner Distortion Balance
    0x56    Moiré Horizontal
    0x58    Moiré Vertical
    0x5E    Input Level Select
    0x60    Input Source Select
    0x62    Stereo Mode
    0x6C    Video Black Level Red
    0x6E    Video Black Level Green
    0x70    Video Black Level Blue

131 VESA Command
    0x00    Undefined
    0x01    Settings
    0x02    Degauss
pash-peezy commented 3 years ago

Great work on finding a copy of Apple's own HID monitor control usage table, it's been some huge progress over the last day or two.

As for moving to another utility, have you checked out ddcutil? It seems to be a much more widely used and refined tool than usbmonctl, and while it's able to handle monitor control over many different interfaces, the USB control functionality was built off of usbmonctl as a starting point.

Here's a link: http://ddcutil.com/ cheers :)

BlueJayLouche commented 3 years ago

Cool. I'll check that out. One thing that's missing from usbmonctl is the visual feedback you can get with convergence and beam landing adjustments under native osx display management. I wonder if ddcutil has implemented this.

On Thu, 10 Jun 2021 at 00:51, pash-peezy @.***> wrote:

Great work on finding a copy of Apple's own HID monitor control usage table, it's been some huge progress over the last day or two.

As for moving to another utility, have you checked out ddcutil? It seems to be a much more widely used and refined tool than usbmonctl, and while it's able to handle monitor control over many different interfaces, the USB control functionality was built off of usbmonctl as a starting point.

Here's a link: http://ddcutil.com/ cheers :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bounav/open-USB-display-service-utility/issues/1#issuecomment-858197513, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB4R3NERL6OQBVTWPYHSRLTSAEARANCNFSM46HO5LKQ .

ilbuonmarcio commented 7 months ago

Hi, I also have an Apple Studio Display 21" and I'm unable to calibrate it other than using an old Mac Pro PowerPC G4 running 9.2, are there any updates on this for calibrating it using Linux for example?

I tried using usbmonctl but it seems to not apply the settings I throw at it...

Thanks in advance,

Alessandro