Udev for hdmi or dp hotplug event

Hi: we had a query for hdmi or dp hotplug, how the udev handle the hdmi/dp hotplug event?
We used the udevadm monitor, it will report the kernel and udev events, bu I cann’t find the processing code? where is it?

please check if there is anything from /devices/extcon/extcon:disp-state/extcon/

root@localhost:/sys/devices/extcon/extcon:disp-state/extcon# ls
extcon1

There is extcon1.

The below is our plug out hdmi and plug in, it report events, I want to know how to process these events, I didn’t find udev rules files for these events.
root@localhost:/# udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[71349.814967] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
KERNEL[71349.815138] change /devices/virtual/switch/hdmi_audio (switch)
UDEV [71349.817822] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
KERNEL[71349.833580] change /devices/virtual/switch/tegradc.0 (switch)
UDEV [71349.834715] change /devices/virtual/switch/tegradc.0 (switch)
UDEV [71349.834887] change /devices/virtual/switch/hdmi_audio (switch)
KERNEL[71349.835158] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
KERNEL[71349.835214] change /devices/virtual/switch/hdmi (switch)
UDEV [71349.836812] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
UDEV [71349.839448] change /devices/virtual/switch/hdmi (switch)

[71356.837009] lt9611_edid_check:checksum=0
[71356.841190] HDMI Raw EDID:
[71356.844244] 00 ff ff ff ff ff ff 00 1e 6d 66 76 01 01 01 01
[71356.850334] 01 16 01 04 82 46 27 78 ea d9 b0 a3 57 49 9c 25
[71356.856284] 11 49 4b 21 08 00 31 40 45 40 61 40 81 80 81 c0
[71356.862264] 8c c0 d1 c0 01 01 1a 36 80 a0 70 38 1f 40 30 20
[71356.868196] 35 00 e8 26 32 00 00 1a 1b 21 50 a0 51 00 1e 30
[71356.874131] 48 88 35 00 bc 86 21 00 00 1c 00 00 00 fc 00 49
[71356.880066] 54 45 36 36 30 34 0a 20 20 20 20 20 00 00 00 f7
[71356.885998] 00 0a 00 42 c4 44 02 00 00 00 00 00 00 00 01 d0
[71356.891916] 02 03 22 f0 4d 06 03 15 12 13 04 14 05 20 1f 10
[71356.897834] 21 22 23 09 07 07 83 01 00 00 67 03 0c 00 10 00
[71356.903725] b8 2d 01 1d 00 80 51 d0 1c 20 40 80 35 00 bc 88
[71356.909596] 21 00 00 1e 8c 0a d0 8a 20 e0 2d 10 10 3e 96 00
[71356.915429] 13 8e 21 00 00 18 02 3a 80 18 71 38 2d 40 58 2c
[71356.921313] 45 00 06 44 21 00 00 1e 01 1d 80 18 71 1c 16 20
[71356.927278] 58 2c 25 00 c4 8e 21 00 00 9e 4e 1f 00 80 51 00
[71356.933215] 1e 30 40 80 37 00 bc 88 21 00 00 18 00 00 00 b4
KERNEL[71356.509187] change /devices/virtual/switch/tegradc.0 (switch)
UDEV [71356.511563] change /devices/virtual/switch/tegradc.0 (switch)
KERNEL[71356.513487] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
KERNEL[71356.513544] change /devices/virtual/switch/hdmi_audio (switch)
UDEV [71356.514908] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
KERNEL[71356.516871] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
KERNEL[71356.516933] change /devices/virtual/switch/hdmi (switch)
UDEV [71356.518686] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
UDEV [71356.519639] change /devices/virtual/switch/hdmi (switch)
UDEV [71356.520193] change /devices/virtual/switch/hdmi_audio (switch)
KERNEL[71356.594114] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
KERNEL[71356.594170] change /devices/virtual/switch/hdmi_audio (switch)
UDEV [71356.595459] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
UDEV [71356.598301] change /devices/virtual/switch/hdmi_audio (switch)
KERNEL[71356.614233] change /devices/virtual/switch/tegradc.0 (switch)
UDEV [71356.615286] change /devices/virtual/switch/tegradc.0 (switch)
KERNEL[71356.658769] change /devices/virtual/switch/tegradc.0 (switch)
UDEV [71356.659913] change /devices/virtual/switch/tegradc.0 (switch)
KERNEL[71356.664203] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
KERNEL[71356.664258] change /devices/virtual/switch/hdmi_audio (switch)
UDEV [71356.665548] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
UDEV [71356.669198] change /devices/virtual/switch/hdmi_audio (switch)

Not quite sure about what kind of “process” you want to do here…

I want to know :the below udev change event process code. I just trace into kernel, didn’t find user space process code.
UDEV [71356.665548] change /devices/extcon/extcon:disp-state/extcon/extcon1 (extcon)
UDEV [71356.669198] change /devices/virtual/switch/hdmi_audio (switch)

This part is then handled by Xorg which is not open source…

HI,thank you for reply. Could you tell me xorg will send which cmd to kernel?

We had a problem, plugout dp from 1080p monitor, then plug in dp to 720p monitor, the resolution ratio is also 1080p, not change to 720p. But hdmi port is right.

Hi,

I don’t think how you debug is correct… please just share me the dmesg and /var/log/Xorg.0.log when error case happened…

We boot the device with dp port pluged 1080p monitor, then plug out 1080p, plug in 720p, but it display 1080p.
dmesg.txt (96.7 KB)
Xorg.0.log (16.5 KB)

Could you share me the EDID of that 720p monitor?

Connect the 720p monitor to your board.

Dump

sudo cat /sys/kernel/debug/tegradc.X/edid #X=0,1,2.

Change the value “X” here to match your DP.

We add bridge for one dp divide into two hdmi, the dp port get edid will be 2560x720 for 720p. We had checked edid, the edid is right.

root@localhost:/sys/kernel/debug/tegradc.1# cat edid
00 ff ff ff ff ff ff 00 4a 8b 54 4c 01 00 00 00
0c 11 01 03 81 46 27 78 8a a5 8e a6 54 4a 9c 26
12 45 46 af cf 00 95 00 95 0f 95 19 01 01 01 01
01 01 01 01 01 01 02 3a 00 e4 a2 d0 1e 20 dc 50
55 00 b9 88 21 00 00 1e 18 15 a0 14 51 e0 2d 10
20 7c 96 00 b9 88 21 00 00 18 18 15 a0 14 51 e0
2d 10 20 7c 96 00 58 c1 10 00 00 1e 18 15 a0 14
51 e0 2d 10 20 7c 96 00 58 c1 10 00 00 1e 01 dd
02 03 21 71 4e 06 07 02 03 15 96 11 12 13 04 14
05 1f 90 23 09 07 07 83 01 00 00 65 03 0c 00 10
00 02 3a 00 e4 a2 d0 1e 20 dc 50 55 00 58 c1 10
00 00 1e 04 74 00 30 f2 38 2d 40 b0 58 45 00 58
c1 10 00 00 1e 18 15 a0 20 51 40 31 20 18 80 55
00 b9 88 21 00 00 18 02 3a 00 30 f2 1c 16 20 b0
58 25 00 b9 88 21 00 00 9e 02 3a 00 a0 f5 1c 16
20 20 58 25 00 b9 88 21 00 00 9e 00 00 00 00 dc

This EDID supports 3840x1080 resolution. Jetson just follows the EDID to output the largest mode… so there is no error here…

But for hdmi port, it will be 2560x720 output.

You can add below to your xorg setting and compare the xorg log with HDMI port and DP port and see what is the different.

#Add below option in /etc/X11/xorg.conf, 'Section "Device"'. Verbose mode logging will be shown in /var/log/Xorg.0.log
Section "Device"
...
  Option   "ModeDebug"
...
EndSection

Xorg.0-1.log (873.8 KB)
Hi: help check the log, the device boot with the two port connected to 1080p, and then change dp from 1080p to 720p monitor, and then change hdmi from 1080p to 720p monitor.

Hi,

這不是我要的log.
麻煩把這個log拆成兩份, 不然很難讀

  1. HDMI case. 直接插著你的720p開機 dump log
  2. DP case. 直接插著你的720p開機 dump log.

只要這個usecase就好了 先不做1080-> 720螢幕的切換

插着720P开机是对的, dp和hdmi都会按720p输出,只有热插拔切换720p和1080p dp口不会发生变化,hdmi口会正常切换分辨率.

那ok, 那就改成

  1. HDMI case. 插著1080p開機 → 插拔過去720p dump log
  2. DP case. 插著1080p開機 → 插拔過去720p dump log.

dp_Xorg.0.log (441.4 KB)
hdmi_Xorg.0.log (440.6 KB)