# Xorg Keyboard and Mouse Issues



## hippiechic (Sep 9, 2013)

I know this is like beating a dead horse, but I have been reading the manuals for days for HAL, X, and the associated subtopics. I have been through Google looking for answers from where maybe someone else has the same problem but they are all slightly different and when I try their solutions they do not work for me.

I have a FreeBSD 9.1 machine, which is fairly stripped down, and I need just GEdit, Blackbox, and Xorg essentially. I have my mouse working in -retro mode just fine in X, but then the keyboard doesn't work and I cannot Alt+F1 out of the X back into my shell. Also, doing a `Xorg -configure` and then `Xorg -config /root/xorg.conf.new -retro` produces the same results. Mouse works, keyboard doesn't.

Both my mouse and my keyboard are USB and plugged into slots directly next to one another. The only other two slots are on the front and I would much prefer not having to use them for input devices. Some of the solutions suggested using a PS/2 mouse or USB to PS/2 adapter, which I have, but there is not a PS/2 port on the motherboard.

Initially, the keyboard would work and the mouse didn't. After I enabled hald and dbus in rc.conf and rebooted, the mouse started working but then the keyboard stopped. I have tried using the Option "Device" for both the keyboard and the mouse to force the proper device (which I'm assuming is the proper device). I also have tried the AutoAddDevices False option to I guess maybe just do whatever it does to find the devices.

At this point I have `Xorg -configure` and vi my .conf files so many times, that I don't know which way is up anymore. I'm about 27 hours solid into this and I'm going nuts. I am not a netadmin, I am a programmer, but I need this machine in my house and don't really have a handly FBSD guru to assist.

I have provided some dumps of my configuration in hopes that *maybe* someone will see why I'm an idiot, and be able to correct me. I really just need a graphical interface with a tabbed editor and it *must* be a UNIX style kernel, Linux will not suffice in this case. I much prefer blackbox and GEdit, since that is what I am comfortable with.

Here are the dumps (I made sure to post to a site which does not require scripts to be run to view the content):
http://codepad.org/qSyPGZsY

I also have attached the dump file I pulled off of the machine which contains the same information as that link above. Just in case anyone felt uncomfortable about clicking links or whatever.

Please, I really feel like this is something so simple that I am missing, and I hope some Guru can quickly see, "Oh yea, you're a dumbass because _____ needs to be _____."

I would really be so grateful. =)


----------



## Juanitou (Sep 9, 2013)

I doubt I could be of any help, but while more knowledgeable people eventually come to the rescue I think you should provide the contents of the Xorg.0.log file.


----------



## kisscool-fr (Sep 9, 2013)

Hi,

How did you install all the X.Org stuff? From packages or ports? If from ports, did you install with HAL support?


----------



## wblock@ (Sep 9, 2013)

HAL is not required for X, although KDE and Gnome still want it.  It is best to tell X not to use HAL, whether it is running or not:

xorg.conf

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

That said, this is the first time I've heard of just the keyboard not working.  As @Juanitou suggests, the log file may be helpful.

Switching from X to the text console is Ctrl-Alt-F1.  That works for me, but switching back to X leaves X in a half-frozen state, and I have not investigated what causes that.


----------



## hippiechic (Sep 9, 2013)

So, a slight update.
I added the 
	
	



```
Option "AddAutoDevices" "False"
```
 to my xorg.conf and I changed my Keyboard section to now reflect 
	
	



```
Device "kbd0"
```
 instead of just "kbd". Now my keyboard and mouse both work in -retro mode, but then when I switched over to my normal user account and checked my *.rc files, everything looked good. Until I ran `startx`, then once again I get a mouse but no keyboard. I can exit out of Blackbox with the menu system `Exit` command, but I cannot type anything while in the window manager. I will pull my Xorg.0.log file dump and post here in a moment. It takes a few minutes since the machine is heavily restricted as to how files go on and off the machine, so I have to jump through hoops to pull logs off of it.

I really do appreciate the help. Another friend of mine IRL had pointed out that my `dmesg | grep "kbd"` was reporting what appeared to be 2, possibly 3, keyboards. Which ended up being the -retro fix.

 I did install X from /usr/ports from pulling down all the depenedency files and putting them on a DVD then installing them, and I honestly don't recall if I specified HAL to be used during that process (it was hours of gathering dependencies and burning images and then installing and watching CC and make go to town, so it's a bit fuzzy now.

I will post the Xorg.0.log file dump in about 15 minutes as an attachment to this post.

Thank you so much in advance for all the suggestions. I feel like I'm so close to having a working desktop with text editor now. ^_^


----------



## hippiechic (Sep 9, 2013)

I have posted the result to http://codepad.org/eSL4i3gV again. I am sorry, I really hate having to use 3third party resources to provide information of this nature. Thank you so much in advance. =)


----------



## wblock@ (Sep 9, 2013)

When you run that -retro command line, you point it to the configuration file. When you run `startx` it uses the system file, which should be /usr/local/etc/X11/xorg.conf, but most people wrongly put in /etc/X11/xorg.conf. That one needs to be fixed.

Another solution is to stop creating a configuration file at all. X can usually autoconfigure, and will not create or try to use nonexistent devices.


----------



## hippiechic (Sep 9, 2013)

I just `cp /etc/X11/xorg.conf /usr/local/X11/xorg.conf` and then tried to `startx` under a user account and the results still were the same. The mouse works, but not the keyboard. So, next I tried `mv /etc/X11/xorg.conf /etc/X11/xorg.conf.old` and then `mv /usr/local/X11/xorg.conf /usr/local/X11/xorg.conf.old` as you suggested. The results, once again, were the same. The mouse works, but not the keyboard. I am really am at a loss here. I don't understand why my machine is reporting three keyboard devices when I clearly only have one keyboard plugged in.


