# PS/2 keyboard stopps working after USB stick detach



## YuryG (May 15, 2020)

I'm on FreeBSD 11.4-STABLE #2 r360955 amd64 now. I have a motherboard with AMD 760G (780L)/SB710 chipsets, a PS/2 keyboard, an USB mouse, etc.
I had to add

```
device        uinput
device        evdev
options        EVDEV_SUPPORT
```
in my custom kernel config, since now Xorg refuses to understand my PS/2 keyboard without this change completely (probed to recompile x11-servers/xorg-server with UDEV and DEVD — no keyboard without EVDEV in kernel!), now it do not understand just one "MENU" key (see Thread 75376 on this).

What's next? The title of this thread says it. I've discovered now that just detaching USB stick, even without mounting-unmounting it, just attach and detach, makes my PS/2 keyboard dead. No reaction at all from it afterwards. Had to close applications in MATE with a mouse only and power-off/power-on with a power button on a computer's case.
What's else in my kernel config:

```
cpu        HAMMER
ident        GJA822M

options        SMP
options        VM_NUMA_ALLOC
options        DEVICE_NUMA
options     SCHED_ULE
options     PREEMPTION
device        mptable
options        HWPMC_HOOKS
device        hwpmc
options        HZ=700
<...>

options     CAPABILITY_MODE
options     CAPABILITIES
options     MAC

options     SYSVSHM
options     SYSVMSG
options     SYSVSEM
options     _KPOSIX_PRIORITY_SCHEDULING
options     P1003_1B_SEMAPHORES
options     P1003_1B_MQUEUE
options     KBD_INSTALL_CDEV
options     FB_INSTALL_CDEV

options        VESA            # ?
options        X86BIOS            # ?
device        dpms            # ?
device        acpi_video        # ?

options        PPS_SYNC

device        cpufreq
device        cpuctl
device        amdtemp
device        amdsbwd
device        aibs

# Bus support.
device        acpi
options        ACPI_DMAR    # ?
device        pci
options        PCI_IOV
device        agp

options     SCSI_DELAY=5000
device        ahci
options     ATA_STATIC_ID    # ?

device        scbus
device        da
device        cd
device        sg
device        pt
device        pass
device        ctl
device        ses
device        ch

device        targ
device        targbh

### Keyboard part ###
device        atkbd        # AT keyboard
device        atkbdc        # AT keyboard controller
device        kbdmux        # keyboard multiplexer

options        AUTO_EOI_1

options        VGA_WIDTH90    # ?
device        vga        # ?

device        sc        # ?
options        SC_HISTORY_SIZE=480    # ?
device        vt
device        vt_vga

<...>

device        smbus
device        amdpm
device        amdsmb
device        smb

device        ic
device        iic
device        iicbus
device        iicbb
device        iicsmb

device        sdhci    # me
device        mmc    # 9.1me
device        mmcsd    # 9.1me

### USB support ###
device        uhci
device        ohci
device        ehci
device        xhci
device        usb
device        uhid
device        ums
device        umass

device        udbp
device        uled
device        usfs
device        umodem
device        uether
device        ucom
device        u3g
device        cdce
device        urndis

#options        USB_DEBUG

<...>
device        smbios

device        uinput
device        evdev
options        EVDEV_SUPPORT
```

May be something is wrong with the configuration?


----------



## zirias@ (May 15, 2020)

There seems to be some bug with detaching USB devices, probably depending on the actual hardware, as I have something similar only on one machine:

I'm on 12.1-RELEASE, with GENERIC kernel, and my system keyboard is USB itself. Still I have the same issue: detach any USB device and the keyboard stops working. Unplugging it and even plugging it in a different USB slot doesn't help, I have to reboot the machine to have a working keyboard again.

Of course, this could be a different problem, but it could be related as well, given the similarities. I didn't write a PR about it so far as I have no idea where to look for further information.


----------



## T-Daemon (May 15, 2020)

You could boot a 11.4-STABLE GENERIC kernel, to see if it’s also affecting your system, as does Zirias's GENERIC kernel on a 12.1-RELEASE system, or does only your custom kernel affect the keyboard.

Also why do you need a custom kernel?


----------



## SirDice (May 15, 2020)

Man, I haven't used PS/2 keyboards in quite some time. But I remember a toggle on the driver that would disable the PS/2 port when a USB keyboard was detected. Can't find it any more though. Also check your BIOS/UEFI settings, specifically look for compatibility modes for USB keyboards (a USB keyboard is presented to the system as a PS/2 keyboard). Turn those off. They might interfere too.


----------



## YuryG (May 15, 2020)

Somehow, I had troubles with kbdmux in the kernel options earlier. (And, by the way, without addition EVDEV_SUPPORT to my custom kernel, keyboard did not work in Xorg at all! And this option is not set in GENERIC for 11.)
After upgrading sources, reviewing my kernel config and recompilation of the kernel, the problem is silent now. Now sure for how long. PS/2 devices seem out of attentive look now. ) Although most of time I get all I could want from them.


----------

