LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 05-28-2006, 06:53 PM   #1
bhepple
LQ Newbie
 
Registered: Mar 2004
Location: Brisbane, Queensland, Australia
Distribution: fedora
Posts: 19

Rep: Reputation: 0
Adding USB joystick as 2nd x11 pointer


Any ideas how to do that? I want to keep my normal mouse but also have use a USB joystick to move the pointer, click etc
How about mapping buttons etc?

I already tried putting this in xorg.conf:


Section "InputDevice"
Identifier "Joystick"
Driver "joystick"
Option "Device" "/dev/input/js0"
Option "SendCoreEvents" "true"
EndSection

and this in the serverlayout:
InputDevice "Joystick" "SendCoreEvents"

... it's on virtual/x11-7.0-r2 (modular Xorg) which I compiled with the (Gentoo) +joystick USE flag. X starts up and the mouse is OK as usual but joystick is dead.

usbview sees the joystick but other than that I'm at sea ...


THanks


BOb
 
Old 05-28-2006, 08:55 PM   #2
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 58
Here is how I get two mouse to work on my laptop
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
InputDevice ""Joystick" "AlwaysCore"
and I would try without;
Option "SendCoreEvents" "true"
 
Old 05-30-2006, 04:09 AM   #3
bhepple
LQ Newbie
 
Registered: Mar 2004
Location: Brisbane, Queensland, Australia
Distribution: fedora
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by comprookie2000
Here is how I get two mouse to work on my laptop
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
InputDevice ""Joystick" "AlwaysCore"
and I would try without;
Option "SendCoreEvents" "true"
Nope - I just tried it and I still get nada on the joystick.

I might mention that

od </dev/input/js0

_does_ respond to the joystick so I am definitely connected through the USB
 
Old 05-30-2006, 04:30 AM   #4
bhepple
LQ Newbie
 
Registered: Mar 2004
Location: Brisbane, Queensland, Australia
Distribution: fedora
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by comprookie2000
Here is how I get two mouse to work on my laptop
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
InputDevice ""Joystick" "AlwaysCore"
and I would try without;
Option "SendCoreEvents" "true"
... but the log (/var/log/Xorg20.log - why not Xorg1.log???) says:

(EE) Failed to load module "joystick" (out of memory, 701)

.. so it looks like my driver load failed. Why would that be and how to fix??????

Cheers


Bob
 
Old 05-30-2006, 05:24 PM   #5
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 58
I stole this from a thread on gentoo forums. Looks like you don't want to set it up in xorg.conf. I would check your kernel, that could explain the memory error;
FROM: mike4148
Quote:
If it plugs into a USB port, it will probably work out of the box if you have the right modules compiled into your kernel.

If it plugs in to a gameport or serial port, try the following (all kernel options are in the Input Devices section of the kernel config):

1. Build joystick support into your kernel or as a module.

2. Build the relevant gameport driver into your kernel or as a module. For example, if you have the joystick plugged into an SB Live!'s game port, say 'Y' to "Gameport support" and "SB Live! and Audigy gameport support."

3. Build all non-USB joystick drivers as modules. Note the names of all the modules (they show up in the help screen in the graphical kernel configs).

