# My mouse has disappeared



## adamk (Sep 25, 2011)

After a series of crashes and fsck's, my mouse no longer works   I noticed it first in X, when my cursor just stood still, but then when I dropped back to the console, I saw that moused wasn't starting, giving the error:


```
moused: unable to open /dev/psm0: No such file or directory
```

Yes, this is a PS/2 mouse.  It's a logitech wireless mouse.  Works fine still under Vista and OpenBSD.  

[cmd=""]dmesg | grep psm[/cmd] returns nothing.  Same with [cmd=""]dmesg | grep -i mouse[/cmd]

Any ideas?


----------



## adamk (Sep 25, 2011)

OK, so if I install  8.2/i386 to a flash drive (my normal installation, the one having this problem, is at 9.0-BETA2), it see pms0 at irq12 on atkbdc0.  atkbdc0 isn't even seen on the normal installation.  I guess my best chance of fixing this is to update my source and rebuild kernel and world.  Wish me luck.

Adam


----------



## adamk (Sep 25, 2011)

OK, so I've updated, and my mouse still refuses to work.  psm0 and atkbdc0 are still not getting detected if I boot the FreeBSD installation on real hardware, though they are both in the kernel config file.  

If I boot the same FreeBSD install via vmware, psm0 and atkbdc0 are both detected.  I really am open to any suggestions at this point.


----------



## wblock@ (Sep 25, 2011)

Might /boot/device.hints have had custom config and been lost?


----------



## adamk (Sep 25, 2011)

I have never had to modify /boot/devices.hints even for my HDA sound chip, which apparently can be quite problematic   The current version includes:


```
hint.atkbdc.0.at="isa"
hint.atkbdc.0.port="0x060"
hint.atkbd.0.at="atkbdc"
hint.atkbd.0.irq="1"
hint.psm.0.at="atkbdc"
hint.psm.0.irq="12"
```

For what it's worth, the OpenBSD dmesg shows:


```
pckbc0 at isa0 port 0x60/5
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
```

So it looks like devices.hints is using the correct values for the port and irq.

If I boot with verbose logging on FreeBSD, I get some more information:


```
[adamk@sorrow ~]$ dmesg | egrep "atk|psm"
psmcpnp0: <PS/2 mouse port> port 0x60,0x64 irq 12 on acpi0
atkbd: the current kbd controller command byte 0045
atkbd: keyboard ID 0xffffffff (1)
atkbd: failed to reset the keyboard.
atkbdc0: <Keyboard controller (i8042)> failed to probe at port 0x60 on isa0
```

I would guess that the failure to probe the keyboard controller is the issue? I don't actually use a PS/2 keyboard

Here's the full verbose dmesg: http://sprunge.us/fAhI

EDIT: So I'm beginning to think this really doesn't have much to do with the lockups and fscks...


----------



## adamk (Sep 25, 2011)

Alright, so I've installed the 9.0-BETA2 to the same flash drive, and the mouse isn't detected.  It wasn't the lockups and fscks that caused this, but an update.  Just last week I updated -CURRENT.

Something broke between BETA1 and BETA2, apparently, in regards to this hardware.

Any suggestions on how to figure out what change broke this?  

Adam


----------



## wblock@ (Sep 26, 2011)

Boot a 9.0-BETA1 install CD into the shell or live CD mode and make sure it still works there.  Do you have a custom kernel?  BIOS change?

There was a change to atkbd.c a couple of months ago, but it doesn't look like anything that would cause the failure to probe.


----------



## adamk (Sep 26, 2011)

I figured it out, though I don't know why this would matter.  The wireless PS/2 mouse shares the wireless receiver with a wireless USB keyboard.  Which I don't often use any more.  I wanted to free up a USB port for my iPod, which I plug in more frequently than I use that particular keyboard.  It seems that FreeBSD won't see the mouse if the keyboard isn't also plugged in...  I tried booting with all USB devices unplugged, but that didn't do it.  I specifically had to plug in the wireless USB keyboard, and then the mouse was detected when I booted up.

Perhaps it's time for a PR?  Seems like a clear bug to me since no other operating system on this machine seems to have that requirement 

Adam


----------



## wblock@ (Sep 26, 2011)

psm(4) goes through atkbd(4), so it makes sense.  Yes, a PR would be good!


----------



## adamk (Sep 26, 2011)

What I find interesting, though, is that even with the wireless keyboard unplugged, it definitely works under 8.2. Not sure about 9.0-BETA1, though, as I don't know if I actually tried that specific combination. In any case, clearly something changed in atkbd between 8.2 and 9.0-BETA2 to cause this particular breakage.

I notice that somebody edited my first post to mark it solved.  Not sure I would really consider this solved.  Clearly it's still broken.  Plugging the wireless keyboard in is just a workaround.  So, for the moment, I'm removing the solved prefix.

Adam


----------



## adamk (Sep 26, 2011)

OK, so this is even stranger.  This is definitely a PS/2 mouse, yet 9.0-BETA2 sees it as USB:


```
[adamk@sorrow ~]$ dmesg | grep ums
ums0: <Logitech USB Receiver, class 0/0, rev 1.10/17.11, addr 3> on usbus2
ums0: 16 buttons and [XYZ] coordinates ID=1
```

So, when the USB connector for the wireless keyboard isn't plugged in, the PS/2 mouse isn't detected at all.  When the USB connector for the wireless keyboard *is* plugged in, the PS/2 mouse is detected as a USB mouse...  WTF? 

Adam


----------



## wblock@ (Sep 26, 2011)

> I notice that somebody edited my first post to mark it solved.



Not me!

Okay, back up a second.  Wireless keyboard and mouse with one receiver, right?  The receiver connects to the computer via USB or PS2?  How is the mouse PS2?


----------



## adamk (Sep 26, 2011)

The receiver connects to the computer via both USB and PS/2.  There's one connector for the mouse (PS/2) and one for the keyboard (USB). 

http://thorn.visualtech.com/connectors.jpg

To summarizem, on FreeBSD 9.0-BETA2 the mouse only works if both the USB and keyboard connectors are plugged in.  OpenBSD, Vista and two different Linux distros do not seem to have this problems.  FreeBSD 8.2 does not, either.


----------



## wblock@ (Sep 26, 2011)

That's... weird.  Totally guessing, differences in atkbd initialization (PS2 mouse not detected alone) combined with improvements in USB code (mouse detected as USB).


----------



## adamk (Sep 26, 2011)

OK, so I've figured out one of the oddities...  If the USB connector is plugged in, and the PS/2 connector is unplugged, both the keyboard and mouse share the USB connection.  If the PS/2 connector is plugged in, the mouse is *supposed* to be detected as a PS/2 mouse.  This is what happens with Linux, OpenBSD and even FreeBSD 8.2.  But this does not happen with 9.0-BETA2.  This is why I thought it mattered if the keyboard was plugged in...  It really doesn't, but plugging in the connector for the keyboard via USB also plugs in the mouse via USB and the mouse gets detected as ums0.

So, looks like I can now go open that PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=161043

EDIT: And, of course, thanks for your input wblock


----------

