Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can Linux accept the concept of "virtual hardware"? It would be a kind of program that from the outside behaves like a hardware device (sound card, video card, ...) and from the inside would interact with one or more pieces of hardware itself. It's something similar to the C++ concept of incapsulation.
It could be something as simple as an improved interface for a piece of hardware or something more complex that would coordinate the behaviour of a part of the system.
I would really appreciate any pointers in the right direction.
The closest I've seen accomplished was the Windows concept of "virtual CD", but I was wondering if you can take it further, and where to begin but with Linux
as far as CD's are concerned, Linux can use a loopback device to mount a cd image as if it were a real cd, but the principles are much more fundamental and low level than any "virtual" crap in windows. Loopback devices can be used i a number of area, like abstracting video devices and such. I've not seen a lot of projects that use them, but it's certainly possible. Projects like ALSA can also create virtual soundcards, so you can implitcly play back sound from any program into it's virtual input and do whatever you want with it from then on.
To linux, "everything is a file": My hard drive is the file /dev/hda, my mouse is the file /dev/mouse, etc etc
So it should be pretty much trivial to have software pretend to be hardware - just tell the software to accept input from and give output to a /dev file, and as far as Linux is concerned, that /dev file is as much hardware as anything else.
Do you mean virtual hardware such as virtual machines like Xen, Qemu, Bochs and that commercial one whose name escapes me? Cos that sort of virtualisation has been around on linux for a few years now.
Originally posted by oneandoneis2 To linux, "everything is a file": My hard drive is the file /dev/hda, my mouse is the file /dev/mouse, etc etc
That is a bit misleading. I think it's "everything is a stream" or "everything is a file stream".
I'm trying to figure out how I can perform low-level I/O operations based on that concept. Is it enough to for instance declare a FILE or a std::i(o)(f)stream for C/C++ and manipulate that?
Edit:
Moreover, can I overwrite something like /dev/mouse with an application or can I supply my own applications that can replace or mimick the behaviour of pieces of hardware?
Last edited by Aphex_Twin2; 05-23-2005 at 09:30 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.