# Problem to get keyboard properly working.



## rigoletto@ (Mar 15, 2017)

Hello,

I am using `11.0-RELEASE-p8` with x11-wm/i3. The keyboard is a "Microsoft Wired 600" with Brazilian ABNT2 layout.

The ABNT2 layout is working fine, however the "." on the numpad, all media keys, including the XF86Calculator does not work.

Trying xev, all those not working keys do not even create a _noise_ in there. Nada.


```
Section "InputClass"
    Identifier "keyboard0"
    MatchIsKeyboard "on"
    Driver "kbd"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "br"
EndSection
```


```
kbd1 at kbdmux0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
ukbd0: <Microsoft Wired Keyboard 600, class 0/0, rev 1.10/1.10, addr 2> on usbus1
kbd2 at ukbd0
```


```
⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ sysmouse                                    id=7    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ kbdmux                                      id=6    [slave  keyboard (3)]
```

Thanks!


----------



## wblock@ (Mar 15, 2017)

"Media" keys are typically a separate USB device.  Look for a "uhid" entry (human interface device).  As to how to make them work... don't know.


----------



## rigoletto@ (Mar 15, 2017)

That seem to be partially working already. I still have to map the keys but most of them already say something to xev, but Play/Pause and ".". 

I followed the instructions here, blacklisted the drivers as pointed on Blacklist kernel module ?

Thanks!

EDIT:
/var/run/uhidd.ugen.1.2/cc_keymap

```
0x045e:0x0750={
    cc_keymap={
        Play/Pause="0x60"
        Mute="0x5A"
        Volume_Increment="0x5F"
        Volume_Decrement="0x62"
        AL_Calculator="0x54"
    }
}
```

Now I think I just need to find the solution to the "." problem, and discover why Play/Pause won't appear to xev. And later map them.


----------



## rigoletto@ (Mar 15, 2017)

Hmm.

Each time I boot I get different results on /var/run/uhidd.ugen.1.2/cc_keymap sometimes not even all keys are in there:


```
0x045e:0x0750={
    cc_keymap={
        Play/Pause="0x5A"
        Volume_Decrement="0x54"
    }
}
```


----------



## rigoletto@ (Mar 15, 2017)

And now it stopped to work completely:


```
workstation uhidd[974]: ugen1.3[0]=> libusb20_dev_request_sync failed
```

Apparently, `ugen1.3` is the mouse.

I revert the blacklisted modules otherwise the mouse wont work anymore.

Thanks!


----------



## rigoletto@ (Mar 16, 2017)

After some test the situation here is this: _the keyboard have 5 of those keys (Play/Pause, Volume Decrease, Volume Increase, Mute, and Calculator). _

sysutils/uhidd works but with a weird behavior.

It just make 4 of those keys work, and what work keep changing at every boot. Sometimes it even do not create a cc_keymap but there are always 4 key working. I did not find a time where the calculator key did not work. However the key code change at every boot, like of the others ones.

I think it might be a bug.


----------



## rigoletto@ (Mar 16, 2017)

An update.

The key code randomizing at each boot is indeed expected. I failed to notice it on the documentation:



> When you start uhidd on a USB mutlimedia Keyboard without a pre-configured keymap, uhidd will prepare a in memory keymap. Each time you pressed a new multimedia keys, uhidd will remember the key(hid usage) you pressed and assign a free keycode to it, then it adds the usage<->keycode binding to the in memory keymap. The keymap will also be written down to the file /var/run/uhidd.ugen.X.Y/cc_keymap, what you need to do is copy the keymap to the configuration file /usr/local/etc/uhidd.conf, so next time uhidd will load the fixed keymap for this keyboard instead of generating another new keymap again.



Unfortunately, ever doing that, one of the keys simple wont work as explained before.


----------



## rigoletto@ (Apr 9, 2017)

After several tentatives the situation is this:


In regards to "Media" keys, sysutils/uhidd works. However for some reason one of those keys randomly do not work (like the key would not exist) after every boot, but this behavior do not seem to affect XF86Calculator, what always work;

The numeric pad "." (dot) do not work at all, never.

I do not have idea where is the source of the problem.


----------



## fscorrea (Apr 12, 2017)

Just to be sure: does the '.' numpad work outside Xorg?

I'm using `11.0-RELEASE-p8` with ABNT2 as well. The only difference is the keyboard, I am using a MaxPrint without any media keys, but the '.' doesn't work as well. Neither outside nor inside Xorg, be it i3, KDE4 or mate (I have these three installed).

So I decided to have a look at the keymap, and the "." is not there. Every key in the numpad is configured for both having or having not num lock'd. But not the '.'. Furthermore, `$ kbdscan` confirmed nothing happens when I press the key (no scancode echoed).

My guess is that numpad '.' is intentionally left off ABNT2 layout, but I'm not sure the key shouldn't have a scancode. It's being ignored as an interruption as well. `$ kbdscan` has no way of being terminated except by idling up to timeout, and it did despite my frantically pressing of the numpad '.' key.

It surely is weird. No real harm, though.


----------



## rigoletto@ (Apr 12, 2017)

fscorrea no, '.' also does not work on console too. Good you found out the source of the problem, I will file a bug report, unless you prefer to do it.

I didn't have this problem on my server when there was not a "br" keymap (10.3), but some br-something (what still do exist I think). Something should went wrong between these changes.

Now I just need to discover why I always have one of the media keys randomly not working after every boot. 

EDIT: I still do not have this problem on my server what now have 11 but it was upgraded from 10.3...

Thank you!!!


----------



## fscorrea (Apr 14, 2017)

lebarondemerde said:


> I will file a bug report, unless you prefer to do it.


If you please.


----------



## rigoletto@ (Apr 14, 2017)

PR 218660


----------



## rigoletto@ (Aug 3, 2017)

Just to say the problem is still present in 11.1-RELEASE.


----------

