Changeset 305
- Timestamp:
- May 10, 2011, 3:13:20 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
powerbar/npm4000.py
r75 r305 7 7 # XXX: Make proper classes for use 8 8 # XXX: Documentation 9 # 10 # TODO: Make it work for the NPM2000 series, which are using a different codes to address individual ports. 11 # 9 12 # 10 13 # Licence: BSD … … 146 149 def getStatusAll(): 147 150 raw_status= doCommand('status') 148 for i in range(1, 25):151 for i in range(1,MAX_PORTS+1): 149 152 print "Port %02i [%s]:" % (i, getPortName(i)), 150 153 if getPortState(i,raw_status): … … 154 157 155 158 def togglePort(port): 156 if getPortState(port): 159 raw_status= doCommand('status') 160 if getPortState(port,raw_status): 157 161 doCommand('portOff',port) 158 162 else: … … 169 173 170 174 print "TEST: Enable and disable ports one by one" 171 for i in range(1, 25):175 for i in range(1,MAX_PORTS+1): 172 176 print getPortName(i) 173 177 doCommand('portOn', getPortHex(i)) … … 272 276 if opt_action == "toggle": 273 277 if opt_port == "all": 274 for i in range(1, 25):278 for i in range(1,MAX_PORTS+1): 275 279 togglePort(getPortHex(i)) 276 280 else: … … 285 289 doCommand("allPortsOff"); 286 290 else: 287 doCommand("portO n", opt_port)291 doCommand("portOff", opt_port) 288 292 289 293
Note:
See TracChangeset
for help on using the changeset viewer.