Solved

Can I implement these function when reboot

Posted on 2000-04-03
2
191 Views
Last Modified: 2010-04-02
In my project,there is a PCI card which controls two harddisk's power. Each of the harddisk has a operating system.I want to write a program, in which I click the button and a signal will be sent to the card. Then the card will let the PC reboot,  and switch the power from one harddisk to another.
In this way, the machine is abnormally reboot .Can I let the PC normally reboot and implement this function? In a word, what is the right time that I send a signal to the card after I let the windows normally reboot(The card has a pin connected to the reset line)
0
Comment
Question by:seuwind
2 Comments
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2682745
this doesn't sound like a C++ programming question .. more of a operating system / hardware question.

good luck getting an answer here.
0
 
LVL 1

Accepted Solution

by:
LordDragon earned 100 total points
ID: 2709130
I'll answer it anyway ...

....you need to patch into the boot process fairly early (for windows) or into the reboot code fairly late (Linux).

For windows 95/98/Win31/DOS:

1) replace the autoexec.bat file with one which calls a program which:
    a) restores the original autoexec.bat file
    b) flips whatever needs flipping on the card
    c) reboots the computer to use the other hard-drive
2) Cause windows to reboot the computer (many ways to do this).

For NT:
I don't know

For Linux (and most other UNI):
1) You'll need a bit of research here, but you need to find the init.d script which controls the shutdown process, and insert code to flip the card information right before the machine is rebooted (I'd trigger it on the presence of a file in the root directory, which is deleted right before the flip [after it's seen of course]), and then all you have to do is create the file and issue a reboot ('init 6' I think).
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question