• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

Wake on LAN

Started by Andy P., 2012.09.08, 13:28:51

Previous topic - Next topic

Andy P.

/*magic.cmd*/
/*Wake on Lan in REXX*/
MAC = '11:22:33:44:55:66';
SAY MAC;
A = X2C(SUBSTR(MAC,1,2));
B = X2C(SUBSTR(MAC,4,2));
C = X2C(SUBSTR(MAC,7,2));
D = X2C(SUBSTR(MAC,10,2));
E = X2C(SUBSTR(MAC,13,2));
F = X2C(SUBSTR(MAC,16,2));
X = A||B||C||D||E||F;
call RxFuncAdd 'SockLoadFuncs', 'rxsock', 'SockLoadFuncs';
call SockLoadFuncs('*'); 
SCT = SockSocket('AF_INET', 'SOCK_DGRAM', 'IPPROTO_UDP');
RC = SockSetSockOpt(SCT, 'SOL_SOCKET', 'SO_BROADCAST', '1');
RC = SockIOCtl(SCT, 'FIONBIO', '0');
adr.!family = 'AF_INET';
adr.!addr   = '255.255.255.255';
adr.!port   = 9;
S = COPIES(D2C(255) ,6);
T = COPIES(X ,16);
G = COPIES(D2C(0) ,6);
RC = SockConnect(SCT, "adr.!");
STG = S||T||G;
SAY STG;
RC = SockSend(SCT, STG);
call SockSoClose SCT;
exit;

jep

Hello,

Neat!

Is it possible with rexx to find out the MAC address on the computers on the LAN?

Would it be interesting to only specify/use the hostname of the computer and with that run the magic.cmd code to wake that specific computer.

//Jan-Erik

DougB

I have tried it on the four of the five computers, that I have, where it should work. Only one will power on. Of course, it isn't the one that I would like to use it on. I suspect that the problem is that windows turns off the feature by default, and the eCS drivers (Multimac for Intel, Multimac for NVIDIA, and GENMAC for Broadcom) doesn't enable it at shutdown. The one that does work, is a Realtek 8139, using the RTSND driver. I need to find more time to play with this, but it does look like it does what it is supposed to do.  Thanks...   :)

DougB

Yes, you need to enable magic packets in the windows drivers. Then, the machines will turn on. However, if you run eCS, the driver seems to know nothing about enabling magic packet support, and the machine will not power on after running eCS. I tried this with my Lenovo ThinkPad T510, using the Multimac Intel driver from e1000e-0.2.3.wpi. Some other eCS drivers may work.

DougB

More information:

With my A8N-SLI motherboard, using the driver from nveth-0.1.10.wpi, I went to windows XP, and enabled the magic packets option in the driver. Now it will wake up, even after running eCS. This happens to be the one that I want to be able to wake up, so that is good.

On my IBM ThinkPad T43 (1871-W8M), I can't seem to convince it to work. I suspect that I may not have found the right BIOS, and/or, windows settings, yet.

On my antique IBM ThinkPad A22e, turning on the setting in the BIOS did the trick.

It appears that the eCS drivers may not mess with the magic packets feature, but it also appears that my Lenovo T510, using the Multimac Intel driver from e1000e-0.2.3.wpi, does turn off the feature, unless it is specifically enabled by the driver at shutdown. This is probably a "security" feature. So, the driver needs to enable magic packets at shutdown for Magic.CMD to be able to turn it back on. Not important for what I want to do, but it may help others.

I suspect that it is NOT a good idea to enable laptops to power on with a magic packet anyway. If it gets one at an unexpected time, it may cause system damage.

Now, the next question that I have, is how can one tell a remote computer to shut down (cleanly, of course), from a program? I can see this being useful to power on the machine that I want to backup to, do the backup, then tell it to shut down. Of course, the shutdown is really an indication that "this" machine is finished. some other machine may also be doing a backup, and it would not be good to pull the plug on that.

DougB

