ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
A friend of mine is far away from home where he needs to boot his computer remotely. This computer is connected to a running one via a null-modem cable. Assuming his computer has the wake-on-ring feature enabled, and the pins no. 9 of each computer are connected via the null-modem cable, is it possible to set pin 9 of the running computer so that it wakes the other one?
Here's the program I wrote to achieve this:
int open_port (char *device)
if (fd == -1)
void ring (int fd)
int main (int argc,char *argv)
if (argc != 2)
fprintf(stderr,"%s: Wrong number of arguments!\n",argv);
if (res == -1)
The RI pin of a PC serial port is an input. As such, you cannot control it, only read its status. If the peer computer is properly configured, you should be able to wake it by asserting the RI input. You can do this by cabling the RI input of the sleeping computer to one of the pins that are controllable outputs of the controlling computer. Those pins include DTR and RTS. You would then programmatically assert the pin using the TIOCMSETioctl() call.
Most commercially available cables that I have seen do not use the RI pin. You may have to get a cable made or make it yourself. If the application requires only the 'wake-up' function, then your cable should only require two conductors: RTS or DTR, and a signal ground.
IMHO it's a good thing that you replied, since you gave me the answer I was looking for. Eventually I don't remember we managed to have a working WOR and my program didn't work, which is normal according to your answer. Next time we will make a custom cable !