# Cannot use PS/2 mouse - /dev/psm0 missing.



## jssd (Jul 11, 2020)

I have a PS/2 mouse on my system that works fine when I dual boot to another OS.  (ie. "Yes, it is plugged into the correct port and yes it has batteries.").   Yesterday I installed FreeBSD for the first time and I found that I could not use the PS/2 mouse there.

I have tried adding the following to /etc/rc.conf to no avail:

```
dbus_enable="YES"
  hald_enable="YES"
  moused_enable="YES"
```
]
moused does not start - it complains that it cannot open /dev/psm0 - and indeed that device does not exist on my system.  I saw nothing that seemed to be relevant in the output of "dmesg -a".  I have read "man psm" - everything in the "examples" section is in place on my system: 

```
device atkbdc
  device psm

  hint.atkbdc.0.at="isa"
  hint.atkbdc.0.port="0x060"
  hint.psm.0.at="atkbdc"
  hint.psm.0.irq="12"
```
I do see /dev/sysmouse - but using that for moused_port in /etc/rc.conf (or in manually running moused) did not work either.  It also does not work in /etc/X11/xorg.conf:

```
Section "InputDevice"
      # generated from default
       Identifier     "Mouse0"
       Driver         "mouse"
       Option         "Protocol" "ps/2"
       Option         "Device" "/dev/sysmouse"  #also does not work if "/dev/psm0"
       Option         "Emulate3Buttons" "no"
       Option         "ZAxisMapping" "4 5"
   EndSection
```
I really like my PS/2 mouse and it keeps a USB port free for other things, so I'd really like to get it working.  I strongly suspect the missing /dev/psm0, but I do not know how to add it, or why it is not present.  Any ideas?  Thanks!


----------



## trev (Jul 12, 2020)

You might get some more info during boot if you boot in  verbose mode. Choose the boot verbose option from the boot menu (alternatively, type  `boot -v` at the loader prompt).


----------



## Martin Paredes (Jul 12, 2020)

It's your PC very old? a PS/2 mouse need a PS/2 port (interface)

Maybe your mouse it's PS/2 buty you are using a PS/2-to-USB adapter? in this case FreeBSD it's going to detect a USB mouse

Share the output of `dmesg | grep -i mouse`

If you use moused(8), then you should use /dev/sysmouse and protocol sysmouse(4) in xorg.conf

You don't need `moused` if you don't use a mouse in console


----------



## jssd (Jul 12, 2020)

My PC is < 5 years old.  I am using  PS/2 mouse plugged into the PS/2 port (green 6 pin).  I am doing this because I want to:  I have a PS/2 mouse that is comfortable to use and it also saves a USB port for something else.

Here is the output of "dmesg | grep -i mouse":

        psmcpnp0: <PS/2 mouse port> port 0x60,0x64 irq 12 on acpi0

I ran this with the verbose option turned on.  Thanks for the suggestion.  This was the only line matching the grep.  There are no other lines in the dmesg output that match "psm".

I note that this port (psmcpnp0) is different than what moused was looking for, which was psm0.   Neither /dev/psmcpnp0 nor /dev/psm0 (nor indeed any /dev/psm*) exist on my system.  I suspect the absence of any /dev/psm* file is the key to this problem, though I do not know why there is no file of that type.

Thanks for clarifying the purpose of moused.  I do not need a mouse at the console, so I will disable it.  I only need a mouse in my X windows environment.

Note that I have hald_enable="YES" already set, in case that matters.  I should also say that I am running 12.1-STABLE and have not built a custom kernel.  I do have custom settings in loader.conf, sysctl.conf, and rc.conf of course.

I googled "psmcpnp0" and found several bugs and questions of a similar nature, including:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=161043


----------



## jssd (Jul 12, 2020)

Hmmm... on further inspection it looks like it would be best if I sign up for a bugs.freebsd.org account and chime in on bug 161043.  Looks like this has been a long-standing issue.  In the meantime, if anyone out there can shed some light it would be most welcome.  I am a software engineer and would be willing to put in the time to help fix this once and for all.  Yes, this is how much my PS/2 mouse means to me


----------



## skeletonboss12 (Jul 12, 2020)

dumb question: are you booting freebsd via legacy bios or eufi?
i could only get ps/2 to work in legacy.


----------



## jssd (Jul 13, 2020)

Legacy.


----------



## skeletonboss12 (Jul 13, 2020)

jssd said:


> Legacy.



please do not reinstall your os just because of uneducated guesses, but does the issue persist in eufi?


----------



## SirDice (Jul 13, 2020)

