[QEMU/KVM] Use KVM switch to switch mouse/kayboard between host and VM

I finally have my QEMU/KVM setup running and working as I want it, except for one thing. I have a KVM switch (a piece of hardware not the hypervisor ) to switch audio and video. It also offers the feature to switch mouse/keyboard between to Computers. Here is the relevant excerpt from my lsusb:
Bus 002 Device 048: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 002 Device 047: ID 0557:8021 ATEN International Co., Ltd CS1764A [CubiQ DVI KVMP Switch]
Bus 002 Device 046: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 002 Device 045: ID 0557:8021 ATEN International Co., Ltd CS1764A [CubiQ DVI KVMP Switch]
The device named "Logitech, Inc. Unifying Receiver" is the dongle for my mouse and keyboard. The first problem is that both devices (in both states of the switch they both appear) have the same device id 046d:c52b. This can be solved by telling qemu to identify the device by #bus.#device instead of the id. The problem is that after each switching the device number increases. This makes sense as for the system the switching process is as if the device was unplugged and plugged in in a different usb port. Therefore the device would probably be disconnected from the VM when it was assigned on the VM's startup (is there a way to add usb devices on the fly to a vm without typing an add_usb command in the qemu shell). Do you have any ideas what I could do?
EDIT: Just found about QMP. Would it be possible to save an initial condition (mouse/keyboard is on host) and fetch new devices busses after switching (udev?) and switch the saved sate? If the state is now "m/k should be on the vm" one could send qemu an adequate add command.
EDIT2: I found out that my mainboard's usb is organized using 3 usb controllers (2x2.0, 1x3.0 each with 4 ports). I want to pass one of those PCI controllers to the VM but all I get is a black screen.
EDIT3: I tried the other usb controller and it worked. Well, kind of. I moved the mouse in a circle and made a right click. Than I was not able to use the mouse or the keyboard anymore. Should I consider buying a PCI USB2.0 controller as that might be easier to forward?
Last edited by fkoehler (2015-04-29 23:50:07)

This article has someinteresting information in the comments. You don't have to use a kvm switch neccessarily. I for one prefer a software solution.
Okay, so to make things clear: I do not switch keyboard/mouse. I keep them shared between both OS, using Synergy. The host OS runs a web server, and the guest OS runs a client – they exchange mouse position information, so that at any time only one of them receives ‘clicks’. This is great for both multi- and single-monitor setups.
Another story is that I have two video outputs connected to a single monitor, and I would like to switch between them without using the buttons on the monitor itself. For this, I use the I2C that is embedded within HDMI or DP.
Almost all monitors support DDC, but there are scarce apps that can make us of it. There is DDCcontrol for linux, but it is completely outdated, and failed to work with my particular monitor. So I ended up getting to know the VESA DDC standard, reading the source of that tool and several similar ones, and created a simple C program (source) that works in case of my setup. Most likely it will not work elsewhere, but it should give you a nice starting point for communicating with the monitor. The fragile spots are line 41 – you may need to change the i2c bus number the the one correct for your system, and you may need to prepare other data to send to the monitor (68 and 71) if you want to switch between other outputs than I do. Refer to the standard in order to prepare them.
As for how to change his source code to help you, I am not of much help right now as I do not know the DDC protocol. Hope that helps.
Last edited by noctlos (2015-04-30 16:01:45)

