Difference between revisions of "Kernel-power"
From Bashlinux
(Redirected page to Power management) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | #REDIRECT [[Power management]] |
||
− | __NOTOC__ |
||
− | = Power Management = |
||
− | Power administration on uWink terminals is done by different applications, based on which hardware is handled. |
||
− | * ACPI for macmini, used to set "Suspend on RAM" |
||
− | * dpms on DT, used to turn off the screen |
||
− | |||
− | == ACPI == |
||
− | ==== Suspend ==== |
||
− | Issue the following command on the terminal to be suspended: |
||
− | |||
− | <pre><nowiki> |
||
− | echo mem > /sys/power/state |
||
− | </nowiki></pre> |
||
− | |||
− | |||
− | ==== Wake ==== |
||
− | From a remote terminal isue the following command: |
||
− | |||
− | <pre><nowiki> |
||
− | ether-wake 11:22:33:AA:BB:CC |
||
− | </nowiki></pre> |
||
− | |||
− | where `11:22:33:AA:BB:CC` is the mac address of the terminal to be waked up. |
||
− | |||
− | Alternatively the following python code could be useful to wake up a terminal |
||
− | |||
− | <pre><nowiki> |
||
− | #!/usr/bin/python |
||
− | |||
− | # Wake-On-LAN |
||
− | # |
||
− | # Copyright (C) 2002 by Micro Systems Marc Balmer |
||
− | # Written by Marc Balmer, [email protected], http://www.msys.ch/ |
||
− | # This code is free software under the GPL |
||
− | |||
− | import struct, socket |
||
− | |||
− | def WakeOnLan(ethernet_address): |
||
− | |||
− | # Construct a six-byte hardware address |
||
− | |||
− | addr_byte = ethernet_address.split(':') |
||
− | hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16), |
||
− | int(addr_byte[1], 16), |
||
− | int(addr_byte[2], 16), |
||
− | int(addr_byte[3], 16), |
||
− | int(addr_byte[4], 16), |
||
− | int(addr_byte[5], 16)) |
||
− | |||
− | # Build the Wake-On-LAN "Magic Packet"... |
||
− | |||
− | msg = '\xff' * 6 + hw_addr * 16 |
||
− | |||
− | # ...and send it to the broadcast address using UDP |
||
− | |||
− | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
||
− | s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) |
||
− | s.sendto(msg, ('<broadcast>', 9)) |
||
− | s.close() |
||
− | |||
− | # Example use |
||
− | WakeOnLan('00:16:CB:A2:96:C4') |
||
− | </nowiki></pre> |
||
− | |||
− | |||
− | == dpms == |
||
− | * Screen off* |
||
− | To power off screen run the following command: |
||
− | |||
− | <pre><nowiki> |
||
− | /usr/sbin/vbetool dpms off |
||
− | </nowiki></pre> |
||
− | |||
− | '''Screen on''' |
||
− | To power on screen run the following command: |
||
− | |||
− | <pre><nowiki> |
||
− | /usr/sbin/vbetool dpms on |
||
− | </nowiki></pre> |
Latest revision as of 03:10, 11 June 2015
Redirect to: