Coder Social home page Coder Social logo

guncon2's Introduction

GunCon 2 USB Lightgun Driver

Linux driver for the GunCon 2 light gun.

The device reports absolute ABS_X and ABS_Y positions, the trigger button is reported as BTN_LEFT. The ABS_X and ABS_Y position reported by the device are raw values from the GunCon 2.

Calibration

The GunCon 2 will need to be calibrated for your display.

The min and max values for ABS_X and ABS_Y can be changed by updating the calibration information using evdev-joystick.

For example calibrate the X and Y axis:

# X axis
evdev-joystick --e /dev/input/by-id/usb-0b9a_016a-event-joystick -m 175 -M 720 -a 0
# Y axis
evdev-joystick --e /dev/input/by-id/usb-0b9a_016a-event-joystick -m 20 -M 240 -a 1

I have also included a simple script for calibrating the GunCon 2, however the calibration must be perform each time the GunCon 2 is connected. This can be done with a set of udev rules.

For example;

SUBSYSTEM=="input", ATTRS{idVendor}=="0b9a", ATTRS{idProduct}=="016a", ACTION=="add", RUN+="/bin/bash -c 'evdev-joystick --e %E{DEVNAME} -m 175 -M 720 -a 0; evdev-joystick --e %E{DEVNAME} -m 20 -M 240 -a 1'"

Build and install

make modules
sudo make modules_install
sudo depmod -a
sudo modprobe guncon2

To reload after compiling you will first need to unload it using sudo modprobe -r guncon2.

guncon2's People

Contributors

beardypig avatar rtomasa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

guncon2's Issues

Only one Guncon working when 2 are connected, and neither listed by evdev-joystick --listdevs

Hi! Thank you for this module! I was successfully able to compile and modprobe it in order to use my Guncon 2 as an input device when playing Point Blank under Retropie when connected to a CRT display, which I thought was incredible!

However, I'm having two problems using this driver for an actual multiplayer game -- one is that Retropie seems to only map a single Guncon for both players no matter what I do, and I think this is tied to problem 2: my Guncons aren't being listed as joysticks by either evdev or by Retropie, so I can't configure or calibrate them very effectively, and I don't actually know how Retropie is accessing them otherwise.

I think they might be being recognized as mice, currently?

pi@retropie:/dev/input/by-path $ ls
platform-3f980000.usb-usb-0:1.1.2:1.0-event-mouse     platform-3f980000.usb-usb-0:1.1.3:1.0-joystick
platform-3f980000.usb-usb-0:1.1.2:1.0-mouse           platform-3f980000.usb-usb-0:1.3:1.0-event-mouse
platform-3f980000.usb-usb-0:1.1.3:1.0-event-joystick  platform-3f980000.usb-usb-0:1.3:1.0-mouse

Help would be appreciated!

nice work - need some direction :)

hi - I'm running groovyarcade through a New Astro City and recently added a Ps2 Guncon2 into the mix.

I installed your drivers - and I'm pretty sure that side of things is 100%. The gun fires and buttons work on it in game. However the mouse/crosshair is erratic all over the screen. I ran the calibration - however it didn't work, I don't see usb-0b9a_016a-event-joystick but I do see usb-0b9a_016a-event-mouse. Even with that change, still no change to the guns behaviour.

finally - I do not have the sync cable attached, I was unsure from the guide - is this required in this setup ? I'm running VGA > extron > RGB BNC > Dsub15 arcade monitor. So I would assume if required - I would put a T connection into the BNCs and join in from there.

[Contribution] Add more guns

Hi, I have a gun that works well in pc, but I want to use your drivers in rpi. I think it works equal as guncon2, but because of vendor and product ids, it is not being detected by your drivers.

I will try to compile changing these values, but, how do you think about using a config file to set these values? Or using an array of vendor-poduct ids tuplas?

I'm not used to C language, but I think adding my devices ids to guncon2_table should work, isn't it?

Something like that:

static const struct usb_device_id guncon2_table[] = {
        {USB_DEVICE(NAMCO_VENDOR_ID, GUNCON2_PRODUCT_ID)},
        {USB_DEVICE(MY_VENDOR_ID, MY_PRODUCT_ID)},
        {}};

Cheers

Progress

Have you had any more thoughts on this? I'm still available for testing :)

Mouse calibration

As of now the calibration only supports the gun in Joystick mode.
Request for mouse calibration

[Feature Request] Is 31khz support possible?

It would be nice to be able to use this driver with a 31khz VGA connection on a CRT monitor, especially for dreamcast lightgun games or 31khz arcade games. I'm aware I'd have to make a VGA sync combiner breakout to make this work with a PC CRT monitor. With that in mind, is 31khz support possible, or planned?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.