Similar Messages

  • On windows8 how do I switch a photosmart 6520 printer between offline and online

    on windows8 how do I switch a photosmart 6520 printer between offline and online  

    Hi 1jsl
    I'd like to help you get the printer communicating with the computer. Please follow the instructions in the following document. This document addresses 'Printer is offline' Message Displays on the Computer and the Printer Will Not Print as well as,
    Printer won't print
    Print jobs are stuck in the print queue (A log of print jobs waiting to print)
    No response from the printer
    Thanks for joining the HP Forums, I hope this helps.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • Networking between host and qemu imag for telnet

    Hello.
    I want to start doing test and learning a bit about networking.
    But I only have a computer, and it doesn't have even hardware emulation, making the use of any modern distro as a virtual machine painfuly slow.
    So I downloaded a floppy distro.. and I manage to get a virtual network card working. But there is no ping between host and guest. I  can't Telnet neither, of course.
    Qemu man page and google are confusing me a lot. It speack of redirecting ports.. no solution to that
    I don t have firewall, as I don't have Internet at home.
    What can i do now? :S
    Thanks in advance

    I think I must stop drinking so much cofee on the afternoon, lol
    Thank you very much for adding my reply!
    bernarcher wrote:
    vladimir_1922, the moderators receiveived this report message from you:
    Yes, I checked that too... No result.
    Maybe it is an issue with /etc/rc.conf. Some months ago it changed on the format who manages the network. May it be outdated?
    Obviously, you did inadvertently use the "Report" button to submit this.
    But don't worry, this happens quite often.
    I tough a bit about the problem, and followed the steps on the Gentoo Wiki for sharing a conection between two guests, and I found the same problem, but with the vbe module being unabaible. After a bit of rage, I realized two possible workarounds:
    First thing, is that I compile my kernel. As I don't have KVM or Hardware emulation, I just don't compile any virtual machine module, to save memory. BUT, I do have the /dev/net/tun device who qemu can't recognice (yes, I tried to run qemu as root), so It seems that it is compiled after all
    The second thing, is that I also stripped the daemons and services at bootup, as I don't have Internet, or othercomputers, I don't need most of them. Between the services I don't start at bootup is the netwprk daemon... but if i try to start it, all it does is delay the bootup for almost 2 minutes looking for a network :S
    So, I'll just copy my /etc/rc.conf, where I just did the changes of the wiki. Maybe I did something wrong, maybe I lack something.
    Any help will be must appreciated
    # /etc/rc.conf - Main Configuration for Arch Linux
    # See 'man 5 rc.conf' for more details
    # LOCALIZATION
    HARDWARECLOCK=
    TIMEZONE="Europe/London"
    KEYMAP="es"
    #CONSOLEFONT="Lat2-Terminus16"
    CONSOLEMAP=
    LOCALE=
    DAEMON_LOCALE="yes"
    USECOLOR="yes"
    # HARDWARE
    MODULES=(snd_pcm_oss snd_mixer_oss snd_seq_oss bridge tun)
    USEDMRAID="no"
    USEBTRFS="no"
    USELVM="no"
    # NETWORKING
    HOSTNAME="arch.laptop"
    interface=eth0
    address=
    netmask=
    broadcast=
    gateway=
    NETWORK_PERSIST="no"
    eth0="eth0 0.0.0.0"
    br0="br0 192.168.0.3 netmask 255.255.255.0 broadcast 192.168.0.255"
    INTERFACES=(eth0 br0)
    gateway="default gw 192.168.0.1"
    ROUTES=(gateway)
    # DAEMONS
    DAEMONS=(syslog-ng !network crond)

  • Webauth url redirection fail with firewall between host and switch

    Hi All,
    I noticed some old posts (2012) on this specific issue (thanks Tarik) - this is exactly our problem.  Web auth redirect URL gets dropped if stateful firewall is between webauth host and switch management interface.  Aaron at Cisco live london kinda hinted about maybe Cisco working on this ?  We can't disable stateful inspection
    Is there any other solutions or workarounds ?
    "Although this approach introduces additional hops in the return path from the switch to the host, it produces negligible load on the default router and intervening infrastructure since only the WebAuth traffic from the switch to the host follows this path. In campus designs that do not use SVIs on the data VLAN,6 a default route is typically already configured. In this case, no additional configuration is required to support WebAuth. However, problems may arise in the case in which traffic to the default router is bridged through a stateful firewall. The original SYN packet in the TCP handshake is consumed by the access switch, so the first packet that the firewall sees is the SYN-ACK packet from the access switch. Stateful firewalls typically drop SYN-ACK packets if they have not seen the original SYN packet.
    In this case, you will need to turn off stateful inspection for ports 80 and 443 on the firewall."
    http://www.cisco.com/en/US/prod/collateral/iosswrel/ps6537/ps6586/ps6638/app_note_c27-577494.html
    Cheers
    Peter.                

    There is  workaround i haven't tested which is available from 15.0 i think, which is the option to create svi's on your access layer switches for the guest/user vlans, without actually enabling routing between them, it sounds weird, but i have been told that this combined is a possible woraround, that will cause the switch to use the svi interfaces when responding with the SYN-ACK, thus not being sent to its ip default-gateway.

  • Why wont Illustrator CC let me use Alt + Scroll on my mouse to zoom in and out smoothly?

    When i use Illustrator CS6 i am able to zoom in and out smothly by pressing my option key on my Mac and then scroll with my mouse. It wont let me do that in Illustrator CC, why not? Also i should not that this zoom does not use the zoom tool on the left hand tool bar.
    Thank you for any help.

    Did Option+mouse scroll ever zoom smoothly? (Wish it did.)
    For me it zooms in hops: 50, 66.67, 100, 150, 200 etc. same as when you click with the zoom tool.
    You can of course enter exact zoom %s at the bottom left of the Illie window but that’s not smooth either.

  • Using a Fat 32 partition to share between OSX and WinXP

    If I take a hard drive and partition half of it as NTFS and install Win XP on it using Bootcamp and partition half of it as FAT32 and leave it as an empty space, and have it as one of the drives in a Mac Pro running OSX, would I be able to copy files to and from the FAT32 partition when running either Win XP or OSX so that the files could be shared?
    Can you create partitions on a drive of different formats such as NTFS, FAT32 and also the Mac's format (I forget the name of it)? Could they be made bootable partitions?
    Thanks for any advice.

    It takes an extra step to format it to NTFS from Windows, which works fine. I've done that a number of times, and have Vista on its own drive with a couple NTFS and one FAT32 partition. Just create the one to be NTFS as FAT, give it a name (NTFS_FAT) so you are sure which it will be and the size.
    I never use BootCamp, no need for that but might try. I just format it with Disk Utility. I never touch my OS X boot drive at all, and in fact pull it when installing Vista.

  • What is the use of AET? What are the differences between AET and EEWB?

    Hi,
    I would like to know about AET? What is the use of AET? What are the differences between AET and EEWB? Please help me out?
    Thanks,
    Satish

    Hi
    You can refer the following links for your question.
    Difference between AET and EEWB
    What is the use of AET? What are the differences between AET and EEWB?
    Difference between EEWB - UI Configuration Tool - AET
    http://senthilsapcrm.wordpress.com/2010/02/04/adding-custom-fields-in-sap-crm-7-0-using-aet/
    What is the main difference between eewb and aet tool ?
    Hope it is useful.
    Thanks and regards
    Preeti Viswanath

  • Home use KVM switch for Ultra60 , Blade 100& Intel Boxes

    I have go a Ultra 60, a Blade100 and some Intel boxes at home. Tired of connecting and disconnecting the monitors and keep my desk full of mouses and keyboards. Any one know which type of KVM switch is suitable capable for these boxes and does not cost much? Thanks for your suggestion!

    Hello,
    <i>... Ultra 60 not easily support I still want to know if there is some option to support the Blade 100 in the KVM as well.</i>
    The Ultra 60 and other systems with the single Mini-DIN connector for the keyboard with the mouse attached require a converter to be able to attach a PS/2-keyboard and -mouse. The keyboards are available for different countries with different layouts (mappings). There are DIP-switches at the keyboard, the settings are read by the system to detect the mapping of the keyboard. There are additional function keys (Help, Stop, ..., Compose, Power On/Off, ...).
    A PS/2 keyboard lacks these switches and the additonal function keys. These features must be emulated by the adapter/emulator.
    You can attach a PC USB keyboard (and mouse) to Suns with USB keyboard port, but these keyboards still lack the addtional function keys and the capability to "tell" the system the national mapping. If the system can't detect the locale, a standard mapping (US) is used.
    The keyboard mapping can be forced when the operating system has been loaded. Review the posting by J.Keil on the Sun OS Forum about using a non-self-identifying keyboard.
    <b>Finnish KB on Fujitsu-Siemens Sparc </b>
    I hope this helps other people when they use the search function ...
    Michael

  • [GeForce 6] Video distortion using KVM switches

    When connected through a KVM switch the video quality from my main computer using a 128mb GF6800 from MSI becomes distorted, blurry, and the text very hard to read.  However, my second computer using a GF4 4200ti looks fine.
    I thought it was a defective switch but I've tried 2 kvm switches from different manufacturers with different cables both with the same result.
    Both computers are at 1280x1040 resolution, 60Hz refresh rate... changing the refresh rate nor the resultion helped.
    However, when my main computer is connected directly to the monitor the video quality is fine... which makes me completely lost.  Is there anything I can do besides beating everything with a baseball bat??

    was hoping there'd be a way to clear things up after getting use to using 2 computers at once
    unfortunately can't fit an oldstyle monitor on the desk where i just moved to and can't afford another lcd :/

  • Lately when using Firefox the mouse no longer works and no links or tabs can be selected. The only way to get the mouse to work is to switch windows with ctrl+tab

    The mouse is completely unavailable, not even able to select anything on the taskbar or start button.
    When this started happening I had to restart firefox, then I tried opening the task manager to see if anything was hogging resources and I found simply opening the task manager freed up the mouse, then I found simply using alt+tab to switch windows did it, then I discovered using alt+tab to cycle through the available windows straight back to firefox does it.

    See "Hang at exit":
    *http://kb.mozillazine.org/Firefox_hangs
    See "Firefox hangs when you quit it":
    *https://support.mozilla.org/kb/Firefox+hangs

  • Qemu, kqemu or kvm?

    What are the differences between the qemu, kqemu and kvm packages in the extra repo? Currently I'm using qemu with -kernel-kvm, is there any difference?

    Nice 8)
    btw: qemu is perfect to test liveCD images created with larch2 (see my sig)...

  • Kvm: qemu with option "-enable-kvm" or kvm-84 from AUR?

    whats the difference between the two? Which one should be preferred?
    thanks!

    Yeah, my bad.  The patches to qemu would come from upstream KVM, like they did before.  Avi Kivity, not Tobias.  My mistake there.
    And yeah, I think some of those distinctions are us using different semantics.  I'd call the qemu implementation that Avi maintains a fork -- but that is different to me than, as you worded it, kvm being a fork of qemu.  When saying "kvm" and referring to a chunk of code, not what I'll call for this conversation's sake "the kvm project," has always referred to the kvm module -- the kernel code, again hence the name.  Back when the userspace code was just a set of patches to qemu, this confusion was rarer.  (Even after the kvm project started maintaining their own version of the code, they also maintained the qemu patch set to apply to the qemu project -- their version was just qemu, pre-patched.  Avi discusses that philosophy of modifying the original code as little as possible in his most recent blog a few months ago.)  The kvm userspace code is -- again, by Avi's own description -- qemu and libkvm.  (http://www.linux-kvm.org/page/Code - "The kvm userspace code (libkvm and qemu) is available through a git tree.")  kvm-the-project does maintain a prepatched qemu, but that doesn't make it kvm's code -- particularly when kvm's intent all along was to have their patches accepted by qemu, which they now have.  So while you can say that kvm-the-project has within it a build of qemu -- and if you wanted, you could even call it a fork, though the maintainer declines to use the term -- qemu is not kvm.
    I'd also add that though the gray area there exists, from a future-discussion perspective it does make things a lot clearer if we refer to kvm the module, the "pure" build of qemu, and kvm's qemu build (or qemu-kvm) as separate.
    And by extension, no, kvm-userspace has not reached 10.0.0.  There's a reason that the kvm userspace code just has build numbers.  Its version number is 85.  It would make a lot of sense to say that the kvm-maintained patches were modified and applied to qemu upstream to make qemu 10.0.0, but the post-10 stability patches for kvm were applied independently to qemu and qemu-kvm -- qemu-kvm basically getting just kvm-related stability patches, which are submitted upstream to qemu (and thus qemu-kvm moving up in build number), and qemu using the qemu-kvm patches as well as patches relating to other parts of the system.
    Getting back to the meat of the question, it is important to note that the kvm we're getting from the arch package is NOT the kvm that you would get from building the download file.  You called it clean, and you're absolutely right -- it's *too* clean.  Download the KVM package from sourceforge, build, and do a make -n install; you get:
    make -C kernel DESTDIR="" install
    make -C libkvm DESTDIR="" install
    make -C qemu DESTDIR="" install
    Which makes sense if you read their docs -- the KVM build, as per KVM, come as a (independent of the kernel) set of modules and a QEMU build to go with those modules, just like it was before it was accepted by linux-kernel.  (You could probably have noticed that kernel modules were being build when you run make, but there was so much stuff in there that I thought it easier to cut/paste the install phase for clarity.)  The Arch PKGBUILD, however, just compiles qemu-kvm and its necessary libraries:
    for dir in libkvm user qemu extboot; do
            cd ${srcdir}/kvm-${pkgver}/${dir}
            make || return 1
        done
    and then hand-installs those components without the kernel modules meant to go with it.  Unless the package builder knows something the KVM developer doesn't, I wouldn't go around using that qemu build with whatever KVM module version from whatever different kernel version you may have willy-nilly.
    If I had the hankering to run the KVM maintained userspace stuff, I'd do what they said and run their kernel stuff too.  I think a proper KVM build should do that.  But that's not my call, since I'm not the extra maintainer.  As it stands, for me I'd rather use the in-kernel version, which I think will get the kernel-side patches that the KVM project's kernel code gets anyway since there is so much attention on the kernel, but also has the benefit of the qemu userspace code getting bug fixes from the qemu devs themselves.  It sounded to me like that was the direction kvm itself was moving.  But to each their own, of course.  I'd just say better to stick all the way with one or all the way with the other method, and not just start making hybrids without a much deeper knowledge of the code than I think any of us have.
    Last edited by slinkygn (2009-05-04 02:11:30)

  • How do I find the address -thread - of a file. I used to use spotlight but after switching to Mountain Lion it no longer gives me this.

    How do I find the address -thread - of a file. I used to use spotlight but after switching to Mountain Lion it no longer gives me this.

    Hold Command-Option while pointing to an item in the Spotlight list. Or Command-Click will show the item in the Finder.

  • If I buy Lightroom for PC, can I still use it if I switch to a Mac in the future?

    If I buy Lightroom for PC, can I still use it if I switch to a Mac in the future?
    I want to use Lightroom now, but don't want to pay for it again if I start using a Mac.

    Yes, LR is cross-platform.
    Mylenium

  • Switched video settings on my Mac Mini and now the bloody thing shows "Invalid Format" on my TV (used as monitor for years) and I cannot get it to switch back.

    Switched video settings on my Mac Mini and now the bloody thing shows "Invalid Format" on my TV (used as monitor for years) and I cannot get it to switch back.
    What can I do to get it to work again as more than an overpriced paperweight?

    Hello,
    Safe Boot from the HD, (holding Shift key down at bootup), see if you can set a good resolution.

Maybe you are looking for

  • Plug-ins InDesign

    I have a problem opening a document in InDesign. I've been working on this document on an other computer and now I open it on my workcomputer to continue this document with the error: Cannot open. Please upgrade your plug-ins to their latest version

  • Mac serwer

    I have a problem with a full uninstall the application server on the system maverick, as I uninstalled and re-installed all the settings are automatically restored on how to remove and install a raw version

  • HT4095 why is it taking so long to download tv series

    why is it taking so long to download tv series

  • Reuse a piece of code in SQL?

    I have a big SQL. And inside it, there is a piece of sub-query appear twice. So rather than writing the sub-query twice in the big SQL, I hope to reuse the sub-query in the "big SQL", i.e., is it possible that I only write it when it first appears, a

  • CD Burn Error 4450 - solved!

    I kept getting the dreaded 'unknown error 4450' when burning from iTunes to CDs. Once I changed the burn speed to '12x', it worked fine! I wich I knew that before I wasted a stach of blank CD's I hope this helps some of you!