gamepad has incorrect code.

Bug #929694 reported by sean
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Looking at the current code for unbuntu, its as though the author was not aware gamepads can have up to 32 buttons. I have a game pad that need 24 buttons and anything over 18 spills in to tablet code.

I'd suggest the following change in linux-source-3.0.0/drivers/hid/hid-input.c

                code = ((usage->hid - 1) & HID_USAGE);
                switch (field->application) {
                case HID_GD_MOUSE:
                case HID_GD_POINTER: code += BTN_MOUSE; break;
                case HID_GD_JOYSTICK:
                                if (code <= 0xf)
                                        code += BTN_JOYSTICK;
                                else
                                        code += BTN_TRIGGER_HAPPY;
                                break;
                case HID_GD_GAMEPAD:
                                if (code <= 0xf)
                                        code += BTN_GAMEPAD;
                                else
                                        code += BTN_TRIGGER_HAPPY;
                                break;
                default:

Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 929694

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
sean (ulaoulao) wrote :

I ran the command from a terminal and it launches a browser window to get authorization. Then apologies and says the page you came from was a little old... I seem to get this message no matter what I try.

Changed in linux (Ubuntu):
status: Incomplete → New
Revision history for this message
Brad Figg (brad-figg) wrote :

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 929694

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Ingo Ruhnke (grumbel) wrote : apport information

AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24.
ApportVersion: 1.23-0ubuntu4
Architecture: i386
CRDA: Error: [Errno 2] No such file or directory
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xfdff8000 irq 42'
   Mixer name : 'Realtek ALC888'
   Components : 'HDA:10ec0888,14627324,00100001'
   Controls : 36
   Simple ctrls : 20
Card1.Amixer.info:
 Card hw:1 'Generic'/'HD-Audio Generic at 0xfdcfc000 irq 43'
   Mixer name : 'ATI R6xx HDMI'
   Components : 'HDA:1002aa01,00aa0100,00100200'
   Controls : 4
   Simple ctrls : 1
Card1.Amixer.values:
 Simple mixer control 'IEC958',0
   Capabilities: pswitch pswitch-joined penum
   Playback channels: Mono
   Mono: Playback [on]
Card2.Amixer.info:
 Card hw:2 'U0x46d0x805'/'USB Device 0x46d:0x805 at usb-0000:02:00.2-4, high speed'
   Mixer name : 'USB Mixer'
   Components : 'USB046d:0805'
   Controls : 2
   Simple ctrls : 1
Card2.Amixer.values:
 Simple mixer control 'Mic',0
   Capabilities: cvolume cvolume-joined cswitch cswitch-joined penum
   Capture channels: Mono
   Limits: Capture 0 - 6144
   Mono: Capture 5217 [85%] [26.37dB] [on]
DistroRelease: Ubuntu 11.10
HibernationDevice: RESUME=UUID=33aaf7bc-0c80-4a2d-87e1-b7be51888be1
InstallationMedia: Xubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111012)
IwConfig:
 lo no wireless extensions.

 eth0 no wireless extensions.

 teredo no wireless extensions.
MachineType: MEDIONPC MS-7324
NonfreeKernelModules: fglrx
Package: linux (not installed)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.0.0-15-generic root=UUID=40cb917f-d02b-4091-8691-6ac7d8f0a99c ro
ProcVersionSignature: Ubuntu 3.0.0-15.26-generic 3.0.13
RelatedPackageVersions:
 linux-restricted-modules-3.0.0-15-generic N/A
 linux-backports-modules-3.0.0-15-generic N/A
 linux-firmware 1.60
RfKill:
 0: hci0: Bluetooth
  Soft blocked: no
  Hard blocked: no
Tags: oneiric
Uname: Linux 3.0.0-15-generic i686
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm admin cdrom dialout lpadmin plugdev root sambashare sudo
dmi.bios.date: 01/05/2007
dmi.bios.vendor: Phoenix Technologies, LTD
dmi.bios.version: W7324MLN 2.0I
dmi.board.name: MS-7324
dmi.board.vendor: MICRO-STAR INTERNATIONAL CO., LTD
dmi.board.version: REV:1
dmi.chassis.type: 3
dmi.chassis.vendor: MEDIONPC
dmi.modalias: dmi:bvnPhoenixTechnologies,LTD:bvrW7324MLN2.0I:bd01/05/2007:svnMEDIONPC:pnMS-7324:pvr:rvnMICRO-STARINTERNATIONALCO.,LTD:rnMS-7324:rvrREV1:cvnMEDIONPC:ct3:cvr:
dmi.product.name: MS-7324
dmi.sys.vendor: MEDIONPC

tags: added: apport-collected oneiric
Revision history for this message
Ingo Ruhnke (grumbel) wrote : AcpiTables.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : AlsaDevices.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : AplayDevices.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : ArecordDevices.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : AudioDevicesInUse.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : BootDmesg.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : Card0.Amixer.values.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : Card0.Codecs.codec.0.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : Card1.Codecs.codec.0.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : Lspci.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : Lsusb.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : PciMultimedia.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : ProcModules.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : PulseSinks.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : PulseSources.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : UdevDb.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : UdevLog.txt

apport information

Revision history for this message
Ingo Ruhnke (grumbel) wrote : WifiSyslog.txt

apport information

Revision history for this message
sean (ulaoulao) wrote :

So do I need to do anything further?

Revision history for this message
Ingo Ruhnke (grumbel) wrote :

Attached are above code changes as patch.

A more detailed summary of the problem:

USB gamepads will get assigned event ids starting from BTN_GAMEPAD (/usr/include/linux/input.h) and then increment with each button. If the gamepad has 16 buttons or more, it will reach the button id BTN_DIGI and beyond. The problem is that BTN_DIGI is reserved for tablet use and used by the joydev module (linux-source-3.0.0/drivers/input/joydev.c) to determine what devices are not joysticks/gamepads. Thus a gamepad with more then 16 buttons will not be detected as joystick by the joydev module and not get an /dev/input/js0.

This problem is a side-effect of an earlier bug fix that was needed so graphic tablets don't show up as joysticks:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/300143

PS: The above logs are useless, but were requested by the auto-reply.

Ingo Ruhnke (grumbel)
Changed in linux (Ubuntu):
status: Incomplete → Confirmed
tags: added: patch
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

Hi Ingo,

Have you submitted your patch to the upstream kernel as of yet?

People affected by this bug are probably wondering why the kernel team doesn't just apply the patch and fix it. The reason is that the kernel team is reluctant (not opposed) to apply any patch to a stable kernel that is not from upstream. Applying patches that don't come from upstream add greatly to the support of the kernel as other upstream patches may touch the same area as the non-upstream patch and may prevent them from applying cleanly.

Changed in linux (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Ingo Ruhnke (grumbel) wrote :

No, I haven't yet submitted anything to upstream. Have to read up on how to do that properly first. If anybody else wants to do it, go ahead, it might take me a while to do it. I simply provided the patch for convenience, as the orignial submission was just a text snipped.

Revision history for this message
Herton R. Krzesinski (herton) wrote :

Hi Ingo,

to submit your patch, send you patch with the detailed description/changelog and your Signoff (ending with Signed-off-by: your name <email>), to the emails listed from ./scripts/get_maintainer.pl drivers/hid/hid-input.c (the get_maintainer.pl is from the kernel sources). Once you have sent the patch upstream and it's accepted, please drop a note here so that we can cherry-pick/include the patch into Ubuntu kernel, thank you.

Brad Figg (brad-figg)
tags: added: kt-worked
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.