Build and install the new kernel, and boot into it. Try loading each module with modprobe, one at a time. For each, see if you have /dev/js0 and/or /dev/input/js0. If you do, see if it works (you'll probably need to calibrate it first; search the forum system for info on that). If it does, you're done. If not, rmmod the last driver and modprobe the next on the list.

If none work, then it's likely that there is no driver for your joystick. Search the net to see if anyone has developed one.

Last edited by comprookie2000; 05-30-2006 at 05:26 PM.
 
Old 05-31-2006, 03:49 AM   #6
bhepple
LQ Newbie
 
Registered: Mar 2004
Location: Brisbane, Queensland, Australia
Distribution: fedora
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by comprookie2000
I stole this from a thread on gentoo forums. Looks like you don't want to set it up in xorg.conf. I would check your kernel, that could explain the memory error;
FROM: mike4148
.... hmmmm. This looks like a method for non-USB or at least to get the /dev/input/js0 file set up.
I already have a working /dev/input/js0 - it's failing because it won't load as a X module... as in
/usr/lib/xorg/modules/input/joystick_drv.so gives an error message when X tried to load it

Just to cover all the bases I checked my kernel build and I have:
CONFIG_INPUT_JOYSTICK=y
CONFIG_JOYSTICK_ADI=m

... and I tried "modprobe adi" but it makes no difference (my joystick is a Logitech)... but then I didn't really expect it to make a difference.
 
Old 05-31-2006, 06:52 PM   #7
bhepple
LQ Newbie
 
Registered: Mar 2004
Location: Brisbane, Queensland, Australia
Distribution: fedora
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bhepple
... but the log (/var/log/Xorg20.log - why not Xorg1.log???) says:

(EE) Failed to load module "joystick" (out of memory, 701)

.. so it looks like my driver load failed. Why would that be and how to fix??????
OK - I made _some_ progress and reported this to xorg's bugzilla:

I fixed the obvious bug in src/xf86Jstk.c:
Code:
static pointer
xf86JstkPlug(pointer	module,
	     pointer	options,
	     int	*errmaj,
	     int	*errmin )
{
    LocalDevicePtr	local = NULL;
    JoystickDevPtr	priv = NULL;
    char		*s;

    local = xf86JstkAllocate();

    if (!local || !priv) {
	*errmaj = LDR_NOMEM;
	goto SetupProc_fail;
    }

to:
    if (!local || !local->private) {
    ... }
but I now get:

Quote:
(II) LoadModule: "joystick"
(II) Loading /usr/lib/xorg/modules/input/joystick_drv.so
(II) Module joystick: vendor="X.Org Foundation"
compiled for 7.0.0, module version = 1.0.0
Module class: X.Org XInput Driver
ABI class: X.Org XInput driver, version 0.5
(EE) WACOM: No Device specified.
(II) UnloadModule: "joystick"
(II) Unloading /usr/lib/xorg/modules/input/joystick_drv.so
(EE) Failed to load module "joystick" (invalid argument(s) to LoadModule(), 701)
... but my xorg.conf file says:

Quote:
Section "InputDevice"
Identifier "Joystick"
Driver "joystick"
Option "Device" "/dev/input/js0"
EndSection
I am on gentoo using virtual/x11-7.0-r2 and the joystick source contains this tag:

/* $XFree86: xc/programs/Xserver/hw/xfree86/input/joystick/xf86Jstk.c,v 1.5
2001/11/26 16:25:53 dawes Exp $ */
 
Old 06-01-2006, 07:54 PM   #8
bhepple
LQ Newbie
 
Registered: Mar 2004
Location: Brisbane, Queensland, Australia
Distribution: fedora
Posts: 19

Original Poster
Rep: Reputation: 0
Solved

Quote:
Originally Posted by bhepple
OK - I made _some_ progress and reported this to xorg's bugzilla:

I fixed the obvious bug in src/xf86Jstk.c:
...
Looks like no-one in their right mind uses the xorg joystick driver. It is so hopelessly broken that it's unusable.

A better approach turns out to be to use some user-space daemons to convert the joystick input stream into mouse-like commands and pump them into X.
These worked for me:

qjoypad
joymouse

Now that I've been able to see the joystick in action it seems it's pretty impractical to use it in place of the mouse - it's just not responsive enough and you have no fine control. I guess the joystick is a gaming device and only useful for thrashing back and forth. Well it was a nice idea!!


Cheers


Bob
 
Old 07-07-2006, 06:34 AM   #9
marcprice
LQ Newbie
 
Registered: Jul 2006
Posts: 1

Rep: Reputation: 0
Not so useless though

Hi There,

I just wanted to say thank you! You are right, using the joystick as an X pointer is clunky (although, I think configuring the buttons will make it somewhat more usable), but, it is still very useful. I have been looking into accessibility for people who have little or no use of one or more limbs. I have found that the most interactive/usable/cost-effective off-the-shelf interface devices for these people are various devices which have been designed to plug into the controller port of the Sony Playstation2. Using a PS2->PC converter, coupled with X configured for joystick input means that these devices can be used in place of mouse and keyboard to a certain extent.

So, thank you for your help, I can now proceed with my work. :-)

Marc
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Useing Joystick/gamepad as mouse pointer zarathustra674 Linux - Hardware 6 09-15-2011 02:13 PM
Linux using Joystick as 'Mouse Pointer'? Thymox Linux - General 5 10-06-2006 05:14 PM
Compiling X11 6.9.0 Without Joystick liquidrabbit Linux - Software 1 05-13-2006 04:21 PM
Joystick Driver and API under kernel 2.6.12.3 using an USB joystick dispatcher Linux - Newbie 1 08-06-2005 09:43 AM
no mouse pointer on 2nd screen runaway Linux - Laptop and Netbook 2 10-23-2004 04:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration