Subject: pkg/29900: vice does not recognize firebutton of Competition Pro USB
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <zza@serpens.de>
List: pkgsrc-bugs
Date: 04/06/2005 07:39:00
	Note: There was a bad value `' for the field `Priority'.
	It was set to the default value of `medium'.

	Note: There was a bad value `' for the field `Severity'.
	It was set to the default value of `serious'.

>Number:         29900
>Category:       pkg
>Synopsis:       pkgsrc/emulators/vice/ does not recognize firebutton of Competition Pro USB joystick
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 06 07:39:00 +0000 2005
>Originator:     Bernhard Moellemann
>Release:        NetBSD 3.0_BETA and NetBSD 2.0
>Organization:
Home
	
>Environment:
	
	
System: NetBSD arcanic 3.0_BETA NetBSD 3.0_BETA (ARCANIC) #0: Fri Apr 1 11:04:53 CEST 2005 root@arcanic:/mnt/root/usr/src/sys/arch/i386/compile/ARCANIC i386
Architecture: i386
Machine: i386
>Description:
	

The C64 Emulator pkgsrc/emulators/vice does not recognize the firebuttons
of the (since january available) Competition Pro USB joystick. This happens
because hid_get_item(3) reports 255 as hid_item.logical_maximum and vice
expects at least 1/3 of the logical_maximum to be reached to emulate a
digital joystick but the joystick gives only 1 if the button is pressed.

I do not know, if the joystick reports broken numbers or if hid_get_item(3)/
hid_get_data(3) reports faulty values or vice is overoptimistic in its
assumptions about buttons. So I report this here, hoping somebody can
figure out what exactly is broken.

The same happens with NetBSD 2.0.

>How-To-Repeat:
	
Compile Vice out of the pkgsrc, plug in an Competition Pro USB joystick,
select USB Joystick in Vice and start any game which uses the joystick:
The axis work fine, but none of the four firebuttons works.
>Fix:
	
With this patch applied the Competition Pro USB works. But I do not now
if this breaks other joysticks/input devices, because I own only this
one joystick. So testing is recommended before committing it.

--- src/arch/unix/joy_usb.c.orig	2004-08-07 21:33:32.000000000 +0200
+++ src/arch/unix/joy_usb.c	2005-04-01 12:37:26.000000000 +0200
@@ -109,7 +109,7 @@
 	it->min_or = 0;
 	it->min_val = -1;
 	it->max_or = orval;
-	it->max_val = hi->logical_maximum-1;
+	it->max_val = 0; /* hi->logical_maximum-1; */
 	break;
 
     case ITEM_HAT:

Reminder: Test it with other joysticks 8-)

>Unformatted: