udev-monitor-hotplug icon indicating copy to clipboard operation
udev-monitor-hotplug copied to clipboard

Added changes that I might be useful for a device with DisplayPort

Open vasilake-v opened this issue 5 years ago • 5 comments

Added changes that I might be useful for a device with DisplayPort Also on my environment the udev directive ENV{HOTPLUG} wasn't available on my environment so I thought it might be useful to let others know about it

vasilake-v avatar Aug 16 '19 07:08 vasilake-v

Added changes that I might be useful for a device with DisplayPort Also on my environment the udev directive ENV{HOTPLUG} wasn't available on my environment so I thought it might be useful to let others know about it

And did everything work even without the ENV{HOTPLUG} directive?

luizoti avatar Jun 05 '21 21:06 luizoti

What I meant was that

Added changes that I might be useful for a device with DisplayPort Also on my environment the udev directive ENV{HOTPLUG} wasn't available on my environment so I thought it might be useful to let others know about it

And did everything work even without the ENV{HOTPLUG} directive?

No, it didn't work.

What I meant was that on my environment was no ENV{HOTPLUG} directive. And I had to find a solution for this.

I found one and i posted this solution here as a PR for review

vasilake-v avatar Jun 08 '21 06:06 vasilake-v

But which rule worked in your system?

The first time I read I didn't notice the stackexchange link, I thought the PR was just about DisplayPort.

luizoti avatar Jun 08 '21 16:06 luizoti

Oh, i guess i ommited the "rules file" that i am using. I excluded that directive completely. And here is my trouble shoot path:

My system

root@HP-ProBook-470-G5:/etc/udev/rules.d# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.10
DISTRIB_CODENAME=groovy
DISTRIB_DESCRIPTION="Ubuntu 20.10"

I tried to monitor the events with udevd, but failed.

root@HP-ProBook-470-G5:/etc/udev/rules.d# udevd
udevd: command not found

so I used the udevadm monitor to verify the event

root@HP-ProBook-470-G5:/etc/udev/rules.d# udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[42303.933768] change   /devices/pci0000:00/0000:00:02.0/drm/card0 (drm)
UDEV  [42304.066600] change   /devices/pci0000:00/0000:00:02.0/drm/card0 (drm)
KERNEL[42304.364653] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2 (usb)
KERNEL[42304.365857] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0 (usb)
KERNEL[42304.369941] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0 (usb)
KERNEL[42304.370093] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2 (usb)
UDEV  [42304.554444] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2 (usb)
UDEV  [42304.646693] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0 (usb)
UDEV  [42304.726060] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0 (usb)
UDEV  [42304.813698] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2 (usb)
KERNEL[42305.382477] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.3 (usb)
KERNEL[42305.387848] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.3/1-2.3:1.0 (usb)
KERNEL[42305.388163] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.3 (usb)
KERNEL[42305.726932] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.4 (usb)
KERNEL[42305.727885] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.4/1-2.4:1.0 (usb)
KERNEL[42305.732438] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.4/1-2.4:1.0 (usb)
KERNEL[42305.732565] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.4 (usb)
UDEV  [42305.842233] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.4 (usb)
UDEV  [42305.859561] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.3 (usb)
UDEV  [42305.960310] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.4/1-2.4:1.0 (usb)
UDEV  [42306.044268] add      /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.3/1-2.3:1.0 (usb)
UDEV  [42306.184810] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.4/1-2.4:1.0 (usb)
UDEV  [42306.213116] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.3 (usb)
UDEV  [42306.275536] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.4 (usb)

In the end i came up with a "rules" file that don't include the ENV{HOTPLUG}=="1".

Maybe i am mising something here, but it works :)

ACTION=="change"
SUBSYSTEM=="drm"
RUN+="/home/user/monitor-hotplug.sh"

vasilake-v avatar Jun 08 '21 17:06 vasilake-v

In the end i came up with a "rules" file that don't include the ENV{HOTPLUG}=="1".

By my tests, everything worked on 20.04, maybe it's a difference between the distros.

In the next version of the script it might be worth adding the two udev rules or a way to install the correct one for each distro.

In any case, it is possible to add 2 or more rules to the same file, I think it's valid that you edit the PR and modify the rules file including the version your version.

luizoti avatar Jun 08 '21 18:06 luizoti