# Keyboard / Dance mat / udev problem [Somewhat solved :)]

## yfflet

I'm trying to get my ps/2 connected dance pad to work, but i can't get any input from it...

Until a couple of weeks ago I used a ps/2 keyboard, so I thought that the dance mat would just work straight away but the only place i can get input from it is in bios and grub, which is unfortunately not as fun as stepmania  :Wink: . This should also mean that it is not a joystick or anything wierd that goes into the ps/2 port but is no keyboard.

Anyway. As soon as I reach past grub, I get no input from the dance mat, and I can't find it either by using cat on devices with names that suggests they are somehow event or input related.

If anyone has any ideas or so, I'd be more than grateful  :Smile: 

Going to round up some info about my system (while trying to avoid to bloat this post completely)...

```

SmekarN  # uname -a

Linux SmekarN.kicks-ass-org 2.6.22-gentoo-r5Smeeeeeekipek! #1 PREEMPT Thu Sep 13 14:30:28 CEST 2007 x86_64 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux

SmekarN linux # cat .config|grep PS2;cat .config|grep KEYBOARD;cat .config |grep INPUT

# CONFIG_SERIO_PCIPS2 is not set

CONFIG_SERIO_LIBPS2=y

CONFIG_INPUT_KEYBOARD=y

CONFIG_KEYBOARD_ATKBD=y

# CONFIG_KEYBOARD_SUNKBD is not set

# CONFIG_KEYBOARD_LKKBD is not set

# CONFIG_KEYBOARD_XTKBD is not set

# CONFIG_KEYBOARD_NEWTON is not set

# CONFIG_KEYBOARD_STOWAWAY is not set

CONFIG_INPUT=y

# CONFIG_INPUT_FF_MEMLESS is not set

# CONFIG_INPUT_POLLDEV is not set

CONFIG_INPUT_MOUSEDEV=y

# CONFIG_INPUT_MOUSEDEV_PSAUX is not set

CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024

CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768

# CONFIG_INPUT_JOYDEV is not set

# CONFIG_INPUT_TSDEV is not set

CONFIG_INPUT_EVDEV=y

# CONFIG_INPUT_EVBUG is not set

CONFIG_INPUT_KEYBOARD=y

# CONFIG_INPUT_MOUSE is not set

# CONFIG_INPUT_JOYSTICK is not set

# CONFIG_INPUT_TABLET is not set

# CONFIG_INPUT_TOUCHSCREEN is not set

# CONFIG_INPUT_MISC is not set

# CONFIG_USB_HIDINPUT_POWERBOOK is not set

```

Edit (9th of October 07):

I now tried to make a new kernel with genkernel (since it's supposed to be good when you're not sure what's missing in your kernel config), but I still get no input. Tried first 2.6.22-r5 and then 2.6.16-r13, both of them do compile, and i get everything running, except for the mat.

My new theory is that the mat somehow doesn't make udev realize it is there (bad firmware or something), which makes me wanna try to switch back to the old devfs (yes, I know, deprecated, but still), or possibly configure udev to be a little bit less fussy with what I put into my computer. Does anyone have any thoughts on this, or any ideas? I'd be more than happy to hear you guys out  :Smile: 

Edit (10th of November):

I didn't manage to get udev (if that's what goes wrong) to work, but I managed to find this ugly workaround that I'll stick with for now.

I went back to the garbage room, and found my old ps/2 kbd on a shelf, went back and plugged it in, checked in a terminal that it was working, and then I switched back to the dance mat. Works great! As soon as the system realizes it should check the ps/2 port for input, everything works.

The question is... How do I get my computer to find that darn mat so I can finally trow my old shitty keyboard (that I utterly dislike btw) out the window?  :Smile: 

Still grateful for help, and I'm pretty sure the same goes for others.

----------

## turtles

what exactly is a dance mat?

----------

## yfflet

I don't mean to be cocky, I just can't find a good way to explain it  :Smile: 

The ones for PCs, are basically a numpad that you step around on, usually plugged in as if it was a regular keyboard, although there's supposed to be ones that connects like a joystick (mine's ps/2).

Thanks for replying  :Wink: 

----------

## turtles

I think you need to write a udev rule for the mat.

try 

```
less /proc/bus/input/devices
```

and see if you find the mat.

check this on writing udev rules page out 

