# Xorg, Hal & USB Joystick problem

## woZa

Hi. I am having problems getting my USB joypads working with X. They have worked ok on an old install of Gentoo (but I can't remember what I did to get them working!!!)

Running 2.6.29-gentoo-r1 with all the hid, joystick, devinput components built in to the kernel. Running xorg-server-1.5.3-r5 / xorg-x11-7.4.

dmesg output when joypads plugged in

```
[    4.011028] hub 7-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x301

[    4.113133] usb 7-1: new low speed USB device using uhci_hcd and address 2

[    4.254897] usb 7-1: skipped 1 descriptor after interface

[    4.259893] usb 7-1: default language 0x0409

[    4.268894] usb 7-1: New USB device found, idVendor=0810, idProduct=0001

[    4.268972] usb 7-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0

[    4.269052] usb 7-1: Product: Twin USB Joystick

[    4.269181] usb 7-1: uevent

[    4.269235] usb 7-1: usb_probe_device

[    4.269238] usb 7-1: configuration #1 chosen from 1 choice

[    4.271895] usb 7-1: adding 7-1:1.0 (config #1, interface 0)

[    4.271915] usb 7-1:1.0: uevent

[    4.271969] usbhid 7-1:1.0: usb_probe_interface

[    4.271972] usbhid 7-1:1.0: usb_probe_interface - got id

[    4.312040] input: Twin USB Joystick as /devices/pci0000:00/0000:00:1d.0/usb7/7-1/7-1:1.0/input/input6

[    4.335466] input: Twin USB Joystick as /devices/pci0000:00/0000:00:1d.0/usb7/7-1/7-1:1.0/input/input7

[    4.353446] pantherlord 0003:0810:0001.0003: input,hidraw2: USB HID v1.10 Joystick [Twin USB Joystick] on usb-0000:00:1d.0-1/input0

[    4.353571] pantherlord 0003:0810:0001.0003: Force feedback for PantherLord/GreenAsia devices by Anssi Hannula <anssi.hannula@gmail.com>

[    4.353747] drivers/usb/core/inode.c: creating file '002'

```

Xorg.0.log

```
X.Org X Server 1.5.3

Release Date: 5 November 2008

X Protocol Version 11, Revision 0

Build Operating System: Linux 2.6.29-gentoo-r1 x86_64 

Current Operating System: Linux mythserver 2.6.29-gentoo-r1 #4 SMP PREEMPT Mon Apr 27 18:38:41 BST 2009 x86_64

Build Date: 27 April 2009  05:51:06PM

 

   Before reporting problems, check http://wiki.x.org

   to make sure that you have the latest version.

Markers: (--) probed, (**) from config file, (==) default setting,

   (++) from command line, (!!) notice, (II) informational,

   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.

(==) Log file: "/var/log/Xorg.0.log", Time: Mon Apr 27 18:44:01 2009

(==) Using config file: "/etc/X11/xorg.conf"

(==) No Layout section.  Using the first Screen section.

(**) |-->Screen "Screen0" (0)

(**) |   |-->Monitor "Monitor0"

(**) |   |-->Device "Videocard0"

(==) Automatically adding devices

(==) Automatically enabling devices

(==) FontPath set to:

   /usr/share/fonts/misc/,

   /usr/share/fonts/TTF/,

   /usr/share/fonts/OTF,

   /usr/share/fonts/Type1/,

   /usr/share/fonts/100dpi/,

   /usr/share/fonts/75dpi/,

   built-ins

(==) ModulePath set to "/usr/lib64/xorg/modules"

(**) Extension "Composite" is disabled

(II) Cannot locate a core pointer device.

(II) Cannot locate a core keyboard device.

(II) The server relies on HAL to provide the list of input devices.

   If no devices become available, reconfigure HAL or disable AllowEmptyInput.

(II) Open ACPI successful (/var/run/acpid.socket)

(II) Loader magic: 0x1500

(II) Module ABI versions:

   X.Org ANSI C Emulation: 0.4

   X.Org Video Driver: 4.1

   X.Org XInput driver : 2.1

   X.Org Server Extension : 1.1

(II) Loader running on linux

(--) using VT number 7

(--) PCI:*(0@1:0:0) nVidia Corporation GeForce 8400 GS rev 161, Mem @ 0xf2000000/16777216, 0xe0000000/268435456, 0xf0000000/33554432, I/O @ 0x0000a000/128, BIOS @ 0x????????/131072

(II) System resource ranges:

   [0] -1   0   0xffffffff - 0xffffffff (0x1) MX[B]

   [1] -1   0   0x000f0000 - 0x000fffff (0x10000) MX[B]

   [2] -1   0   0x000c0000 - 0x000effff (0x30000) MX[B]

   [3] -1   0   0x00000000 - 0x0009ffff (0xa0000) MX[B]

   [4] -1   0   0x0000ffff - 0x0000ffff (0x1) IX[B]

   [5] -1   0   0x00000000 - 0x00000000 (0x1) IX[B]

(II) "extmod" will be loaded by default.

(II) "dbe" will be loaded by default.

(II) "glx" will be loaded by default.

(II) "record" will be loaded by default.

(II) "dri" will be loaded by default.

(II) LoadModule: "vnc"

(II) Loading /usr/lib64/xorg/modules/extensions//libvnc.so

(II) Module vnc: vendor="RealVNC Ltd"

   compiled for 4.3.99.902, module version = 1.0.0

   Module class: X.Org Server Extension

   ABI class: X.Org Server Extension, version 1.1

(II) Loading extension VNC

(II) LoadModule: "extmod"

(II) Loading /usr/lib64/xorg/modules/extensions//libextmod.so

(II) Module extmod: vendor="X.Org Foundation"

   compiled for 1.5.3, module version = 1.0.0

   Module class: X.Org Server Extension

   ABI class: X.Org Server Extension, version 1.1

(II) Loading extension SHAPE

(II) Loading extension MIT-SUNDRY-NONSTANDARD

(II) Loading extension BIG-REQUESTS

(II) Loading extension SYNC

(II) Loading extension MIT-SCREEN-SAVER

(II) Loading extension XC-MISC

(II) Loading extension XFree86-VidModeExtension

(II) Loading extension XFree86-Misc

(II) Loading extension XFree86-DGA

(II) Loading extension DPMS

(II) Loading extension TOG-CUP

(II) Loading extension Extended-Visual-Information

(II) Loading extension XVideo

(II) Loading extension XVideo-MotionCompensation

(II) Loading extension X-Resource

(II) LoadModule: "dbe"

(II) Loading /usr/lib64/xorg/modules/extensions//libdbe.so

(II) Module dbe: vendor="X.Org Foundation"

   compiled for 1.5.3, module version = 1.0.0

   Module class: X.Org Server Extension

   ABI class: X.Org Server Extension, version 1.1

(II) Loading extension DOUBLE-BUFFER

(II) LoadModule: "glx"

(II) Loading /usr/lib64/xorg/modules/extensions//libglx.so

(II) Module glx: vendor="NVIDIA Corporation"

   compiled for 4.0.2, module version = 1.0.0

   Module class: X.Org Server Extension

(II) NVIDIA GLX Module  180.51  Fri Apr 17 00:35:49 PDT 2009

(II) Loading extension GLX

(II) LoadModule: "record"

(II) Loading /usr/lib64/xorg/modules/extensions//librecord.so

(II) Module record: vendor="X.Org Foundation"

   compiled for 1.5.3, module version = 1.13.0

   Module class: X.Org Server Extension

   ABI class: X.Org Server Extension, version 1.1

(II) Loading extension RECORD

(II) LoadModule: "dri"

(II) Loading /usr/lib64/xorg/modules/extensions//libdri.so

(II) Module dri: vendor="X.Org Foundation"

   compiled for 1.5.3, module version = 1.0.0

   ABI class: X.Org Server Extension, version 1.1

(II) Loading extension XFree86-DRI

(II) LoadModule: "nvidia"

(II) Loading /usr/lib64/xorg/modules/drivers//nvidia_drv.so

(II) Module nvidia: vendor="NVIDIA Corporation"

   compiled for 4.0.2, module version = 1.0.0

   Module class: X.Org Video Driver

(II) NVIDIA dlloader X Driver  180.51  Fri Apr 17 00:15:00 PDT 2009

(II) NVIDIA Unified Driver for all Supported NVIDIA GPUs

(II) Primary Device is: PCI 01@00:00:0

(II) Loading sub module "fb"

(II) LoadModule: "fb"

(II) Loading /usr/lib64/xorg/modules//libfb.so

(II) Module fb: vendor="X.Org Foundation"

   compiled for 1.5.3, module version = 1.0.0

   ABI class: X.Org ANSI C Emulation, version 0.4

(II) Loading sub module "wfb"

(II) LoadModule: "wfb"

(II) Loading /usr/lib64/xorg/modules//libwfb.so

(II) Module wfb: vendor="X.Org Foundation"

   compiled for 1.5.3, module version = 1.0.0

   ABI class: X.Org ANSI C Emulation, version 0.4

(II) Loading sub module "ramdac"

(II) LoadModule: "ramdac"

(II) Module "ramdac" already built-in

(II) resource ranges after probing:

   [0] -1   0   0xffffffff - 0xffffffff (0x1) MX[B]

   [1] -1   0   0x000f0000 - 0x000fffff (0x10000) MX[B]

   [2] -1   0   0x000c0000 - 0x000effff (0x30000) MX[B]

   [3] -1   0   0x00000000 - 0x0009ffff (0xa0000) MX[B]

   [4] -1   0   0x0000ffff - 0x0000ffff (0x1) IX[B]

   [5] -1   0   0x00000000 - 0x00000000 (0x1) IX[B]

(**) NVIDIA(0): Depth 24, (--) framebuffer bpp 32

(==) NVIDIA(0): RGB weight 888

(==) NVIDIA(0): Default visual is TrueColor

(==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)

(**) NVIDIA(0): Option "NoLogo" "True"

(**) NVIDIA(0): Option "NvAGP" "2"

(**) NVIDIA(0): Option "RenderAccel" "0"

(**) NVIDIA(0): Option "MetaModes" "1920x1080_50 +0+2; 1920x1080_60 +0+0; 1280x720_60 +0+0; 720x480_60 +0+0; 1280x720_50 +0+0; 720x576_50 +0+0"

(**) NVIDIA(0): Option "UseEvents" "True"

(**) NVIDIA(0): Disabling RENDER acceleration

(**) NVIDIA(0): Use of AGPGART requested

(II) NVIDIA(0): NVIDIA GPU GeForce 8400 GS (G86) at PCI:1:0:0 (GPU-0)

(--) NVIDIA(0): Memory: 524288 kBytes

(--) NVIDIA(0): VideoBIOS: 60.86.4a.00.25

(II) NVIDIA(0): Detected PCI Express Link width: 16X

(--) NVIDIA(0): Interlaced video modes are supported on this GPU

(--) NVIDIA(0): Connected display device(s) on GeForce 8400 GS at PCI:1:0:0:

(--) NVIDIA(0):     SAMSUNG (DFP-0)

(--) NVIDIA(0): SAMSUNG (DFP-0): 165.0 MHz maximum pixel clock

(--) NVIDIA(0): SAMSUNG (DFP-0): Internal Single Link TMDS

(II) NVIDIA(0): Assigned Display Device: DFP-0

(II) NVIDIA(0): Validated modes:

(II) NVIDIA(0):     "1920x1080_50+0+2"

(II) NVIDIA(0):     "1920x1080_60+0+0"

(II) NVIDIA(0):     "1280x720_60+0+0"

(II) NVIDIA(0):     "720x480_60+0+0"

(II) NVIDIA(0):     "1280x720_50+0+0"

(II) NVIDIA(0):     "720x576_50+0+0"

(II) NVIDIA(0): Virtual screen size determined to be 1920 x 1082

(--) NVIDIA(0): DPI set to (304, 304); computed from "UseEdidDpi" X config

(--) NVIDIA(0):     option

(==) NVIDIA(0): Disabling 32-bit ARGB GLX visuals.

(--) Depth 24 pixmap format is 32 bpp

(II) do I need RAC?  No, I don't.

(II) resource ranges after preInit:

   [0] -1   0   0xffffffff - 0xffffffff (0x1) MX[B]

   [1] -1   0   0x000f0000 - 0x000fffff (0x10000) MX[B]

   [2] -1   0   0x000c0000 - 0x000effff (0x30000) MX[B]

   [3] -1   0   0x00000000 - 0x0009ffff (0xa0000) MX[B]

   [4] -1   0   0x0000ffff - 0x0000ffff (0x1) IX[B]

   [5] -1   0   0x00000000 - 0x00000000 (0x1) IX[B]

(II) NVIDIA(0): Initialized GPU GART.

(II) NVIDIA(0): Setting mode "1920x1080_50+0+2"

(II) Loading extension NV-GLX

(II) NVIDIA(0): NVIDIA 3D Acceleration Architecture Initialized

(==) NVIDIA(0): Disabling shared memory pixmaps

(II) NVIDIA(0): Using the NVIDIA 2D acceleration architecture

(==) NVIDIA(0): Backing store disabled

(==) NVIDIA(0): Silken mouse enabled

(II) NVIDIA(0): DPMS enabled

(II) Loading extension NV-CONTROL

(II) Loading extension XINERAMA

(WW) NVIDIA(0): Option "SecurityTypes" is not used

(WW) NVIDIA(0): Option "UserPasswdVerifier" is not used

(WW) NVIDIA(0): Option "PasswordFile" is not used

(==) RandR enabled

(II) Initializing built-in extension MIT-SHM

(II) Initializing built-in extension XInputExtension

(II) Initializing built-in extension XTEST

(II) Initializing built-in extension XKEYBOARD

(II) Initializing built-in extension XINERAMA

(II) Initializing built-in extension XFIXES

(II) Initializing built-in extension RENDER

(II) Initializing built-in extension RANDR

(II) Initializing built-in extension COMPOSITE

(II) Initializing built-in extension DAMAGE

(II) Initializing built-in extension XEVIE

(II) Initializing extension GLX

(II) config/hal: Adding input device Walkera WK-0701 TX

(II) LoadModule: "evdev"

(II) Loading /usr/lib64/xorg/modules/input//evdev_drv.so

(II) Module evdev: vendor="X.Org Foundation"

   compiled for 1.5.3, module version = 2.2.1

   Module class: X.Org XInput Driver

   ABI class: X.Org XInput driver, version 2.1

(**) Walkera WK-0701 TX: always reports core events

(**) Walkera WK-0701 TX: Device: "/dev/input/event2"

(II) Walkera WK-0701 TX: Found x and y absolute axes

(WW) Walkera WK-0701 TX: Don't know how to use device

(II) UnloadModule: "evdev"

(EE) PreInit returned NULL for "Walkera WK-0701 TX"

(EE) config/hal: NewInputDeviceRequest failed

(II) config/hal: Adding input device AT Translated Set 2 keyboard

(**) AT Translated Set 2 keyboard: always reports core events

(**) AT Translated Set 2 keyboard: Device: "/dev/input/event3"

(II) AT Translated Set 2 keyboard: Found keys

(II) AT Translated Set 2 keyboard: Configuring as keyboard

(II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD)

(**) Option "xkb_rules" "evdev"

(**) Option "xkb_model" "evdev"

(**) Option "xkb_layout" "us"

(II) config/hal: Adding input device Twin USB Joystick

(**) Twin USB Joystick: always reports core events

(**) Twin USB Joystick: Device: "/dev/input/event7"

(II) Twin USB Joystick: Found x and y absolute axes

(WW) Twin USB Joystick: Don't know how to use device

(II) UnloadModule: "evdev"

(EE) PreInit returned NULL for "Twin USB Joystick"

(EE) config/hal: NewInputDeviceRequest failed

(II) config/hal: Adding input device Twin USB Joystick

(**) Twin USB Joystick: always reports core events

(**) Twin USB Joystick: Device: "/dev/input/event6"

(II) Twin USB Joystick: Found x and y absolute axes

(WW) Twin USB Joystick: Don't know how to use device

(II) UnloadModule: "evdev"

(EE) PreInit returned NULL for "Twin USB Joystick"

(EE) config/hal: NewInputDeviceRequest failed

(II) config/hal: Adding input device HID 05a4:9881

(**) HID 05a4:9881: always reports core events

(**) HID 05a4:9881: Device: "/dev/input/event5"

(II) HID 05a4:9881: Found 5 mouse buttons

(II) HID 05a4:9881: Found x and y relative axes

(II) HID 05a4:9881: Found scroll wheel(s)

(II) HID 05a4:9881: Found keys

(II) HID 05a4:9881: Configuring as mouse

(II) HID 05a4:9881: Configuring as keyboard

(**) HID 05a4:9881: YAxisMapping: buttons 4 and 5

(**) HID 05a4:9881: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200

(II) XINPUT: Adding extended input device "HID 05a4:9881" (type: KEYBOARD)

(**) Option "xkb_rules" "evdev"

(**) Option "xkb_model" "evdev"

(**) Option "xkb_layout" "us"

(II) config/hal: Adding input device HID 05a4:9881

(**) HID 05a4:9881: always reports core events

(**) HID 05a4:9881: Device: "/dev/input/event4"

(II) HID 05a4:9881: Found keys

(II) HID 05a4:9881: Configuring as keyboard

(II) XINPUT: Adding extended input device "HID 05a4:9881" (type: KEYBOARD)

(**) Option "xkb_rules" "evdev"

(**) Option "xkb_model" "evdev"

(**) Option "xkb_layout" "us"

(II) NVIDIA(0): Setting mode "1920x1080_50+0+2"
```

/etc/X11/xorg.conf

```
#Section "ServerFlags"

#        Option "AutoAddDevices" "False"

#EndSection

#Section "InputDevice"

#   Identifier "Joypad 1"

#   Driver "joystick"

#   Option "Device" "/dev/input/event5"

#EndSection

Section "Module"

   Load      "vnc"

EndSection

Section "Extensions"   

   Option      "Composite"   "Disable"

EndSection

Section "Monitor"

   Identifier   "Monitor0"

   VendorName   "Samsung"

   ModelName   "LE37A686"

   HorizSync   26.0 - 76.0

   VertRefresh   23.0 - 61.0

EndSection

Section "Device"

   Identifier   "Videocard0"

   Driver      "nvidia"

   VendorName   "XFX"

   BoardName   "XFX nVidia GeForce 8400 GS"

#   Option      "RenderAccel"   "1"

   Option      "RenderAccel"   "0"

   Option      "NvAGP"      "2"

   Option      "NoLogo"   "True"

   Option      "UseEvents"   "True"

EndSection

Section "Screen"

   Identifier  "Screen0"

   Device      "Videocard0"

   Monitor     "Monitor0"

   DefaultDepth 24

   Option      "metamodes" "1920x1080_50 +0+2; 1920x1080_60 +0+0; 1280x720_60 +0+0; 720x480_60 +0+0; 1280x720_50 +0+0; 720x576_50 +0+0"

    Subsection "Display"

   Viewport   0 0

        Depth      24

   #      1080p      720p      480p

#   Modes      "1920x1080_60"   "1280x720_60"   "720x480_60"

#   Modes      "1920x1080_50"   "1280x720_50"   "720x480_50"

    EndSubsection

   Option "SecurityTypes" "VncAuth"

   Option "UserPasswdVerifier" "VncAuth"

   Option "PasswordFile" "/root/.vnc/passwd"

EndSection

```

Have tried with 

```
Option "AutoAddDevices" "False"
```

 and the InputDevices section (commented out for now) but still no joy...

xorg-server compiled with "hal" use flag and "joystick, evdev, keyboard, mouse" as inputdevice.

Anyone have any ideas?

Thanks in advance.

----------

## yabbadabbadont

Have you tried uncommenting the InputDevice section of xorg.conf for your joystick so that it uses the joystick driver instead of evdev?

----------

## woZa

Yes. With that I get the following Xorg.0.log (relevant lines only)

```
(II) config/hal: Adding input device Twin USB Joystick

(**) Twin USB Joystick: always reports core events

(**) Twin USB Joystick: Device: "/dev/input/event7"

(II) Twin USB Joystick: Found x and y absolute axes

(WW) Twin USB Joystick: Don't know how to use device

(II) UnloadModule: "evdev"

(EE) PreInit returned NULL for "Twin USB Joystick"

(EE) config/hal: NewInputDeviceRequest failed

(II) config/hal: Adding input device Twin USB Joystick

(**) Twin USB Joystick: always reports core events

(**) Twin USB Joystick: Device: "/dev/input/event6"

(II) Twin USB Joystick: Found x and y absolute axes

(WW) Twin USB Joystick: Don't know how to use device

(II) UnloadModule: "evdev"

(EE) PreInit returned NULL for "Twin USB Joystick"

(EE) config/hal: NewInputDeviceRequest failed

```

Seems like it is still using evdev even with that section uncommented...???

Thanks

----------

## yabbadabbadont

I think that you also have to have the 

```
Option "AutoAddDevices" "False"
```

 at the same time...  but then that will also affect your keyboard and mouse.  This xorg release has been a real cluster fuck.   :Rolling Eyes:   Personally, I'm thinking of disabling the hal USE flag and rebuilding everything.

Edit: OK, sorry for the mini-rant.   :Very Happy:   You probably have to have an appropriate fdi file for your joystick in /etc/hal/fdi/policy before it will work correctly.

----------

## woZa

Uncommenting that as well gives the following error...

```
(II) config/hal: Adding input device Walkera WK-0701 TX

(EE) config/hal: NewInputDeviceRequest failed

(II) config/hal: Adding input device AT Translated Set 2 keyboard

(EE) config/hal: NewInputDeviceRequest failed

(II) config/hal: Adding input device Twin USB Joystick

(EE) config/hal: NewInputDeviceRequest failed

(II) config/hal: Adding input device Twin USB Joystick

(EE) config/hal: NewInputDeviceRequest failed

(II) config/hal: Adding input device HID 05a4:9881

(EE) config/hal: NewInputDeviceRequest failed

(II) config/hal: Adding input device HID 05a4:9881

(EE) config/hal: NewInputDeviceRequest failed

```

Thanks for you help so far...

----------

## yabbadabbadont

Well, the upgrade guide links to some examples of fdi files that tell hal to use drivers other than evdev for devices.

http://cgit.freedesktop.org/xorg/driver/xf86-input-synaptics/tree/fdi/11-x11-synaptics.fdi

You might be able to modify that example to use the joystick driver and to pass the options from your old xorg.conf to it using hal.

----------

## woZa

Thanks for the push in the right direction. A bit more googling turned up the following link

https://wiki.ubuntu.org.cn/index.php?title=UbuntuHelp:Sixaxis&variant=zh-hant

```
Section "InputDevice"

   Identifier "Joypad 1"

   Driver "joystick"

   Option "Device" "/dev/input/by-id/usb-0810_Twin_USB_Joystick-joystick"

   Option "Path" "/dev/input/js2"

EndSection

```

Seemed to do the trick...

Thanks again.

----------

## yabbadabbadont

I'm glad you figured it out.  I generally don't mess with my joystick in Linux, but at least now I'll have your example to start with.  So, thank you.   :Very Happy: 

----------