----------



## Juanitou (Sep 10, 2013)

Maybe this thread could help. There are some interesting Drive and Device options. In any case, as long as you have these lines in your log, it won't work:

```
(WW) Warning, couldn't open module kbd2
```
Unfortunately, I don't know why it tries to load it


----------



## wblock@ (Sep 10, 2013)

The command you used above, `Xorg -config /root/xorg.conf.new -retro`, shows that the custom file is in /root.  Copy that file to /usr/local/etc/X11/xorg.conf.  Remove /etc/X11/xorg.conf.


----------



## tyson (Sep 10, 2013)

Well, another approach is to just set in /etc/make.conf

```
WITH_NEW_XORG=yes
```
Xorg-server-1.12 doesn't have HAL built-in anymore, so you are going to have much fewer headaches about not working input devices.


----------



## wblock@ (Sep 10, 2013)

tyson said:
			
		

> Well, another approach is to just set in /etc/make.conf
> 
> ```
> WITH_NEW_XORG=yes
> ...



The older version did not require HAL either, and there is an option to build the port without it.  
	
	



```
Option "AutoAddDevices" "Off"
```
 disables it either way.


----------



## hippiechic (Sep 12, 2013)

I have tried putting xorg.conf.new renamed as xorg.conf in /usr/local/etc/X11/ as well ass put it in /etc/X11/. I also tried symlinking (`ln -s`) the /usr/local/etc/X11 copy to /etc/X11. Now the problem is, my keyboard works fine with X in `-retro` mode, but when I login to my user account and `startx`, my keyboard no longer works, but my mouse works fine. My ~/.xinitrc just says:

```
#!/bin/sh
exec blackbox
```
I am not to the point of editing Blackbox yet until I can get the keyboard to work in it. I saw some suggestions to remove all xorg.conf.* files and to just `startx` as normal. That did not work. Ideally I would like to not run hald or dbus. I want a stripped install as much as possible, but if they make it leaps and bounds easier, then I will recompile my X with HAL support.

I do see that kbd0, kbd1, and kbd2 are all showing as not found when I run in `-retro`, but the keyboard does work. So, I guess, should I put a Device line in directly to my keyboard device? I'm really getting a bit frustrated with all of this from changing this then unchanging and whatnot. So I apologise if I ask something answered already.

I notice the Mouse0 device said /dev/sysmouse or something to that effect. So, is there a keyboard equivalent? I read the site suggested, http://forums.freebsd.org/showpost.php?p=180104&postcount=2, and I added a Device line for both /dev/ukbd0 and /dev/atkbd0 (since `dmesg | grep "kbd"` looked like maybe there was a keyboard there as well, to me).

The keyboard and mouse are still working fine in `-retro` but they report an error on tab out that says

```
(EE) Keyboard0: cannot open /dev/atkbd0
```
... and reports the same for /dev/ukbd0.

What do you guys suggest?

Here is my current /root/xorg.conf.new file:
http://codepad.org/oqvC7bxb


----------



## neilms (Sep 12, 2013)

Perhaps this problem might be caused if you are not using XDM? Alternatively, It might be worth trying X with GNOME - if that is possible, to see if the mouse and keyboard work by including 
	
	



```
gdm_enable="YES"
```
 in your /etc/rc.conf. I do not know the solution, though I believe it is often easier to get things working correctly using a resource heavy windowing system like GNOME as it installs _everything_. It seems that _something_ is missing from your current setup. Hope this helps*.*


----------



## hippiechic (Sep 13, 2013)

neilms said:
			
		

> Perhaps this problem might be caused if you are not using XDM? Alternatively, It might be worth trying X with gnome - if that is possible, to see if the mouse and keyboard work by including
> 
> 
> 
> ...



I really do appreciate the response. I will look into the XDM thing, but I really need a slim window manager. All I want is GEdit, multiple xterm windows, and a PDF viewer, on a single workspace. The rest I use is all standard console stuff anyways. I had Blackbox working fine in a VMWare Guest for many months, but I just cannot recall how I did it now that I'm putting it on a live machine.

I don't doubt I'll get it worked out, it's just really frustrating that I just know it's something so stupid that I am missing; and since the machine is an offline-only box, it makes it harder to work on during this setup process. Once I get the GEdit and xterm and PDF, I should be good to go, though. 

The rc.conf is not as big of a concern, because I believe I should be able to tell X directly where the driver is, I just don't know what the device file name is for my keyboard. (i.e. /dev/ukbd0 )

I will keep messing around with it, and when I get it figured out I'll post back here the solution and dumps. Thank you all for your suggestions, you guys have been most helpful.


----------



## wblock@ (Sep 13, 2013)

You have never said whether this was from ports or packages.  If it was ports, you could just rebuild x11-servers/xorg-server with the HAL option disabled.

Please delete all copies of xorg.conf.  Then create a new one:

/usr/local/etc/X11/xorg.conf

```
Section "ServerLayout"
        Identifier   "Plain"
        Screen       0  "Screen0" 0 0
        Option       "DontZap" "Off"
        Option       "AutoAddDevices" "Off"
        Option       "Log" "sync"
EndSection
```

That's all of it, do not add anything else.  Please test that.  If it does not work, describe exactly how it fails, and post /var/log/Xorg.0.log online where we can see it.


----------



## hippiechic (Sep 27, 2013)

wblock@ said:
			
		

> You have never said whether this was from ports or packages.  If it was ports, you could just rebuild x11-servers/xorg-server with the HAL option disabled.
> 
> Please delete all copies of xorg.conf.  Then create a new one:
> 
> ...



Recompiling X without HAL and resetting my .conf files solved it. Thanks =)


----------

