File: phantom.dev

package info (click to toggle)
powerman 2.4.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,432 kB
  • sloc: ansic: 19,458; sh: 7,225; yacc: 694; makefile: 455; lex: 272
file content (71 lines) | stat: -rw-r--r-- 1,213 bytes parent folder | download | duplicates (2)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# Rackable Phantom v3 and v4.
#
specification  "phantom" {
	timeout 	15.0

	plug name { "1" }

	script login {
		send "\036\035"	# enter "shell mode"
		expect "ok\r"
	}
	script status {
		send "P?"
		expect "(0|1)\r"
		setplugstate "1" $1 on="1" off="0"
	}
	script on {
		send "P?"
		expect "(0|1)\r"
		setplugstate "1" $1 on="1" off="0"
		ifoff {
			send "PT"
			expect "ok\r"
		}
	}
	script off {
		send "P?"
		expect "(0|1)\r"
		setplugstate "1" $1 on="1" off="0"
		ifon {
			send "PT"
			expect "ok\r"
		}
	}
	script cycle {
		send "P?"
		expect "(0|1)\r"
		setplugstate "1" $1 on="1" off="0"
		ifon {
			send "PT"
			expect "ok\r"
			delay 4
		}
		send "PT"
		expect "ok\r"
	}
	script beacon_on {
		send "L1"	# LED on
		expect "ok\r"
		send "B1"	# blink LED
		expect "ok\r"
	}
	script beacon_off {
		send "L0"	# LED off
		expect "ok\r"
		send "B0"	# unblink LED
		expect "ok\r"
	}
	script status_beacon {
		send "L?"	# get LED status 1=on, 0=off, B=blink
		expect "(0|1|B)\r" 
		setplugstate "1" $1 on="(B|1)" off="0"
	}
# N.B. phantom 3 requires probe #, phantom 4 ignores it
	script status_temp {
		send "T0"	# get temp probe 0
		expect "([0-9]+)\r" # value is 8-bit Celsius  
		setplugstate "1" $1
	}
}