【鼎革‧革鼎】︰ Raspbian Stretch 《四‧五上》

科學的樂趣是什麼呢?是發現自然的奧秘?或與神奇相逢嗎?還是知道控制世界的辦法?…… 也許有人只是好奇真理的模樣哩!說起 W!o+ 的快樂有點與眾不同︰『除錯』。

1280px-Nighthawks_by_Edward_Hopper_1942

愛德華‧霍普  夜遊者

 

一時心裡想著 Mrphs 曾經講過的話︰

W!o+ 小時候,許多快樂時光都在『除錯』中度過。他認為即使說『科南‧道爾』當『偵探』,未必然能是個『好偵探』。雖然大家以為他既能創造『大偵探』福爾摩斯, 又怎會自己不是的呢?因為一個作者早知道『結局』,掌握所有『線索』,過程常常不過是『故布疑陣』,迷惑讀者而已。這可與『真偵探』的遭遇大不相同 ,未能『先知』,就不能『神奇』!文章固然膾炙人口,要談深得三昧卻未必然的吧!!所以『寫程式』、『讀程式』、『測程式』 ……者 ,『錯誤』無論來自『何方』『何時』…… 都是良師益友,都要認真對待。此『不速之客』的『偶然』『錯誤』,往往恰恰是『利涉大川』者之『必然』『所需』。

【※作者註】

需:有孚,光亨,貞吉。 利涉大川。

彖曰:需,須也﹔險在前也。 剛健而不陷,其義不困窮矣。 需有孚,光亨,貞吉。 位乎天位,以正中也。 利涉大川,往有功也。

象曰:云上於天,需﹔君子以飲食宴樂。

初九:需于郊。 利用恆,無咎。
象曰:需于郊,不犯難行也。 利用恆,無咎﹔未失常也。

九二:需于沙。 小有言,終吉。
象曰:需于沙,衍在中也。 雖小有言,以終吉也。

九三:需于泥,致寇至。
象曰:需于泥,災在外也。 自我致寇,敬慎不敗也。

六四:需于血,出自穴。
象曰:需于血,順以聽也。

九五:需于酒食,貞吉。
象曰:酒食貞吉,以中正也。

上六:入于穴,有不速之客三人來,敬之終吉。
象曰:不速之客來,敬之終吉。 雖不當位,未大失也。

─── 摘自《W!o+ 的《小伶鼬工坊演義》︰ 一窺全豹之系統設計《葫蘆》

 

一位想找出事物之『bug』,然後『de-bug』者,該歸之何類耶?

論語‧雍也

子曰:知之者不如好之者,好之者不如樂之者。

『觀物』將成為『系統』,進而可作『實驗』乎!

─── 《樹莓派 0W 狂想曲︰ 觀物怡情《𝄡》

 

假使想要客製 HDMI 模式,進入樹莓派 『hdmi_timings』的天地,首先得面對雜散之論壇文章︰

Re: HOWTO: Create Custom HDMI modes

Sat Sep 10, 2016 4:48 pm

Anyone know what the units are supposed to be for the custom HDMI timings?

 

知道它的格式︰hdmi_timings=

<h_active_pixels> = horizontal pixels (width)
<h_sync_polarity> = invert hsync polarity
<h_front_porch> = horizontal forward padding from DE acitve edge
<h_sync_pulse> = hsync pulse width in pixel clocks
<h_back_porch> = vertical back padding from DE active edge
<v_active_lines> = vertical pixels height (lines)
<v_sync_polarity> = invert vsync polarity
<v_front_porch> = vertical forward padding from DE active edge
<v_sync_pulse> = vsync pulse width in pixel clocks
<v_back_porch> = vertical back padding from DE active edge
<v_sync_offset_a> = leave at zero
<v_sync_offset_b> = leave at zero
<pixel_rep> = leave at zero
<frame_rate> = screen refresh rate in Hz
<interlaced> = leave at zero
<pixel_freq> = clock frequency (width*height*framerate)
<aspect_ratio> = *

 

明白特定參數意指︰