thanks for the link on the dance mat

----------

## yfflet

Well, /proc/bus/input/devices lists 2 power buttons, my usb keyboard (twice) and my usb mouse (twice) and that's it.

If I plug my old PS/2 keyboard, I also get

```
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41

N: Name="AT Translated Set 2 keyboard"

P: Phys=isa0060/serio0/input0

S: Sysfs=/class/input/input5

U: Uniq=

H: Handlers=kbd event5 

B: EV=120013

B: KEY=402000000 3802078f840d001 feffffdfffefffff fffffffffffffffe

B: MSC=10

B: LED=7

```

which remains the same if I swap it for my dance mat.

Furthermore, /sys/class/input/input5 isn't created until I plug my ps/2 keyboard in.

Can't really figure out any good way of writing a rule for this thing, I think I need to make it appear by itself before I can make any progress making udev rules.

Or it might just be that it's 4 o clock in the morning and I'm simply not doing it right.  :Smile: 

This is what it looks like atm:

```

KERNEL=="event5", SYMLINK+="dance_mat"

```

Thing is that I can't really make the mat work, and then look in the /sys and /proc folders for it's specs, since I'll only get the specs for my keyboard that way.

Well, presumably, you're right, and I'm just stupid, I'll give it another try after work tomorrow  :Smile: 

Thanks for your help so far man.

----------

## turtles

check dmesg when you plug in the dance mat.

We might have to make a device node for it.

kinda like this http://linuxusbguide.sourceforge.net/USB-guide-1.0.9/x201.html

but not usb.

try using cat to find input from the dance mat under /dev/input/

however for me it does not work with X running.

so drop out of X for a bit.

More info here http://www.gentoo.org/doc/en/udev-guide.xml?style=printable

----------

## yfflet

dmesg gives nothing, and I still got no success with writing udev rules :/

My /dev/input has event0, event1, event2, event3 and event4 in it.

I only managed to identify 2 of them (event2 = mouse and event3 = keyboard).

