Skip to content
This repository was archived by the owner on Mar 6, 2022. It is now read-only.

Commit 1f6443a

Browse files
committed
add other files
1 parent 149dfd4 commit 1f6443a

6 files changed

+137
-0
lines changed

99-displaylink.rules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2016 DisplayLink (UK) Ltd.
2+
# File autogenerated by udev-installer.sh script
3+
4+
ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTR{idVendor}=="17e9", IMPORT{builtin}="usb_id", ENV{DISPLAYLINK_DEVNAME}="$env{DEVNAME}", ENV{DISPLAYLINK_DEVICE_ID}="$env{ID_BUS}-$env{BUSNUM}-$env{DEVNUM}-$env{ID_SERIAL}", ENV{REMOVE_CMD}="/opt/displaylink/udev.sh $root $env{DISPLAYLINK_DEVICE_ID} $env{DISPLAYLINK_DEVNAME}"
5+
6+
ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="17e9", ATTR{bInterfaceClass}=="ff", ATTR{bInterfaceProtocol}=="03", IMPORT{parent}="DISPLAYLINK*", RUN+="/opt/displaylink/udev.sh $root $env{DISPLAYLINK_DEVICE_ID} $env{DISPLAYLINK_DEVNAME}"

debian/displaylink.install

+4
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
#!/usr/bin/dh-exec
22
${DEB_HOST_ARCH}/DisplayLinkManager /opt/displaylink/
3+
displaylink.service /lib/systemd/system
4+
displaylink-sleep.sh /opt/displaylink/
5+
udev.sh /opt/displaylink/
6+
99-displaylink.rules /lib/udev/rules.d/

debian/displaylink.links

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/opt/displaylink/displaylink-sleep.sh /lib/systemd/system-sleep/displaylink

displaylink-sleep.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Copyright (c) 2015 - 2016 DisplayLink (UK) Ltd.
3+
4+
suspend_dlm()
5+
{
6+
#flush any bytes in pipe
7+
while read -n 1 -t 1 SUSPEND_RESULT < /tmp/PmMessagesPort_out; do : ; done;
8+
9+
#suspend DisplayLinkManager
10+
echo "S" > /tmp/PmMessagesPort_in
11+
12+
if [ -f /tmp/PmMessagesPort_out ]; then
13+
#wait until suspend of DisplayLinkManager finish
14+
read -n 1 -t 10 SUSPEND_RESULT < /tmp/PmMessagesPort_out
15+
fi
16+
}
17+
18+
resume_dlm()
19+
{
20+
#resume DisplayLinkManager
21+
echo "R" > /tmp/PmMessagesPort_in
22+
}
23+
case "\$1/\$2" in
24+
pre/*)
25+
suspend_dlm
26+
;;
27+
post/*)
28+
resume_dlm
29+
;;
30+
esac

displaylink.service

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=DisplayLink Manager Service
3+
After=display-manager.service
4+
5+
6+
[Service]
7+
ExecStartPre=/bin/sh -c 'modprobe evdi || (dkms install evdi/$MODVER && modprobe evdi)'
8+
ExecStart=/opt/displaylink/DisplayLinkManager
9+
Restart=always
10+
WorkingDirectory=/opt/displaylink
11+
RestartSec=5

udev.sh

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/sh
2+
# Copyright (c) 2016 DisplayLink (UK) Ltd.
3+
# File autogenerated by udev-installer.sh script
4+
5+
get_displaylink_dev_count()
6+
{
7+
cat /sys/bus/usb/devices/*/idVendor | grep 17e9 | wc -l
8+
}
9+
10+
get_displaylink_symlink_count()
11+
{
12+
root=$1
13+
14+
if [ ! -d "$root/displaylink/by-id" ]; then
15+
echo "0"
16+
return
17+
fi
18+
19+
for f in $(find $root/displaylink/by-id -type l -exec realpath {} \; 2> /dev/null); do
20+
test -c $f && echo $f;
21+
done | wc -l
22+
}
23+
24+
start_displaylink()
25+
{
26+
if [ "$(get_displaylink_dev_count)" != "0" ]; then
27+
start_service
28+
fi
29+
}
30+
31+
stop_displaylink()
32+
{
33+
root=$1
34+
35+
if [ "$(get_displaylink_symlink_count $root)" = "0" ]; then
36+
stop_service
37+
fi
38+
}
39+
40+
create_displaylink_symlink()
41+
{
42+
root=$1
43+
device_id=$2
44+
devnode=$3
45+
46+
mkdir -p $root/displaylink/by-id
47+
ln -sf $devnode $root/displaylink/by-id/$device_id
48+
}
49+
50+
unlink_displaylink_symlink()
51+
{
52+
root=$1
53+
device_id=$2
54+
55+
unlink $root/displaylink/by-id/$device_id 2> /dev/null
56+
(cd $root; rmdir -p --ignore-fail-on-non-empty displaylink/by-id)
57+
}
58+
59+
main()
60+
{
61+
action=$1
62+
root=$2
63+
device_id=$3
64+
devnode=$4
65+
66+
if [ "$action" = "add" ]; then
67+
create_displaylink_symlink $root $device_id $devnode
68+
start_displaylink
69+
elif [ "$action" = "remove" ]; then
70+
unlink_displaylink_symlink "$root" "$device_id"
71+
stop_displaylink "$root"
72+
fi
73+
}
74+
75+
start_service()
76+
{
77+
systemctl start dlm
78+
}
79+
80+
stop_service()
81+
{
82+
systemctl stop dlm
83+
}
84+
85+
main $ACTION $1 $2 $3

0 commit comments

Comments
 (0)