There seems to be a lot of misconception, so let me try and explain how it  works. The psmcpnp0 is the physical PS/2 port on your PC. The psm(4) is the driver for PS/2 mice connected to psmcpnp0. moused(8) connects to the psm0 device (if it's detected) and creates the /dev/sysmouse virtual device. Xorg will detect /dev/sysmouse automatically. 

No amount of fiddling with moused(8) is going to make things work if no psm(4) device is detected. As a consequence, no amount of fiddling with xorg.conf is going to magically make /dev/sysmouse appear if moused(8) fails.

What you need to figure out is why there's no psm(4) device being detected. Everything else  hinges on this. No psm(4) device -> no moused(8) -> no Xorg.

One thing that's always bitten me, make sure the mouse is connected when you turn on the machine. Some BIOS's  disable the port if there nothing connected to it. Also double check the various "legacy usb" device options in your BIOS. The BIOS can trick an  OS by presenting a USB mouse as a PS/2 mouse. This could interfere with an actual PS/2 mouse plugged in.


----------



## jb_fvwm2 (Jul 13, 2020)

does `kldload ums` fix it?


----------



## SirDice (Jul 13, 2020)

jb_fvwm2 said:


> does  kldload ums fix it?


That's for USB mice (and is builtin on the GENERIC kernel).


----------



## jssd (Jul 13, 2020)

skeletonboss12 said:


> please do not reinstall your os just because of uneducated guesses, but does the issue persist in eufi?



Heh... I wish I could.  I've a newbie to FreeBSD - just began the install on Friday.  Spent most of the weekend trying to get UEFI to work, and could not.  That's a whole other story (one that I do not care to relive).  So sorry, can't test.


----------



## jssd (Jul 13, 2020)

SirDice - Thanks for the concise explanation. Agreed - the missing device is key.  I am certain that the PS/2 mouse has been properly plugged in at boot time.  Will review BIOS settings to see if anything jumps out.  If that doesn't work, I might use this as my first excuse to dive into the kernel source.


----------



## zirias@ (Jul 13, 2020)

Does `dmesg | grep psm` show anything? IOW, is psm _trying_ to detect a mouse?


----------



## jssd (Jul 13, 2020)

Zirias said:


> Does `dmesg | grep psm` show anything? IOW, is psm _trying_ to detect a mouse?



It shows only one line.  From earlier post...



jssd said:


> Here is the output of "dmesg | grep -i mouse":
> 
> psmcpnp0: <PS/2 mouse port> port 0x60,0x64 irq 12 on acpi0
> 
> I ran this with the verbose option turned on. Thanks for the suggestion. This was the only line matching the grep.  There are no other lines in the dmesg output that match "psm".



I grepped on "psm" as well and found only the one line as above.


----------



## jssd (Jul 13, 2020)

jssd said:


> SirDice - Thanks for the concise explanation. Agreed - the missing device is key.  I am certain that the PS/2 mouse has been properly plugged in at boot time.  Will review BIOS settings to see if anything jumps out.  If that doesn't work, I might use this as my first excuse to dive into the kernel source.



Nothing in the BIOS about converting PS2 to USB or anything even remotely related.


----------



## fmw (Jul 26, 2020)

While trying to resolve the same issue, I stumbled upon a package message for xorg-server that if the kernel is compiled with EVDEV support, which is default from FreeBSD 12.1 onwards, you need to run 
	
	



```
sysctl kern.evdev.rcpt_mask=6
```
 for PS/2 pointing devices to be detected at all.

I did that, (added it to /etc/sysctl.conf) but to no avail. moused places an arrow on the console, but it won't move. There is no /dev/psm0. From what I've seen, the GENERIC kernel is compiled with support for this device, so that should not be the problem.

The device is an old Logitech trackball with an interface that can act as PS/2 or serial device, but not USB It works on every computer with a PS/2 port around the house.


----------



## jb_fvwm2 (Jul 26, 2020)

If the cursor is there I think there needs to be an xorg.conf setting/unsetting or a command involving the mouse present before Xorg, but no way to be more definitive without being at
the keyboard of the machine in question.


----------



## jssd (Aug 24, 2020)

fmw said:


> While trying to resolve the same issue, I stumbled upon a package message for xorg-server that if the kernel is compiled with EVDEV support, which is default from FreeBSD 12.1 onwards, you need to run
> 
> 
> 
> ...



FWIW I just tried kern.evdev.rcpt_mask=6 and it did not help me either.


----------



## Mjölnir (Aug 24, 2020)

Increase `debug.psm.loglevel="1"` or 2 in loader.conf(5) and boot in verbose mode.


----------



## jssd (Sep 3, 2020)

mjollnir said:


> Increase `debug.psm.loglevel="1"` or 2 in loader.conf(5) and boot in verbose mode.


I just tried `debug.psm.loglevel="2"`.  If I do `dmesg | grep psm` I see:

```
psmcpnp0: <PS/2 mouse port> port 0x60,0x64 irq 12 on acpi0
```
That's it.  That's also the only thing I see in `/var/log/messages`.  Should I be grepping on another string?


----------



## Mjölnir (Sep 4, 2020)

psm(4) "gets" the PS/2 mouse from atkbdc(4), and that does not work as expected in your case.  You could try to run a custom kernel, built with `KBD_RESETDELAY=400` & `KBD_MAXWAIT=10` (2x defaults of 200 & 5 ms), and still have debug.psm.loglevel="2" in loader.conf(5).  If that does not help, consider to file in a bug report (@top of the forums pages), if you're willing to help the developers with your debug output.  While you're at it (bug report), IMHO these knobs could/should be boot-time sysctl(8) tunables anyway, e.g. `debug.kbd.reset_delay`.


----------



## jssd (Sep 5, 2020)

I just built my first custom kernel (yay!) with the above settings.  PS/2 mouse still does not work.  I now see:

```
dmesg | grep psm
  psmcpnp0: wake_prep disabled wake for \134_SB_.PCI0.LPCB.PS2M (S5)
  psmcpnp0: <PS/2 mouse port> port 0x60,0x64 irq 12 on acpi0

dmesg | grep atk
  atkbdc0 failed to probe at port 0x60 on isa0
```
Do you think it is worth filing a new bug?  This bug is still open in bugs.freebsd.org:  161043 (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=161043)


----------



## Mjölnir (Sep 6, 2020)

I'd suggest to append your issue to that bug & not open a new one, since it looks very similar.


----------