Presumably the others are for the power buttons, (I don't wanna try that while in the midst of writing a post  :Wink:  ) but at least I'm sure none of them represents the mat.

Seems like the right end to start is mknod, but isn't that why people use udev/devfs; so you don't have to use mknod at all?

The question is: how do I figure out what numbers to put as arguments?

*reading tfm*

"man mknod" tells me to look in "info mknod", which has the same contents as the former, except for the reference to "info mknod"  :Smile: 

*rtfm some more*

Found out that my mouse has major 13 and minor 63 (edit: realized just now that that was in your first link all the time)... Found nothing on the same major that produces output.

Oh, there it is! /usr/src/linux/Documentation/devices.txt : exactly what I was looking for  :Smile: 

Hmm.. It strongly suggests that if there's an event5 (what my ps/2 kbd ends up as) present, it'd be on major 13, minor 69, though it just gives me

```

SmekarN  # mknod mat c 13 69

SmekarN  # cat mat 

cat: mat: No such device

```

so I'm once again kind of stuck.

Sorry for this somewhat chaotic post, I'm just home from 12h of work, so I'm not capable of writing like a normal person  :Smile: 

Thanks for your help so far though!

Any comments on my attempt at making an udev rule?

Is it doable that way under these circumstances, or is mknod the way to go?

Any idea of how to "make mknod work"?  :Smile: 

Geez, so many questions, how did I become this lost?

----------

## turtles

Interesting read on ps/2 connectors it could be a issue with the actual port it is plugged into. When you log in select console loigin and login without starting x then try:

```
cat /dev/misc/psaux
```

plug in your dance mat and see where it it getting input in /dev.

it is somthing to do with the psaux kernel module.

see this for more ideas http://tuxmobil.org/Mobile-Guide.db/mobile-guide-p2c1s7-pointing-devices.html

we might have to add the mat to xorg.conf as well. as a new input device.

cheers

----------

## yfflet

Sorry for not getting back to you quicker, haven't had the energy to fight with my computer lately. :S

I don't have a device called /dev/psaux, and on computers where it does exist, it's just a pointer to some /dev/event/event* device isn't it?

Like, this error seems to be on a kernel-level. When I plug my mat in, I get no input whatsoever in my system logger (every device I've tried has done so when plugged in), and thus the appropriate devices aren't set up. However, when the device IS set up (by plugging in a regular keyboard and swapping it for the mat) everything works flawlessly.  :Smile: 

The way I see it (not that I'm a kernel expert or anything...) is that I can either solve this by making the kernel notice that the mat is plugged in, or by manually creating the device myself, and hope that this triggers the kernel to notice the mat itself. However, I'm clueless on how to achieve any of that.  :Sad: 

One theory, that sounds plausible to me, even though I base it on nothing but uneducated guesses, is that the mat's firmware isn't using the correct handshake that's supposed to make the kernel communicate with it, and thus it's just ignored. Since ps/2 is old as, it's possible to do the swap-thing because the timeout is so long, as required back in the days, that the kernel isn't dropping the connection as it would if you'd unplug a usb-keyboard for example.

Any ideas, comments?

Thanks a bunch for your help so far  :Smile: 

Edit after thinking it all over  :Smile: 

A line I wrote some posts ago caught my eye:

P: Phys=isa0060/serio0/input0 

Taken from /proc/bus/something/something, in a file set up when I plug my ps/2 kbd in.

This made me look for something related, and I found this:

```
SmekarN serio0 # cd /sys/bus/serio/devices/serio0

SmekarN serio0 # ls

bind_mode  description  drvctl  id  modalias  power  subsystem  uevent

SmekarN serio0 # cat drvctl 

cat: drvctl: Permission denied

SmekarN serio0 # cat description 

i8042 KBD port

SmekarN serio0 # cat bind_mode   

auto

SmekarN serio0 # ls subsystem/

devices  drivers  drivers_autoprobe  drivers_probe

```

Anyway, you might catch the drift.

This seems to be where the keyboard port is managed by /sys.

subsystem is a link back to /sys/bus/serio, and what I find interesting is the presence of the files drivers_autoprobe and drivers_probe.

Perhaps there's a way to force the kernel to probe that port by somehow modifying these files?

----------

## turtles

I agree we need the kernel to sense the event of the mat being plugged in.

We need to try recompiling the kernel.

 CONFIG_KEYBOARD_SUNKBD =M

 CONFIG_KEYBOARD_LKKBD = M

 CONFIG_KEYBOARD_XTKBD = M

 CONFIG_KEYBOARD_NEWTON = M

 CONFIG_KEYBOARD_STOWAWAY = M

 CONFIG_INPUT_FF_MEMLESS is not set ???

 CONFIG_INPUT_POLLDEV is not set

CONFIG_INPUT_MOUSEDEV_PSAUX = M

 CONFIG_INPUT_JOYDEV is not set = M

 CONFIG_INPUT_TSDEV is not set = M

 CONFIG_INPUT_EVBUG is not set = M

CONFIG_INPUT_MOUSE = M 

CONFIG_INPUT_JOYSTICK is not set = M

 CONFIG_INPUT_TABLET is not set = M

CONFIG_INPUT_MISC = Y

The debugging option may be a good module not be needed long term.

Tip: the "/" key gets you a search in menuconfig 

INPUT_MISC [=Y]                                                                                 │  

  │ Prompt: Miscellaneous devices                                                                           │  

  │   Defined at drivers/input/misc/Kconfig:4                                                               │  

  │   Depends on: !S390 && INPUT                                                                            │  

  │   Location:                                                                                             │  

  │     -> Device Drivers                                                                                   │  

  │       -> Input device support                                                                           │  

  │         -> Generic input layer (needed for keyboard, mouse, ...) (INPUT [=y])    

Try compiling the above as modules or compile them all in. If you compile them in as modules try them one at a time with modprobe.

Remember no matter what:

1) You are getting input from the mat in bios and grub because x is not running. the Kernel takes the input from the mat to the console level you need xorg.conf to take it to the GUI level.

2) You need to stop the X server and work in the console to find the input file for the mat as in above post. not a terminal from within X.

3) Then we need to map that input file into xorg.conf as an input device section. (back up the old xorg.conf first)

see /etc/X11/xorg.conf there are sections for "input device" we need to make a new section for the mat.

4)We need to key map the input from the mat to what ever program you want to use it with. See below

(interesting link)

Interesting link here on keybord mapping

hope this helps

----------

## turtles

I found this and thought I'd add it.

http://qjoypad.sourceforge.net/

emerge ames-util/qjoypad

might help

----------

