blob: 9ffa6c47f831a84af14ddc6685d2ccd8606571d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/usr/bin/env bash
# Copyright (c) 2015 - 2019 DisplayLink (UK) Ltd.
suspend_displaylink-driver()
{
#flush any bytes in pipe
while read -n 1 -t 1 SUSPEND_RESULT < /tmp/PmMessagesPort_out; do : ; done;
#suspend DisplayLinkManager
echo "S" > /tmp/PmMessagesPort_in
if [[ -p /tmp/PmMessagesPort_out ]]; then
#wait until suspend of DisplayLinkManager finish
read -n 1 -t 10 SUSPEND_RESULT < /tmp/PmMessagesPort_out
fi
}
resume_displaylink-driver()
{
#resume DisplayLinkManager
echo "R" > /tmp/PmMessagesPort_in
}
main_systemd()
{
case "$1/$2" in
pre/*)
suspend_displaylink-driver
;;
post/*)
resume_displaylink-driver
;;
esac
}
main_pm()
{
case "$1" in
suspend|hibernate)
suspend_displaylink-driver
;;
resume|thaw)
resume_displaylink-driver
;;
esac
true
}
DIR=$(cd "$(dirname "$0")" && pwd)
if [[ $DIR == *systemd* ]]; then
main_systemd "$@"
elif [[ $DIR == *pm* ]]; then
main_pm "$@"
fi
|