Microsoft Natural Keyboard 4000 & Freebsd 7.1

instain

New Member

Reaction score: 4
Messages: 14

After upgrading from Freebsd 7.0 to 7.1-RELEASE (GENERIC 1386), my Microsoft Natural Keyboard 4000 isn't working properly anymore. If I press scroll, caps, or num lock at a terminal, the system hangs for a minute or two before proceeding.

I discovered that if I leave the keyboard unplugged while booting, then start X, then plug in the keyboard it works fine. If the keyboard is plugged in at boot and I start X, it still hangs the system when a *lock key is pressed. It even hangs a few times while X is loading - I assume because X is initializing the *lock keys.
 
OP
OP
I

instain

New Member

Reaction score: 4
Messages: 14

gentoobob said:
is the Function key off?
It appears to start up with F-Lock on. It appears that booting with a different keyboard and then switching back to this one somehow fixed it. I can't reproduce the behavior anymore.
 

rvo

New Member


Messages: 2

I have a MS wireless optical mouse 2.0 and it doesn't work, the keyboard works out-of-the-box but the mouse do not. :-(
 

mart

Member

Reaction score: 18
Messages: 48

After upgrading from Freebsd 7.0 to 7.1-RELEASE (GENERIC 1386), my Microsoft Natural Keyboard 4000 isn't working properly anymore. If I press scroll, caps, or num lock at a terminal, the system hangs for a minute or two before proceeding.
I can confirm this, but it's slightly different for me...

1. For me, the issue has been happening since later 7.0 versions also, not just 7.1. It may go back further, but my first exposure to FBSD was around 7.0-p6.

2. My system hangs for ~2 seconds (not minutes) each time I press Caps Lock/Num Lock. It also hangs for ~2 seconds after boot (but only after moving the mouse for a few seconds). It also happens on the desktop (xfce/wmii), not just terminals. F-Lock on/off makes no difference, still happens.

3. During hangs the system is completely locked, NMI-style. Everything stops - no audio updates, no disk activity, no nothing. No system messages about the cause anywhere that I can find.

4. Extra info

From dmesg
Code:
[mart@bsddesktop ~]$ dmesg | grep -i "key\|kbd\|uhid0\|uhub1\|natural"
kbd1 at kbdmux0
uhub1: <Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1> on usb1
uhub1: 2 ports with 2 removable, self powered
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
ukbd0: <Microsoft Natural\M-. Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 2> on uhub1
kbd2 at ukbd0
uhid0: <Microsoft Natural\M-. Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 2> on uhub1
From xorg.conf
Code:
...snip...

Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

...snip...

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/sysmouse"
    Option         "ZAxisMapping" "4 5 6 7"
EndSection

...snip...
FromXorg.log
Code:
(**) Option "Protocol" "auto"
(**) Mouse0: Device: "/dev/sysmouse"
(**) Mouse0: Protocol: "auto"
(**) Option "CorePointer"
(**) Mouse0: always reports core events
(**) Option "Device" "/dev/sysmouse"
(==) Mouse0: Emulate3Buttons, Emulate3Timeout: 50
(**) Option "ZAxisMapping" "4 5 6 7"
(**) Mouse0: ZAxisMapping: buttons 4, 5, 6 and 7
(**) Mouse0: Buttons: 11
(**) Mouse0: Sensitivity: 1
(**) Option "CoreKeyboard"
(**) Keyboard0: always reports core events
(**) Option "Protocol" "standard"
(**) Keyboard0: Protocol: standard
(**) Option "AutoRepeat" "500 30"
(**) Option "XkbRules" "xorg"
(**) Keyboard0: XkbRules: "xorg"
(**) Option "XkbModel" "pc105"
(**) Keyboard0: XkbModel: "pc105"
(**) Option "XkbLayout" "us"
(**) Keyboard0: XkbLayout: "us"
(**) Option "CustomKeycodes" "off"
(**) Keyboard0: CustomKeycodes disabled
(II) evaluating device (Keyboard0)
(II) XINPUT: Adding extended input device "Keyboard0" (type: KEYBOARD)
(II) evaluating device (Mouse0)
(II) XINPUT: Adding extended input device "Mouse0" (type: MOUSE)
(II) Mouse0: SetupAuto: hw.iftype is 4, hw.model is 0
(II) Mouse0: SetupAuto: protocol is SysMouse
(II) 3rd Button detected: disabling emulate3Button
I haven't had chance to look much deeper than this - it's low(er) down on my long list of 'things that don't work correctly in FBSD'. If anyone can help track this down then I'd be very happy :)
 

