Notices


Reply
Thread Tools
esthreel's Avatar
Posts: 259 | Thanked: 55 times | Joined on Apr 2010 @ Vilnius, Lithuania
#1
Is it possible make an ON button using QBW for WOL?
__________________
Mobile History: Nokia N900, 6300, Siemens CX75, SX1, CX65, Nokia 3100, 8210.
 
Posts: 422 | Thanked: 244 times | Joined on Feb 2008
#2
I couldn't get any of the gui based wol apps to work from the command line. So I found this script (can't remember where, so can't credit):

Code:
#! /usr/bin/python
# Wake-On-LAN
# Copyright (C) 2002 by Micro Systems Marc Balmer
# Written by Marc Balmer, marc@msys.ch, http://www.msys.ch/
# This code is free software under the GPL
#
# Modified by paulkoan to allow command line parameters
#
import struct, socket, sys
def WakeOnLan(ethernet_address,bc):
 # 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, (bc, 9))
 s.close()
# Example use
print(sys.argv[1],sys.argv[2]) 
WakeOnLan(sys.argv[1],sys.argv[2])
Put it in /opt/wol.py perhaps.

The qbw command would then be:

Code:
  /opt/wol.py  <mac address> <network broadcast address>
The broadcast address is the inverse of your network address.

So if your IP address is 192.168.1.100 255.255.255.0 the broadcast address is 192.168.1.255

Cheers,

Paul

Last edited by paulkoan; 2011-03-16 at 11:17.
 

The Following User Says Thank You to paulkoan For This Useful Post:
esthreel's Avatar
Posts: 259 | Thanked: 55 times | Joined on Apr 2010 @ Vilnius, Lithuania
#3
No success so far, but I found this.
http://talk.maemo.org/showpost.php?p=652101&postcount=4
__________________
Mobile History: Nokia N900, 6300, Siemens CX75, SX1, CX65, Nokia 3100, 8210.
 
Posts: 422 | Thanked: 244 times | Joined on Feb 2008
#4
Looks like the same script, aside from the modifications I made to allow command line parameters.

But it shows who created it so I'll amend my post.

I use this script all the time so your issue is probably not related to the script. Try it from a term session and see what you get.
 
esthreel's Avatar
Posts: 259 | Thanked: 55 times | Joined on Apr 2010 @ Vilnius, Lithuania
#5
Originally Posted by paulkoan View Post
Looks like the same script, aside from the modifications I made to allow command line parameters.

But it shows who created it so I'll amend my post.

I use this script all the time so your issue is probably not related to the script. Try it from a term session and see what you get.
OK, now it works, had to CHMOD it Thanks a lot.
__________________
Mobile History: Nokia N900, 6300, Siemens CX75, SX1, CX65, Nokia 3100, 8210.

Last edited by esthreel; 2011-03-16 at 17:43.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 14:57.