Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: My linux support for GPWIZ49  (Read 5069 times)

0 Members and 1 Guest are viewing this topic.

beernut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 49
  • Last login:December 10, 2023, 07:13:46 pm
My linux support for GPWIZ49
« on: August 31, 2007, 12:15:56 pm »
Hi all,

Got tired of waiting so I banged out a set of programs for Linux support of the GPWIZ49 controllers. Also, if I get my hands on a U360 it should be trivial to extend support to that as well.
If you want to send me one to speed up the development that would be fine  ;D

Thanks to Randy for a cool product and a simple protocol.  Usbsnoop made it really easy to capture the command stream.

I based my support heavily on the ideas of SirPoonga's set49mode (although I didn't see a single line of his code since I knew it wouldn't work on Linux) and have stolen a couple of his ini files for my own usage.

The package requires Device::USB and libusb and probably  libusb-dev to work.

Get them however is best for your distribution.

The package contains several files

parse_controls.pl This program creates the needed ini file for the
                  set49mode program.  It requires mame_modes.ini,
                  clones.ini, overrides.ini and controls.ini.
                  (Read the file for more info).

gpwiz49.pm        The Perl package which does all the work of talking
                  to the GPWIZ49.
                  (Thanks Randy for the very simple protocol).

set49mode.pl      The program that you would have your frontend call
                  to set the mode. It is called like this:
                  set49mode romname inifile jstype

clones.ini        My current clones.ini file for 0.118u3 but you should
                  probably create your own using
                  mame -listclones > clones.ini

override.ini      An example override.ini file that should be customized.
                  The file must exist even if there are not overrides.

mame_modes.ini    The map file from mame modes to GPWIZ49 DRS Modes
              .   Probably shouldn't mess with this one.

To install copy gpwiz49.pm into your perl libraries. 

Then copy the ini files into your standard mame dat file directory.

Then put set49mode into your file path (perhaps /usr/share/games or /usr/local/bin) and change it's ownership to root and make it suid root.

sudo chown root set49way.pl

sudo chmod u+s set49way.pl

First order of business is to run: parse_controls.pl ini_file_directory > 49waymodes.ini

Copy this new file into your dat file directory and your are all set to run set49mode.

Currently I have only done preliminary testing since I wanted to make sure I could get this to work before finalizing on my control panel layout.  I have only tested this with two GPWIZ49s and am not at all certain about the product_id of a fourth GPWIZ49 (I am guessing that it is 0x000a but I have no idea) perhaps randy or a GPWIZ-4 owner could help out here.

Enjoy,
Mark
« Last Edit: August 31, 2007, 12:17:32 pm by beernut »

Major Rock Hardy

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:April 29, 2013, 06:51:45 pm
  • xybots rocks!
Re: My linux support for GPWIZ49
« Reply #1 on: August 31, 2007, 07:05:02 pm »
 :notworthy:

after all the f'ing around in the linux kernel I did (generating much  :banghead:), you go and write a perl script!  I didn't think that would work because the kernel has control over the HID device!  Very nice, and with the benefit of being in user space!  I will have to test it very soon.

Good work!

MRH

(sorry you got tired of waiting)

beernut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 49
  • Last login:December 10, 2023, 07:13:46 pm
Re: My linux support for GPWIZ49
« Reply #2 on: August 31, 2007, 07:24:12 pm »
I didn't think that would work because the kernel has control over the HID device!  Very nice, and with the benefit of being in user space! 

The main trick was figuring out to release the kernel module and then reload it after communicating with the GPWIZ49s.  That and finding the usbsnoop program and the Device::USB::MissleLauncher module for guidance.

Quote
I will have to test it very soon.

Good work!

MRH

(sorry you got tired of waiting)

Thanks for the positive input.  I hope I haven't stepped on any toes.

Please test it since I have only screwed around with it on my one system (and still havent played any games or really hooked up the joysticks other than to make sure that they changed modes.  I mostly needed to make sure that I could build my CP without any rotary switches or extra graphics explaining how to change modes.

No worries about the waiting.  I was mostly being a smartass.   :angel:

Mark Alston

Major Rock Hardy

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:April 29, 2013, 06:51:45 pm
  • xybots rocks!
Re: My linux support for GPWIZ49
« Reply #3 on: August 31, 2007, 07:59:26 pm »
The main trick was figuring out to release the kernel module and then reload it after communicating with the GPWIZ49s.  That and finding the usbsnoop program and the Device::USB::MissleLauncher module for guidance.
slick idea!
Quote

Thanks for the positive input.  I hope I haven't stepped on any toes.


No toe-stepping at all!  I recently embarked upon a fresh kernel install w/ the latest advancmame build (http://forum.arcadecontrols.com/index.php?topic=70303.0), and decided to get real about the driver development using CVS.  You saved me a lot of work!

Quote
No worries about the waiting.  I was mostly being a smartass.   :angel:

Sorry you waited around for so long... I actually was laid off of my tech job about a year ago, sold my house, cars, etc. and changed my life so to speak... so that put a freeze on GPwiz49 for linux development.  Props to you for taking the reins.

I'm curious, did you patch the kernel for the analog ranges, etc. as mentioned in this thread:
http://forum.arcadecontrols.com/index.php?topic=46747.0 ?

(in other words, I hope I helped some).

MRH