The aspect ratio is:

HDMI_ASPECT_4_3 = 1
HDMI_ASPECT_14_9 = 2
HDMI_ASPECT_16_9 = 3
HDMI_ASPECT_5_4 = 4
HDMI_ASPECT_16_10 = 5
HDMI_ASPECT_15_9 = 6
HDMI_ASPECT_21_9 = 7
HDMI_ASPECT_64_27 = 8

 

更重要的是深入了解『EDID』是什麼︰

Extended Display Identification Data

Extended Display Identification Data (EDID) is a data structure provided by a digital display to describe its capabilities to a video source (e.g. graphics card or set-top box). It is what enables a modern personal computer to know what kinds of monitors are connected to it. EDID is defined by a standard published by the Video Electronics Standards Association (VESA). The EDID includes manufacturer name and serial number, product type, phosphor or filter type, timings supported by the display, display size, luminance data and (for digital displays only) pixel mapping data.

EDID structure versions range from v1.0 to v1.4; all these define upwards-compatible 128-byte structures. EDID structure v2.0 defined a new 256-byte structure, but subsequently has been deprecated and replaced by v1.3.[citation needed] HDMI versions 1.0–1.3c use EDID structure v1.3.[1]

DisplayID is a standard targeted to replace EDID and E-EDID extensions with a uniform format suited for both PC monitor and consumer electronics devices.

 

然後善用工具也。

‧ tvservice -d edid.dat

可以擷取目前顯示器的 EDID ,配合 /boot/config.txt 之

#hdmi_force_hotplug=1
#hdmi_edid_file=1

能夠不接螢幕開機進入 X Window 系統。

固然依文件說明,自己手動解碼亦可!

