beardypig / guncon2

Linux driver for the Guncon 2 light gun
GNU General Public License v2.0
23 stars 9 forks source link

[Contribution] Add more guns #5

Open sanguino opened 2 years ago

sanguino commented 2 years ago

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

rtomasa commented 2 years ago

If the Prod/Vendor Ids are not the same is because in not a GCon2 compatible gun, so even if you add the proper Ids to the struct, the information expected by the driver (button bytes) won't match.

sanguino commented 2 years ago

I can use it in my pc, as a joystick, the buttons works fine, but I don't know how the position is sent/read.

So, if i want to do it, I should debug it and change that bytes? Is there a way to debug the data sent by the gun?

I will try to investigate more about this.

Thanks!

beardypig commented 2 years ago

If it works as a joystick on linux, it should just work as a gun input without any driver. For example, with a suitable adapter the Xbox Light gun will work in retroarch with the standard xbox controller kernel module.