Linux Displaylink

How to Wake Your PC with a DisplayLink Device via USB 💻🔌
If you’re using a DisplayLink device (such as a USB-to-video adapter) and want to configure your PC to wake up automatically when you plug it in, you can achieve this with udev rules and USB power management settings. Below is a step-by-step guide on how I set up my system for this functionality.
Step 1: Check Existing Udev Rules
First, list the current udev rules on your system to see what’s already configured:
ls /etc/udev/rules.d/*
This command shows all the rules applied to your system, including any custom rules you may have.
Step 2: Monitor Udev Events
To monitor udev events (such as when you plug in your DisplayLink device), use the following command:
udevadm monitor
This will show you any events related to devices being added or removed, so you can see the relevant information when you plug in the device.
Step 3: Reload Udev Rules
If you make any changes to the udev rules, you can reload them using the following command:
sudo udevadm trigger
This triggers the rules manually, allowing any changes to take effect immediately.
Step 4: Edit Udev Rules for USB Wakeup
Next, you need to create a custom udev rule to enable USB wakeup for your DisplayLink device. Open or create the file 10-wakeup.rules in the /etc/udev/rules.d/ directory:
sudo nano /etc/udev/rules.d/10-wakeup.rules
Add the following line to the file to enable the wakeup functionality:
Enable USB wakeup for DisplayLink device (idVendor: 17e9, idProduct: 4306)
ACTION==“add|change”, SUBSYSTEM==“usb”, KERNEL==“usb1”, RUN+="/bin/sh -c ’echo enabled > /sys/bus/usb/devices/usb1/power/wakeup'"
Step 5: Reload Udev Rules Again
Once the rule is added, reload the udev rules once more to apply the changes:
sudo udevadm control --reload-rules
This will ensure your new rules take effect.
Step 6: Verify USB Wakeup Settings
To verify if the USB wakeup is enabled for your DisplayLink device, check the device’s power settings with this command:
cat /sys/bus/usb/devices/usb1/power/wakeup
This should show you the current wakeup status for the USB device. If configured correctly, the device should be set to “enabled.”
Explanation of the Udev Rule Here’s a breakdown of the udev rule we added:
ACTION==“add|change”: This triggers the rule when the device is added or its properties change. SUBSYSTEM==“usb”: The rule applies to USB devices. KERNEL==“usb1”: This specifies that the rule applies to usb1 (you may need to adjust this depending on your setup). RUN+="/bin/sh -c ’echo enabled > /sys/bus/usb/devices/usb1/power/wakeup’": This command enables the wakeup feature for the device, ensuring that it can wake up the PC when plugged in.
Conclusion
By following these steps, your DisplayLink device should now be able to wake up your system when you plug it in. This is a great way to save power while keeping your system ready to go when you need it.
If you have more than one USB device, make sure to adjust the KERNEL or ATTRS properties in the udev rule to target the correct USB device. You can check the exact attributes by running udevadm monitor and observing the device’s details.
Useful Links
- Udev Rules Documentation – Learn more about writing udev rules.
- USB Power Management in Linux – Read more about how USB power management works in Linux.
Let me know if you run into any issues or need further assistance! 😊
ls /etc/udev/rules.d/*
udevadm monitor
sudo udevadm trigger
sudo nano /etc/udev/rules.d/10-wakeup.rules
sudo udevadm control --reload-rules
cat /sys/bus/usb/devices/usb1/power/wakeup
# /etc/udev/rules.d/10-wakeup.rules
# /etc/udev/rules.d/10-wakeup.rules
# ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="17e9", ATTRS{idProduct}=="4306", ATTR{power/wakeup}="enabled"
# ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="17e9", ATTRS{idProduct}=="4306" RUN+="/bin/sh -c 'echo enabled > /sys/bus/usb/devices/usb1/power/wakeup'"
ACTION=="add|change", SUBSYSTEM=="usb", KERNEL=="usb1", RUN+="/bin/sh -c 'echo enabled > /sys/bus/usb/devices/usb1/power/wakeup'"