Linux - Virtualization and CloudThis forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.
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.
I would like to ask how to create virtual usb device - for the user program the device shall seem to be real but i want to tap all read, writes, ioctrl and events and to handle them in my custom handlers.
Seeing it is virtualizion in terms of kvm etc in this section, why don't you just create another virtual hard disk which everyone can access and allow it to be shared rather than trying to mount a fake usb drive?
I want to intercept all driver requests - maybe there is some concept of drive stub and driver backend ?
maybe some technique witch parallelization employees to tap the I/O calls ...
Is about intercepting hardware interrupts. I would imagine what you want to do is closely related to something like this, but it could be a disk of any kind. Hope it puts you on the right track but in all honesty I do not know much about that sort of thing since it has never really interested me much on trying to access raw system calls and intercepting data on the storage stack. Never found a need for it. It eludes me as somewhat of an obscure requirement to have this sort of control over a hard disk.
It does however sound like an interesting project you have at hand but a little steep learning curve which I think I will pass.
Enjoy the tinkering.
Last edited by ericson007; 09-01-2015 at 06:14 PM.
What usb device are you trying to simulate? A hard drive? A printer? A keyboard? If it's a simulated device, why does it have to be usb? Why not sata or rs232?
You need to provide a lot more information than "I want to simulate a usb device" if you want anybody to provide any useful advice. Namely WHAT usb device and WHY.
Last edited by suicidaleggroll; 09-02-2015 at 05:21 PM.
That's the exact same thing you keep saying, it doesn't help. Maybe try another way of getting your point across, maybe an example?
Let's try this:
Simulators simulate things, they simulate things so that other things THINK that they're talking to the real thing, when they're actually talking to the simulator. Flight simulators pretend to be airplanes, they're used by pilots to pretend they're controlling a real plane, to gain practice. GPS simulators are used to test GPS receivers, they pretend to be a real satellite constellation and the GPS receiver thinks it's listening to broadcasts from real satellites and reacts accordingly. With that in mind, what, specifically, will your simulator be talking to, and what does that person/application/driver THINK it's talking to instead of your simulator?
Or perhaps this:
Applications do not speak USB. They do not talk to USB devices, they don't know how. Applications talk to drivers, drivers talk to USB devices. Do you want to simulate a USB device, so that a driver will talk to you and think it's talking to the real thing? In that case, you need to get MUCH more specific, because every USB device talks differently. If the driver thinks it's talking to a USB keyboard and your simulator doesn't respond like a USB keyboard, the driver will reject you. Every USB device has its own driver that talks to it and only it, and the interaction between that USB device and its driver is completely different than the interaction between any other USB device and its driver. USB devices and drivers come in pairs, you need to pick a driver you want to talk to, and then pretend to be the device that driver expects. USB is NOT a simple or universal interface. It's very complicated, and the packetizing that each device uses is completely different. If you don't pick a SPECIFIC device to simulate, you will never be enumerated and the OS will just ignore you.
Or do you want to simulate a driver that applications will talk to? In that case, sure you can create a kernel module that creates a character device in /dev/. Applications can open that device, they can read from it and write to it, and all of those reads and writes will be handled by your kernel module, but what makes this USB? USB is a physical interface, the point of drivers is to abstract away the physical interface so that the applications don't need to know the details. The application has no idea it's talking to a USB device, it doesn't care, it might as well be a firewire device or a PCI device or a PS/2 device or a SATA device...the physical interface is abstracted away, that's the point of drivers.
Last edited by suicidaleggroll; 09-03-2015 at 07:24 PM.
Or do you want to simulate a driver that applications will talk to? In that case, sure you can create a kernel module that creates a character device in /dev/. Applications can open that device, they can read from it and write to it, and all of those reads and writes will be handled by your kernel module, but what makes this USB? USB is a physical interface, the point of drivers is to abstract away the physical interface so that the applications don't need to know the details. The application has no idea it's talking to a USB device, it doesn't care, it might as well be a firewire device or a PCI device or a PS/2 device or a SATA device...the physical interface is abstracted away, that's the point of drivers.
If it's a character device, then it's NOT USB. There is a reason I said OR in my two examples. You cannot have both. Either your simulator speaks USB, emulates a specific device, and talks to a driver that then translates that data for applications, OR your simulator speaks directly to applications and is NOT USB.
This discussion is just going in circles. I won't be responding to this thread anymore until you start actually answering some of the MYRIAD of questions that have been asked of you. NOBODY can provide the information you need until you tell us what it IS that you need, in actual words and examples.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.