# The KVM switch problem



## john_shadow (Jan 15, 2010)

I have 2 freebsd pc connected to a KVM up until now I didn't need Xorg. My KVM was working flawless in console, but in xorg it's another story.
 I have found the problem and an article giving a solution KVM wait-for problem. The solution in that article is recompiling the kernel but it is from 2005 and states that in the future a faster solution will be implemented.
 Is there a faster solution now?


----------



## roddierod (Jan 15, 2010)

What version of FreeBSD are you running? What kind of KVM?

I've been using a KVM since 2006/2007 without any problems at all?


----------



## john_shadow (Jan 15, 2010)

@roddierod
Version 8.0 on i386.
And the KVM is an edimax with with ps2 i/o ports. 2 out. 

In console the keyboard works. The mouse test does not work.
In X nothing works.


----------



## john_shadow (Jan 16, 2010)

Got the keyboard working. 
The mouse is still a problem.
It is a ps2 mouse connected through a ps2 KVM to a ps2 computer port.
ps2->ps2->ps2
Now it just disturbes me that I do not have the /dev/psm0 device.


----------



## roddierod (Jan 17, 2010)

I assume your trying moused to get the mouse working. You could try HAL but not sure that works on the console.

My KVM is a cables to go and I have a usb moused using a ps2 adapter and it works fine. Not sure. Sorry.


----------



## john_shadow (Jan 17, 2010)

I have hal enabled. The kernel is compiled with psm support.

I tried all options from the sysinstall mouse configuration, it did not work. The pointer appears and immediately dissapears.
But it bugs me that in sysinstall it shows me for ps2 mouse the device is /dev/psm0. Which I know for sure that does not exist.
So in my logic sysinstall does not even bother to warn me that it can not access the /dev/psm0. So maybe makeing /dev/psm0 will solve the problem.


----------



## john_shadow (Jan 17, 2010)

I have found this article. 

Funny thing is that I didn't have a ps2 mouse around some days ago for my KVM. I thought well let's go and buy a damn usb->ps2 since I had usb mice  around. Going to a hardware store, and found no convertors(fsck!). Good I buy a ps2 mouse wth not... Guess what mouse did I buy? the a4tech dual-click thingy.( though for that guy the mouse was working in the first place )

Now I moded the psm.c code as that guy in the article did. Rekernel, that stuff... nada. I am immensely tempted to crush the damn bugger.

Now the only thing that is keeping me from destroying it is that unbelivable good handle this mouse has, it fits perfectly my palm.
I am tempted to debug a little bit the psm.c, some time soon. 
I will say how it went.


----------



## roddierod (Jan 18, 2010)

john_shadow said:
			
		

> I have hal enabled. The kernel is compiled with psm support.
> 
> I tried all options from the sysinstall mouse configuration, it did not work. The pointer appears and immediately dissapears.
> But it bugs me that in sysinstall it shows me for ps2 mouse the device is /dev/psm0. Which I know for sure that does not exist.
> So in my logic sysinstall does not even bother to warn me that it can not access the /dev/psm0. So maybe makeing /dev/psm0 will solve the problem.



I tried to disable HAL and see. HAL didn't work for me at all when it came to the mouse.


----------



## trev (Jan 20, 2010)

I filed a PR about a year ago with code which fixed the KVM mouse problem in my case. It may work for you (there's something seriously amiss with the existing code as it obviously will not work as intended).

See: http://lists.freebsd.org/pipermail/freebsd-bugs/2008-November/033136.html

As for the video issue, my solution was to:


```
> sleep 3; startx
```

and then switch to another PC and come back after X launches successfully. Without doing this, Xorg could never detect the video monitor (XFree86 had no problem I might add)!


----------



## john_shadow (Jan 20, 2010)

Hey, trev. Want to thank you for the fix. I already found your post. Solved the problem in the mouse thread here on the forum.
See my mouse thread for the X solution I use. Well an input solution.


----------



## trev (Jan 20, 2010)

john_shadow said:
			
		

> Hey, trev. Want to thank you for the fix.



You're welcome.

You might want to post a followup to my Nov 2008 PR at http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/129125 noting your success with my fix and perhaps mentioning the brand and model of your KVM.


----------



## climac (Mar 2, 2020)

Sorry to resurrect such an old thread, but maybe my comments will be helpful to someone, even if it's only me next time I set up a new FreeBSD system and forgot what I did with this one which seems to have fixed it.  

I could be wrong, but it seems to me that this problem was never actually solved and maybe everyone just moved on to USB mice and KVM switches.  Well I still have PS/2 KVM switches, 1 at home and 5 at work.  The 2 on my workbench at work exhibit this problem and I've been struggling with it for years through numerous versions of FreeBSD.  I've tried all the suggestions that I found online and the best I managed with them was intermittent mouse functionality.  Rather than waste a lot of time, I usually just ended up sticking a USB mouse on it.  Not ideal, because I invariably grabbed the wrong mouse 1st and one or the other of the mice was always in the way.

This time, I guess I was just fed up with that approach so I was a little more persistent.  I wasn't planning to mod the driver code, though I did take a look at it.  I went through the psm man page to see if there were any config options that might help.  There was nothing specific to this problem but there was flag bit 12, IGNOREPORTERROR, with a rather vague description which states 'it should never be necessary under normal circumstances'.  I suppose the fact that I'm still using a PS/2 KVM switch in 2020 with FreeBSD 12.1 might be considered an *ab*normal circumstance, so I added 'hint.psm.0.flags="0x0800" (the IGNOREPORTERROR bit) to /boot/device.hints. After that I tried a warm boot, a cold boot, and a cold boot with the KVM switch turned to a different port. The mouse was enabled and working after each.

Hope this is of help to someone else and apologies if this solution is posted somewhere else and I failed to find it.


----------