00000000   00 FF FF FF  FF FF FF 00  30 E4 45 03  00 00 00 00  ........0.E.....
00000010   00 15 01 04  90 16 0E 78  02 E8 87 96  5A 55 95 28  .......x....ZU.(
00000020   22 51 55 00  00 00 01 01  01 01 01 01  01 01 01 01  "QU.............
00000030   01 01 01 01  01 01 4C 1D  00 EC 50 20  18 30 40 30  ......L...P .0@0
00000040   57 00 D9 88  00 00 00 1B  16 12 00 80  50 20 16 30  W...........P .0
00000050   FF FF FF FF  FF FF FF FF  00 1B 00 00  00 FE 00 43  ...............C
00000060   33 47 52 4E  80 31 30 31  57 58 31 0A  00 00 00 00  3GRN.101WX1.....
00000070   00 00 41 32  A8 00 00 00  00 01 01 0A  20 20 00 9A  ..A2........  ..

 

不如使用工具乎?

‧ edidparser edid.dat

Enabling fuzzy format match...
Parsing edid.dat...
HDMI:EDID version 1.4, 0 extensions, screen size 22x14 cm
HDMI:EDID features - videodef 0x90 !standby !suspend !active off; colour encoding:RGB444; sRGB is not default colourspace; preferred format is native; support discrete frame rate
HDMI:EDID found monitor ascii descriptor tag 0xfe
HDMI:EDID ignored unknown descriptor tag 0x0
HDMI:EDID does not yet know monitor vertical range, setting to default 24 to 120Hz
HDMI:EDID failed to find a matching detail format for 1280x800p hfp:64 hs:48 hbp:124 vfp:5 vs:7 vbp:12 pixel clock:75 MHz
HDMI:EDID calculated refresh rate is 60 Hz
HDMI:EDID guessing the format to be 1280x800p @60 Hz
HDMI:EDID found preferred DMT detail timing format: 1280x800p @ 60 Hz (27)
HDMI:EDID failed to find a matching detail format for 1280x800p hfp:1023 hs:1023 hbp:-1918 vfp:63 vs:63 vbp:-104 pixel clock:46 MHz
HDMI:EDID calculated refresh rate is 40 Hz
HDMI:EDID guessing the format to be 1280x800p @30 Hz
HDMI:EDID found unknown detail timing format: 1280x800p hfp:1023 hs:1023 hbp:-1918 vfp:63 vs:63 vbp:-104 pixel clock:46 MHz
HDMI:EDID established timing I/II bytes are 00 00 00
HDMI:EDID standard timings block x 8: 0x0101 0101 0101 0101 0101 0101 0101 0101 
HDMI:EDID adding mandatory support for DMT (4) 640x480p @ 60Hz
HDMI:EDID filtering formats with pixel clock > 162 MHz or h. blanking > 1023
HDMI:EDID best score mode initialised to DMT (4) 640x480p @ 60 Hz with pixel clock 25 MHz (score 0)
HDMI:EDID best score mode is now DMT (4) 640x480p @ 60 Hz with pixel clock 25 MHz (score 36864)
HDMI:EDID best score mode is now DMT (27) 1280x800p @ 60 Hz with pixel clock 71 MHz (score 5184320)
HDMI:EDID preferred mode remained as DMT (27) 1280x800p @ 60 Hz with pixel clock 71 MHz
HDMI:EDID has only DVI support and no audio support
edid_parser exited with code 0

 

或許最好也知 linux kernel/xrandr

‧ edid-decode edid.dat

edid-decode(1)              General Commands Manual             edid-decode(1)

NAME
       edid-decode - Decode EDID data in human-readable format

SYNOPSIS
       edid-decode [in] [out]

DESCRIPTION
       edid-decode  decodes  EDID  monitor  description data in human-readable
       format.  It takes zero, one, or two  arguments.   If  invoked  with  no
       arguments  it  reads from standard input and writes to standard output.
       With one argument, the file named by  the  argument  is  read  instead.
       With  two  arguments,  normal output is suppressed, and the binary EDID
       blob is written to the file named by the second argument.

       Input files may be raw binaries or ASCII text.  ASCII input is  scanned
       for  hex  dumps;  heuristics  are  included  to  search for hexdumps in
       xrandr(1) property output and Xorg(1) log file formats,  otherwise  the
       data  is  treated as a raw hexdump.  EDID blocks for connected monitors
       can be found in /sys/class/drm/*/edid on modern Linux systems with ker‐
       nel modesetting support.

 

格式耶◎

pi@raspberrypi:~ edid-decode edid.dat Extracted contents: header:          00 ff ff ff ff ff ff 00 serial number:   30 e4 45 03 00 00 00 00 00 15 version:         01 04 basic params:    90 16 0e 78 02 chroma info:     e8 87 96 5a 55 95 28 22 51 55 established:     00 00 00 standard:        01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 descriptor 1:    4c 1d 00 ec 50 20 18 30 40 30 57 00 d9 88 00 00 00 1b descriptor 2:    16 12 00 80 50 20 16 30 ff ff ff ff ff ff ff ff 00 1b descriptor 3:    00 00 00 fe 00 43 33 47 52 4e 80 31 30 31 57 58 31 0a descriptor 4:    00 00 00 00 00 00 41 32 a8 00 00 00 00 01 01 0a 20 20 extensions:      00 checksum:        9a  Manufacturer: LGD Model 345 Serial Number 0 Made week 0 of 2011 EDID version: 1.4 Digital display 6 bits per primary color channel Digital interface is not defined Maximum image size: 22 cm x 14 cm Gamma: 2.20 Supported color formats: RGB 4:4:4 First detailed timing is preferred timing Established timings supported: Standard timings supported: Detailed mode: Clock 75.000 MHz, 217 mm x 136 mm                1280 1344 1392 1516 hborder 0                 800  805  812  824 vborder 0                +hsync -vsync  Detailed mode: Clock 46.300 MHz, 4095 mm x 4095 mm                1280 2303 3326 1408 hborder 255                 800  863  926  822 vborder 0                +hsync -vsync  ASCII string: C3GRN Manufacturer-specified data, tag 0 Checksum: 0x9a (valid) EDID block does NOT conform to EDID 1.3! 	Missing name descriptor 	Missing monitor ranges 	Detailed block string not properly terminated pi@raspberrypi:~