Solved

Can I implement these function when reboot

Posted on 2000-04-03
2
192 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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.

789 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