QuoteOn my IBM ThinkPad T43 (1871-W8M), I can't seem to convince it to work. I suspect that I may not have found the right BIOS, and/or, windows settings, yet.

Exactly. It seems that you need to enable the LAN ROM feature, before you can enable the magic packet feature. Oddly enough, once it is enabled, you can turn off the ROM feature again.

So, the bottom line is that the script works, but the user does need to do more than just use the script to make it turn a machine on. It also looks like the Multimac project will need to support the feature, depending on what windows version, and NIC is being used. I have no idea what other operating systems would need to make them allow a power on.

Andy P.

#6
There is no need to care especially about WakeOnLan in MultiMac. If the drivers don't touch the registers, everything is fine. Fortunately, WakeOnLan works on BIOS level and is similar to WakeOnKeyboard. There are only few points:
1.) Some computer manufacturer sells their machines with power off=S5 to meet certain green terms. Swich this back to S3.
2.) OSes have the possibility to mix this up. Windows (what else) will do this by change the registers of network cards to not listen to magic packets.
So you have to configure the card driver to set the network card back to listening. There are some rare Linux distributions that do this too, but the major part does switch WakeonLan back on at shutdown.
3.) There are some network cards with especially no WakeOnLan (e.G some 3Com), that can't be turn. If in doubt, read the manual of the Card.

WakeOnLan standards specifies a password for magic packets. Some network cards can be set to check a WakeOnLan-passwort before waking up the computer. I don't know which card uses this, nor how the password can be set. If you have such card, the password goes to the variable G (default 0x000000000000) in the same manner like the variable X.
The Mac can be found with the command line: arp -a

To say this clear:
This little rexx script is just a finger exercise and have no copyright value in my point of view, so I gave no copyright disclaimer. Feel free to use it.
As usual for WakeOnLan, you are not sticked to eCs- computers. Also Windows-, Linux- and MAC- driven computers can be awakened. Even non-computer systems can be switched on (If they know about WakeOnLan). In my case, I wrote this to switch on my satellite receiver from my eCs-Box ;)
Andy

DougB

QuoteThere is no need to care especially about WakeOnLan in MultiMac.

Unfortunately, that is not true, for two main reasons:

1) There needs to be a way for eCS to turn on the feature. It seems that in most cases, it is disabled. If the user does not have another OS installed, that is capable of turning it on, it can't be done. It seems that BIOS no longer has control over that, as it did in earlier machines. BIOS can prevent it from being turned on, but it cannot turn it on by itself.

2) It seems that newer machines (my Lenovo ThinkPad T510, for instance), will not leave that setting turned on, unless the driver enables it at shutdown (obviously some sort of security feature). So, if I run Win7, and enable magic packets, I can shut down, and I can use your program (well done, by the way) to turn it back on. Now, if I boot to eCS, it works fine, until I shut down, then I cannot turn it back on, using magic packets, until I run windows again, and that requires a manual power on, using the machine switch, not magic packets.

Those two "problems" should be addressed, and Multimac seems to be the way that it needs to be done (at least for the the devices operated by the Multimac driver).

I have opened an incident in TRAC for Multimac. Whether it will be fixed, or not, is up to the developers.

eirik

There is obviously more to suspend and resume than many of us expected.  While it would be nice to have suspend and resume working including wake up of LAN, I view it more important to get the other FnFX buttons working, in particular the one so that eCS laptop users can hook their PC to a beamer and use eCS for their presentations (rather than going to their Win partitions).  In addition to increasing the value of eCS for current users, this is also a nice way of reminding other computer users that there are other platforms than Win out there that do the job (at least as well as Win does).

How far are we from a workable solution.  I do not know as reports vary depending on what hardware people have.  For example on my Lenovo Thinkpad T410, the sound mute button works (and integrates with pmtpos2), the Fn buttons for adjusting brightness and light up the keyboard work, while volume adjustment does not work.

Constructive regards / Eirik