summaryrefslogtreecommitdiff
path: root/x11-drivers/displaylink-driver/files/pm-displaylink
blob: a31bfc0bae57a73060668aaecf1595116d9c1a77 (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
#!/bin/bash 
# Copyright (c) 2015 - 2016 DisplayLink (UK) Ltd. 
 
suspend_dlm()
{
  #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 [ -f /tmp/PmMessagesPort_out ]; then
    #wait until suspend of DisplayLinkManager finish 
    read -n 1 -t 10 SUSPEND_RESULT < /tmp/PmMessagesPort_out
  fi
}
 
resume_dlm()
{
  #resume DisplayLinkManager 
  echo "R" > /tmp/PmMessagesPort_in
}
 
case "$1" in
  thaw)
    resume_dlm
    ;;
  hibernate)
    suspend_dlm
    ;;
  suspend)
    suspend_dlm
    ;;
  resume)
    resume_dlm
    ;;
esac