# Keyboard not working



## markfisher (Jun 21, 2012)

Hi
I don't know if the problem is from xorg or fluxbox but my keyboard is not working in fluxbox.

When I run:
`Xorg -config /etc/X11/xorg.conf -retro`
I can press CTRL+ALT+Fn but in fluxbox I can't type anything in urxvt terminal emulator or exit fluxbox by pressing CTRL+ALT+Fn.

PS/2 Keyboard.
xorg without hal.

My xorg.conf:

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

Section "ServerFlags"
	Option "AutoAddDevices"	"False"
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules"
	#FontPath     "/usr/local/lib/X11/fonts/misc/"
	#FontPath     "/usr/local/lib/X11/fonts/TTF/"
	#FontPath     "/usr/local/lib/X11/fonts/OTF"
	#FontPath     "/usr/local/lib/X11/fonts/Type1/"
	#FontPath     "/usr/local/lib/X11/fonts/100dpi/"
	#FontPath     "/usr/local/lib/X11/fonts/75dpi/"
	FontPath     "/usr/local/lib/X11/fonts/dejavu/"
EndSection

Section "Module"
	Load  "extmod"
	Load  "record"
	Load  "dbe"
	Load  "glx"
	Load  "dri"
	Load  "dri2"
	Load  "freetype"
EndSection

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

Section "Monitor"
	#DisplaySize	  480   270	# mm
	Identifier   "Monitor0"
	VendorName   "ACI"
	ModelName    "VE228"
	HorizSync    30.0 - 83.0
	VertRefresh  50.0 - 76.0
	Option	    "DPMS"
EndSection

Section "Device"
	Identifier  "Card0"
	Driver      "radeon"
	VendorName  "Advanced Micro Devices [AMD] nee ATI"
	BoardName   "RV380 [Radeon X600 (PCIE)]"
	BusID       "PCI:5:0:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection
```

and my Xorg.0.log: http://pastebin.com/embed_iframe.php?i=gxgV5Hpu

Thanks


----------



## wblock@ (Jun 21, 2012)

The log messages match mine.

Do you have HAL installed?  Yes, it's not being used by xorg, but it might still cause problems.
Is this a PS2 or USB keyboard?
Have you changed any keyboard-related settings in rc.conf or devd.conf?


----------



## markfisher (Jun 21, 2012)

@wblock@
Thanks for your reply.



			
				wblock@ said:
			
		

> Do you have HAL installed?  Yes, it's not being used by xorg, but it might still cause problems.



HAL is not installed (From our previous conversation Removing HAL)



			
				wblock@ said:
			
		

> Is this a PS2 or USB keyboard?



Both mouse and keyboard are PS/2



			
				wblock@ said:
			
		

> Have you changed any keyboard-related settings in rc.conf or devd.conf?


I'm lost  (Didn't know I have to add something in rc.conf for keyboard if I don't have HAL installed).

Thanks


----------



## wblock@ (Jun 21, 2012)

No, you should not have to add anything, but there are settings that could keep a USB keyboard from working.

Try starting a plain xterm or some other application instead of urxvt.


----------



## markfisher (Jun 22, 2012)

@wblock@
I deinstalled the keyboard driver and reinstalled it and still didn't work. I installed xterm and ran it in fluxbox; that didn't work.

My PS/2 keyboard and mouse are both connected to a KVM switch.


----------



## wblock@ (Jun 22, 2012)

Aha.  When the system boots, it scans for a PS2 keyboard.  KVMs often cause problems with that.  I think there are hardware hints that will force it to detect a keyboard.  For now, see if it works if a PS2 keyboard is attached directly to the system.


----------



## markfisher (Jun 22, 2012)

I connected keyboard directly and still no luck. I can't type anything in xterm.

Also if this helps, my src.conf

```
WITHOUT_DICT=                 "YES"
WITHOUT_FREEBSD_UPDATE=       "YES"
WITHOUT_GAMES=                "YES"
WITHOUT_HTML=                 "YES"
WITHOUT_INFO=                 "YES"
WITHOUT_IPFILTER=             "YES"
WITHOUT_IPFW=                 "YES"
WITHOUT_SHAREDICS=            "YES"
WITHOUT_LIB32=                "YES"
WITHOUT_TELNET=               "YES"
WITHOUT_TCSH=                 "YES"
```

Also when I exit fluxbox, I see !23 23 !123 11!3 1!1!$!$..... in console.


----------



## wblock@ (Jun 22, 2012)

ctrl-alt-f1 does not stop X, it just switches to the console.  ctrl-alt-backspace will kill X, and re-running it may make a difference in how X detects a keyboard.

Let's try to remove some variables.  Connect the PS2 keyboard directly and disconnect the KVM. Reboot the computer; PS2 keyboard probing happens when the kernel starts.  Does the keyboard work on the console?

If the keyboard works on the console, start X.  The keyboard should still work.


----------



## markfisher (Jun 22, 2012)

wblock@ said:
			
		

> Let's try to remove some variables.  Connect the PS2 keyboard directly and disconnect the KVM. Reboot the computer; PS2 keyboard probing happens when the kernel starts.  Does the keyboard work on the console?


Keyboard (directly connected, no KVM) [Restart] -> works in console.



			
				wblock@ said:
			
		

> If the keyboard works on the console, start X.  The keyboard should still work.


startx and fluxbox appears. Right click and select xterm. I can't type. Right click and Exit -> I see those output from my previous post in console.

I used

```
WITHOUT_TCSH=                 "YES"
```
in my src.conf file and changed root shell to sh, could it be because of that?


----------



## wblock@ (Jun 22, 2012)

Could be, but unlikely if the xterm shows a prompt.

Depending on how you are starting X, the contents of .xinitrc or .xsession might be important.


----------



## markfisher (Jun 23, 2012)

My .xinitrc:

```
#!/bin/sh

exec /usr/local/bin/fluxbox -rc /usr/local/share/fluxbox/init -log ~/fluxbox.log
```

What I found out is in fluxbox, when I load xterm and type, it actually types in console terminal rather than xterm. For example, while I'm in fluxbox and load xterm and them type cat or anything, then exit fluxbox (from menu), I see cat printed in console.


----------



## wblock@ (Jun 23, 2012)

In case it is something fluxbox is doing, try twm(1).  It should already be installed.  Running /usr/local/lib/X11/xinit/xinitrc should work.


----------



## markfisher (Jun 23, 2012)

@wblock@
That didn't work.

I reinstalled everything:

Connect everything directly (no KVM switch involved)
Install FreeBSD
Update source tree and build custom kernel; from src.conf I removed:
	
	



```
WITHOUT_TCSH=                 "YES"
```

my make.conf:

```
PERL_VERSION=5.14.2
WITHOUT_HAL=yes
WITHOUT_DBUS=yes
WITHOUT_GNOME=yes
WITHOUT_KDE=yes
WITHOUT_KDE4=yes
WITHOUT_QT=yes
WITHOUT_QT4=yes
X_WINDOW_SYSTEM=xorg
WITHOUT_NOUVEAU=yes
```

Build/Install xorg-server
Build/Install xf86-input-keyboard, xf86-input-mouse, and xf86-video-ati
Build/Install xinit
xinitrc:

```
#!/bin/sh

exec /usr/local/bin/fluxbox
```

Build/Install mkfontdir
Build/Install x11-font/dejavu
Run command `mkfontdir /usr/local/lib/X11/fonts/dejavu`
Build/Install rxvt-unicode
Run command(s):
`Xorg -configure`
`Xorg -config xorg.conf.new -retro`
`cp xorg.conf.new /etc/X11/xorg.conf`
Modify xorg.conf to be exactly as my first post
Run command `startx`
Still no luck.

I also installed twm and xterm. Changed my .xinitrc to:

```
#!/bin/sh
xterm&
exec /usr/local/bin/twm
```
and then ran startx. I can't type.


----------



## wblock@ (Jun 23, 2012)

markfisher said:
			
		

> @wblock@
> That didn't work.



Which part?



> ```
> WITHOUT_HAL=yes
> WITHOUT_DBUS=yes
> WITHOUT_GNOME=yes
> ...



I'm pretty sure none of those do anything.  They may seem obvious, but it doesn't mean they are implemented.



> 5. Build/Install xorg-server
> 6. Build/Install xf86-input-keyboard, xf86-input-mouse, and xf86-video-ati.
> 7. Build/Install xinit



How do you know that this is all that is needed for fluxbox or rxvt?  x11/xorg-minimal also includes x11/xauth.  Even then, people often find things missing that the full x11/xorg includes.


----------



## markfisher (Jun 23, 2012)

wblock@ said:
			
		

> Which part?


Running twm




			
				wblock@ said:
			
		

> How do you know that this is all that is needed for fluxbox or rxvt?  x11/xorg-minimal also includes x11/xauth.  Even then, people often find things missing that the full x11/xorg includes.



I did the same thing on my 64bit computer and worked. I can try full xorg.


----------



## markfisher (Jun 23, 2012)

@wblock@
I installed xorg (With default options) and then restart my computer. I still can't type. I'm thinking it might be because of HAL is not installed. On my 64bit computer, I enabled HAL and DBUS.

Do I need to do anything special on xorg.conf and rc.conf for USB keyboard?


----------



## wblock@ (Jun 23, 2012)

No, USB keyboards are handled the same as others, thanks to kbdmux(4).  HAL is not needed.


----------



## markfisher (Jun 23, 2012)

Ok. I attached my USB keyboard (Restart) and that didn't work either . I'm going to try everything on GENERIC kernel.


----------



## markfisher (Jun 28, 2012)

@wblock@
I finally figured out why my keyboard wasn't working. In my kernel configuration File:

```
device        sc
options       MAXCONS=2
```

And then I comment out all ttyvN except ttyv0 and ttyv1 from /etc/ttys. This means that I don't have:

```
#ttyv8   "/usr/X11R6/bin/xdm -nodaemon"  xterm   off secure
```

I changed my ttyv1 line to be like this:

```
ttyv1   "/usr/X11R6/bin/xdm -nodaemon"  xterm   off secure
```
then started fluxbox and my keyboard starts working  (NO HAL NOR DBUS ).


----------

