| 1 |
colord sensor driver for the hueyCOLOR |
| 2 |
====================================== |
| 3 |
|
| 4 |
The hueyCOLOR is a *color sensor* found in the top-end P70 and P71 ThinkPads |
| 5 |
from Lenovo. It is branded as a Pantone X-Rite sensor, and is similar in |
| 6 |
protocol to the Huey and HueyPRO devices. The sensor is located in the palm-rest, |
| 7 |
and so the laptop lid needs to be shut (and the display kept on) when showing |
| 8 |
calibration patches. |
| 9 |
|
| 10 |
The device has USB vendor ID of `0765` and a product ID of `5010` as is exposed |
| 11 |
as a simple HID device with an 8-byte control transfer request then an 8-byte |
| 12 |
interrupt transfer response. |
| 13 |
|
| 14 |
Windows Behaviour |
| 15 |
----------------- |
| 16 |
|
| 17 |
In Microsoft Windows 10, the Pantone application prompts you to recalibrate your |
| 18 |
display once per week. When you manually run the calibration wizard, it asks you |
| 19 |
to choose your display temperature and also the gamma value for the curve, |
| 20 |
defaulting to D65 whitepoint and 2.2 gamma. |
| 21 |
|
| 22 |
It then asks you to shut the lid and uses a combination of flashing the Thinkpad |
| 23 |
red-dot LED and using sound effects to show you the progress of the calibration. |
| 24 |
By opening the lid a tiny fraction we can see the pattern is as follows: |
| 25 |
|
| 26 |
* Black offset |
| 27 |
* Red primary |
| 28 |
* Green primary |
| 29 |
* Blue primary |
| 30 |
* Red gamma ramp, 7 steps |
| 31 |
* Green gamma ramp, 7 steps |
| 32 |
* Blue gamma ramp, 7 steps |
| 33 |
|
| 34 |
The USB traffic was intercepted for two runs, and these are dumped to the files |
| 35 |
`huey-p70.csv` and `huey-p70-run2.csv`. These were further post-processed by the |
| 36 |
`huey-p70.py` script to filter down and to help understand the protocol used. |
| 37 |
|
| 38 |
Conclusions |
| 39 |
----------- |
| 40 |
|
| 41 |
From completely reverse engineering the protocol, we can show that the Pantone |
| 42 |
X-Rite sensor in the palm-rest of the P70 is nothing more than a brightness |
| 43 |
sensor with a display-specific primary correction matrix. |
| 44 |
|
| 45 |
You can't actually get a RGB or XYZ color out of the sensor, the only useful |
| 46 |
thing that it can do is linearize the VCGT ramps, and with only 7 measurements |
| 47 |
for each channel I'm surprised it can do anything very useful at all. |
| 48 |
|
| 49 |
Is it not known how the sensor and calibration tool can create an ICC profile |
| 50 |
without hardcoding the primaries in the sensor EEPROM itself, and this is |
| 51 |
probably what happens here. Whilst the sensor would be able to linearize a |
| 52 |
display where the hardware-corrected backlight suddenly becomes non-linear, |
| 53 |
it is completely unable to return a set of display primaries. Said another way, |
| 54 |
the sensor can't tell the difference between a 100% red and 100% blue patch. |
| 55 |
|
| 56 |
These findings also correlate with the findings from AnandTech[1] who say that |
| 57 |
calibrating the display with the embedded sensor actually makes the LCD worse |
| 58 |
when measuring saturation accuracy, whitepoint ***and*** grayscale accuracy. |
| 59 |
|
| 60 |
If you're serious about color calibration, please don't use the built-in sensor, |
| 61 |
and if you are buying a top-end Xeon system save a few dollars and don't bother |
| 62 |
with the color sensor. For $20 extra Pantone could have used a calibrated XYZ |
| 63 |
one-piece sensor from MAZeT, which would have given them a true "color sensor" |
| 64 |
that could have sampled much quicker and with true XYZ-adapted readings. |
| 65 |
|
| 66 |
The irony is of course, you can't even use the HueyCOLOR sensor as a ambient |
| 67 |
light sensor. As the device is in the palm-rest, you frequently cover it with |
| 68 |
your hand -- and any backlight adjustment would feed back into the sensor |
| 69 |
causing the backlight to flash. |
| 70 |
|
| 71 |
If you actually want to make a colord sensor driver for this hardware we'd need |
| 72 |
to extend the capability bitfield to show it's only capable of brightness, and |
| 73 |
also continue parsing the EEPROM to find the spectral sensitivities, but that's |
| 74 |
not something that *I* think is useful to do. |
| 75 |
|
| 76 |
Details about the hardware |
| 77 |
========================== |
| 78 |
|
| 79 |
EEPROM Map |
| 80 |
---------- |
| 81 |
|
| 82 |
Unlike the well-documented EEPROM map for the Huey and HueyPro devices this |
| 83 |
device has 1024 bytes of EEPROM, which looks to contain a serial number, |
| 84 |
a CCMX-like structure and also the hardcoded display model. The majority of the |
| 85 |
EEPROM is unused and set to `0x30`. The entire EEPROM is captured in the |
| 86 |
`huey2.bin` file using the `huey-tool` command, as Windows 10 only queries |
| 87 |
about 80% of the address space, ignoring seemingly uninteresting chunks. |
| 88 |
|
| 89 |
Command: Unlock |
| 90 |
--------------- |
| 91 |
|
| 92 |
The device does not accept the Huey `UNLOCK` command and does not need manual |
| 93 |
unlocking. |
| 94 |
|
| 95 |
Command: GetStatus |
| 96 |
------------------ |
| 97 |
|
| 98 |
The device always seems to respond with `"ECCM3 "`. |
| 99 |
|
| 100 |
input: 00 xx xx xx xx xx xx xx |
| 101 |
returns: 00 00 43 69 72 30 30 31 |
| 102 |
status --^^^^^^^^^^^^^^^^^ |
| 103 |
|
| 104 |
Command: Read the EEPROM |
| 105 |
------------------------- |
| 106 |
|
| 107 |
The existing command `REGISTER_READ` now takes two bytes for the address and |
| 108 |
returns 4 bytes of EEPROM on each request. |
| 109 |
|
| 110 |
input: 08 ff ff xx xx xx xx xx |
| 111 |
^^-^^-- register address |
| 112 |
returns: 00 08 0b b8 01 02 03 04 |
| 113 |
address --^^-^^ ^^-^^-^^-^^-- values |
| 114 |
|
| 115 |
Command: Sample A Color |
| 116 |
----------------------- |
| 117 |
|
| 118 |
The Windows 10 application does not use the typical `MEASURE_RGB_ALT` and |
| 119 |
`GET_GREEN` commands used in previous hardware revisions, but instead uses two |
| 120 |
new commands `0x53` and `0x04`. |
| 121 |
|
| 122 |
input: 53 00 62 xx xx xx xx xx |
| 123 |
^^-^^--- the amount of time to count |
| 124 |
returns: 00 53 00 00 01 02 xx xx |
| 125 |
value ----^^-^^-^^-^^ |
| 126 |
|
| 127 |
The value increases as the sample gets brighter, so we can guess this function |
| 128 |
is counting pulses for a set amount of time. |
| 129 |
|
| 130 |
input: 04 00 70 xx xx xx xx xx |
| 131 |
^^-^^--- the number of pulses to count |
| 132 |
returns: 00 04 00 00 01 02 xx xx |
| 133 |
value ---------^^-^^ |
| 134 |
|
| 135 |
The value increases as the sample gets darker, so we can guess this function |
| 136 |
is counting a number of pulses. |
| 137 |
|
| 138 |
[1] http://www.anandtech.com/show/10444/the-lenovo-thinkpad-p70-review-mobile-xeon-workstation/5 |