Date: Mon, 5 May 2003 23:15:19 -0800 From: "Alex Teslik" <alex@acatysmoof.com> To: Mathew Kanner <mat@cnd.mcgill.ca> Cc: Alex Teslik <alex@acatysmoof.com> Subject: Re: Logitech Wingman Attack joystick Message-ID: <20030506065739.M40036@acatysmoof.com> In-Reply-To: <20030506052408.GH31681@cnd.mcgill.ca> References: <20030505070220.M38996@acatysmoof.com> <20030505213740.GF31681@cnd.mcgill.ca> <20030506045100.M57035@acatysmoof.com> <20030506052408.GH31681@cnd.mcgill.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hello,
Mat got this working for me off-list, but I said I would post the final
results for the list. Keep in mind that I re-compiled my kernel, taking out
device pcm and device joy because I'm loading them as kernel modules. Of
course, you also want to make sure you have joy devices in your /dev which you
can do with
/dev/MAKEDEV joy*
before you load the modules.
1) Change src/sys/modules/joy/Makefile to add pci
--- Makefile.old Mon May 5 23:59:50 2003
+++ Makefile Mon May 5 21:14:18 2003
@@ -2,7 +2,7 @@
.PATH: ${.CURDIR}/../../isa
KMOD = joy
-SRCS = bus_if.h device_if.h isa_if.h joy.c
+SRCS = bus_if.h device_if.h isa_if.h pci_if.h joy.c
MAN = joy.8
afterinstall:
2) Apply the attached patch to src/sys/isa/joy.c. This patch adds pci support
to the joystick driver (if I understand it correctly). This patch is against
4.8-RELEASE joy.c. Note the attached patch is slightly different than Mat's
first patch. He changed a line off-list. All credit goes to Mat on this, none
of the work in this patch is mine.
3) rebuild the joy module.
cd src/sys/modules/joy
make
4) Move the new joy.ko into /modules
5) kldload -v joy
6) kldload -v <your_soundcard_module>
So, thats it. You should be able to configure the joystick by running
"/usr/X11R6/bin/joycal /dev/joy0"
Xmame still is not working with this joystick, but at least the joystick
works. I know it works because of the perl test line I ran:
perl -e
'open(JOY,"/dev/joy0")||die;while(1){sysread(JOY,$x,16);@j=unpack("iiii",$x);print
"@j\n";sleep(1);}'
which I grabbed from the joy(4) man page.
Thanks Mat!
HTH,
Alex
---------- Original Message -----------
From: Mathew Kanner <mat@cnd.mcgill.ca>
To: Alex Teslik <alex@acatysmoof.com>
Sent: Tue, 6 May 2003 01:24:08 -0400
Subject: Re: Logitech Wingman Attack joystick
> On May 06, Alex Teslik wrote:
> > ...
> Another thought. The new joy module has to be loaded *before*
> the sound driver.
>
> --Mat
>
> --
> Brain: Are you pondering what I'm pondering?
> Pinky: Uh... yeah, Brain, but where will we get rubber pants our size?
------- End of Original Message -------
[-- Attachment #2 --]
--- joy.c.old Mon May 5 21:16:15 2003
+++ joy.c Mon May 5 23:34:11 2003
@@ -44,6 +44,9 @@
#include <isa/isavar.h>
#include "isa_if.h"
+#include <pci/pcireg.h>
+#include <pci/pcivar.h>
+#include "pci_if.h"
/* The game port can manage 4 buttons and 4 variable resistors (usually 2
* joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201.
* Getting the state of the buttons is done by reading the game port:
@@ -70,7 +73,7 @@
#define JOY_SOFTC(unit) (struct joy_softc *) \
devclass_get_softc(joy_devclass,(unit))
-static int joy_probe (device_t);
+static int joy_isa_probe (device_t);
static int joy_attach (device_t);
#define CDEV_MAJOR 51
@@ -111,7 +114,7 @@
};
static int
-joy_probe (device_t dev)
+joy_isa_probe (device_t dev)
{
if (ISA_PNP_PROBE(device_get_parent(dev), dev, joy_ids) == ENXIO)
return ENXIO;
@@ -130,7 +133,7 @@
joy_attach (device_t dev)
{
int unit = device_get_unit(dev);
- int rid = 0;
+ int rid = PCIR_MAPS;
struct resource *res;
struct joy_softc *joy = device_get_softc(dev);
@@ -144,19 +147,52 @@
return 0;
}
-static device_method_t joy_methods[] = {
- DEVMETHOD(device_probe, joy_probe),
+static device_method_t joy_isa_methods[] = {
+ DEVMETHOD(device_probe, joy_isa_probe),
DEVMETHOD(device_attach, joy_attach),
{ 0, 0 }
};
static driver_t joy_isa_driver = {
"joy",
- joy_methods,
+ joy_isa_methods,
sizeof (struct joy_softc)
};
DRIVER_MODULE(joy, isa, joy_isa_driver, joy_devclass, 0, 0);
+
+static int
+joy_pci_probe(device_t dev)
+{
+ char *s = NULL;
+
+ switch (pci_get_devid(dev)) {
+ case 0x70021102:
+ s = "Creative EMU10K1 Joystick";
+ device_quiet(dev);
+ break;
+ case 0x70031102:
+ s = "Creative EMU10K2 Joystick";
+ device_quiet(dev);
+ break;
+ }
+ if (s) device_set_desc(dev, s);
+ return s ? 0 : ENXIO;
+}
+
+static device_method_t joy_pci_methods[] = {
+ DEVMETHOD(device_probe, joy_pci_probe),
+ DEVMETHOD(device_attach, joy_attach),
+ { 0, 0 }
+};
+
+static driver_t joy_pci_driver = {
+ "joy",
+ joy_pci_methods,
+ sizeof (struct joy_softc)
+};
+
+DRIVER_MODULE(joy, pci, joy_pci_driver, joy_devclass, 0, 0);
static int
joyopen(dev_t dev, int flags, int fmt, struct proc *p)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030506065739.M40036>