marthyr

Member

Reaction score: 3
Messages: 34

Partially Solved?

Hello

I have Microsoft Natural Keyboard 4000.

I enabled Port 60h/64h Emulation inside BIOS, to have functions keys enabled as soon as computer is turned on.
 

trev

Aspiring Daemon

Reaction score: 161
Messages: 784

rvo said:
I have a MS wireless optical mouse 2.0 and it doesn't work, the keyboard works out-of-the-box but the mouse do not. :-(
I have a new (but fairly old) MS Internet Keyboard (wired PS/2) that works fine, along with an MS Intellimouse Explorer 2.0 (wireless USB,PS/2) which works fine naked in either USB or PS/2 modes, but only as a PS/2 mouse when plugged into a KVM.
 

mart

Member

Reaction score: 18
Messages: 48

marthyr said:
I enabled Port 60h/64h Emulation inside BIOS, to have functions keys enabled as soon as computer is turned on.
That might work if I had that option, but the motherboard on this particular machine (Asus P4P800) doesn't.

I'm pretty sure a patch that would address this was posted years ago, but was never integrated.

No keyboard support == no fun.

This machine has sat pretty idle since things broke, and my planned move to FreeBSD looks to have stopped before it ever really started :(

[Edit: I should also mention that this is still broken in 7.2-RELEASE]
 

foo_daemon

Member

Reaction score: 4
Messages: 43

Heh, pretty old thread bump.

I too have a MS Natural 4000; I couldn't even get the 7.0 amd64 DVD installer to work. At the first 'input prompt' (it's either for timezone or keyboard layout, cannot remember which) pressing any key caused it to become 'stuck' and all future input to be discarded.

My workaround: install PC-BSD. The latest 7.1 X-based installer had the keyboard working no problem, and booting since I've had no problems (save 1 minor nuisance: the nifty shortcut keys on the topmost row are unrecognized, so I cannot bind them in to do something in KDE :\ ) .
 

mart

Member

Reaction score: 18
Messages: 48

foo_daemon said:
Heh, pretty old thread bump.
Heh, pretty old bug :)

Anyway, the issue, and solution, are described here. Hope that helps.

I just patched 7.2-RELEASE with the code above and have a usable keyboard once again. Seems things were broken in June 2007, and this patch reverts things to an earlier (working) state.

Pro: working keyboard. Yay, progress.
Con: custom kernel. Boo, no more semi-automatic freebsd-update security updates...
 

jnbek

Member

Reaction score: 12
Messages: 97

anyone have any progress getting the multimedia keys working for this keyboard? Namely the Volume buttons and the mute? I can really live without the rest, but those are pretty much essential.
 

Carpetsmoker

Daemon

Reaction score: 184
Messages: 1,012

You can use an application such as x11/xbindkeys to bind them to a specific action.
There's also x11/xbindkeys_config for a GUI configuration.

To control volume, you can bind the keys to a command such as % mixer vol +10 and % mixer vol -10

In addition, in the future, it's probably best to start a new thread, instead of hijacking someone else's thread from a year ago ;)
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 3,644
Messages: 13,850

Sometimes some of the extra keys are actually connected to another USB HID device. There was an example of how to set that up somewhere, but I don't recall where. Possibly usbhidaction(1).

("Gentlemen, behold! A miracle of modern science, the result of years of flaunting and outright breaking of the puny laws of man and nature: this mutant, lumpy and misshapen two-headed keyboard, stuffed with keys, knobs, and LEDs! The only problem that remains is... what should we call it?" "I know! We'll call it The Natural!")
 

Carpetsmoker

Daemon

Reaction score: 184
Messages: 1,012

aragon said:
For multimedia keys on USB keyboards, I recommend sysutils/uhidd.
That seems like an overly complicated way to do things -- Normally those special keys just send "special" keycodes which are pickup up by some application.

At least, this is how all the keyboards and laptops I've ever owned worked ...
 

Nukama

Active Member

Reaction score: 43
Messages: 129

Carpetsmoker, are these all USB-Keyboards with multimedia keys?

Does [CMD=""]xev[/CMD] respond to pressed multimedia keys (Keycode present)?
If not you should try http://wiki.freebsd.org/uhidd, as suggested by aragon.

I'm typing with a Comfort Curve Keyboard 2000 where [pman]uhidd[/pman] is only attached to the consumer control driver.

/usr/local/etc/uhidd.conf
Code:
# Microsoft Comfort Curve Keyboard 2000 v1.0
0x045e:0x00dd={
        mouse_attach="NO"
        kbd_attach="NO"
        vhid_attach="NO"
        cc_attach="YES"
        cc_keymap={
                Play/Pause="0x63"
                Mute="0x65"
                Volume_Increment="0x66"
                Volume_Decrement="0x64"
                AC_Back="0x67"
                AC_Forward="0x68"
                AC_Home="0x69"
                AC_Search="0x6A"
                AL_Email_Reader="0x6B"
                AL_Calculator="0x5A"
        }
}
/etc/rc.conf
Code:
#
# uhidd
#
uhidd_flags="-o"
uhidd_enable="YES"
~/.xmodmaprc
Code:
!
! Set up keys for a Microsoft Comfort Curve Keyboard 2000
! Insert "exec xmodmap /home/nukama/.xmodmaprc &" into your ~/.xinitrc
!
!       Key   Unshifted       Shifted         AltGraph        AltGraph-Shifted
!       ---   --------------- --------------- --------------- ----------------

!(AL_Calculator issues keycode 170, which is already assigned to XF86Eject)
!keycode 170 = XF86Calculator
keycode 190 = XF86AudioPlay
keycode 191 = XF86AudioLowerVolume
keycode 193 = XF86AudioRaiseVolume
keycode 192 = XF86AudioMute
keycode 198 = XF86Back
keycode 199 = XF86Forward
keycode 200 = XF86HomePage
keycode 201 = XF86Search
keycode 203 = XF86Mail
And I can easily assign key-bindings in enlightenment.
 

jnbek

Member

Reaction score: 12
Messages: 97

Awesome, now I just need some extra time to play with this !! If I can get this keyboard to work, I may never have to use Linux again!!!
 

aragon

Daemon

Reaction score: 279
Messages: 2,029

Carpetsmoker said:
At least, this is how all the keyboards and laptops I've ever owned worked ...
Have you tried a USB keyboard before? Laptop keyboards all use PS/2 in my experience...
 

dandelion

Member

Reaction score: 20
Messages: 55

Not documented but to use ukbd(4) together with CC (multimedia keys) from uhidd one has to have kbdmux(4) in kernel, it's there by default (in GENERIC). I was confused as to why Nukama's example didn't work here and it turned out that I disabled kbdmux in order to not interfere with compiled in dvorak keymap. But kbdmux (unlike atkbd(4) and ukbd) and doesn't implement KBD_DFLT_KEYMAP so one has to rely on rc.d (i.e. kbdcontrol) which is not used during single user mode, see also PR kern/153459.
 

crypt47

New Member


Messages: 14

Hi, I'd like to report (Google! Come on and index!) my current finding about Microsoft Natural 4000 under FreeBSD. Using uhidd doesn't help for two reasons: firstly the version in ports is too old to have a code for microsoft keyboards Kaiwang (author of uhidd) added in 2012! Secondly Kaiwang had some other version of Microsoft Natural 4000 then me now and, look at the code, disabled this particular model:

[PMAN=]
// uhidd/drv_microsoft.c:
/*
* The natural4000 keyboard seems to always report 0xFE03 when
* multimedia keys are pressed, with unknown purpose.
*/
if (HID_PAGE(usage) == 0xFF00 && HID_USAGE(usage) == 0xFE03)
return (HID_FILTER_DISCARD);

[/PMAN]

I really don't get it why the git commit stands it adds support for the Natural 4000, but the filter blocks the procedure. Anyway by commenting this section you can get all events (except search button, second from the left) to pass through to xev.

kld_list="vkbd cuse ums uhid"

Well, it's 2019s now... I've been using this keyboard under Linux for as long as I can't remember without any tinkering at all... Shocked a bit.
 
Top