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: Devs: Cross Platform Open Source Ultrastik Library  (Read 5320 times)

0 Members and 1 Guest are viewing this topic.

2600

  • Trade Count: (+7)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1630
  • Last login:June 05, 2017, 10:20:56 am
  • I want my own arcade controls!
Devs: Cross Platform Open Source Ultrastik Library
« on: February 28, 2007, 09:44:00 am »
I meant to release this earlier, but got busy.  I'm still pretty busy, but wanted to get the release out
so other people can take a look at it.  It could use some testing under other platforms.

Purpose:
The purpose of this software is so that users and developers of all platforms can use the Ultrastik.
This is merely a sample and hopefully someone will use the source.


*************************************************************************

There are 3 packages included all dual licensed under the GPL and LPGL:

ICSharpCode.USBlib - A .Net Wrapper for libusb.
Note: I have made changes to the source from the official ICSharpCode.USBlib.

Ultimarc.Ultrastik - A .Net Class for the Ultimarc Ultrastik 360

setControls - A Sample program that has the Ultimarc.Ultrastik Class built in.

*************************************************************************

Requirements:
.NET 2.0
libusb
See the readme for more info including usage.

The Ultimarc.Ultrastik Class is documented fairly well including the USB protocol and should be easy to port to other languages.


Comments (including coding comments) and bugs are welcome.  Please post them in this thread.

bleargh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 359
  • Last login:Yesterday at 10:44:06 pm
  • ribbit...
Re: Devs: Cross Platform Open Source Ultrastik Library
« Reply #1 on: March 15, 2007, 02:12:10 pm »
Wow, just what I was looking for.  :D

Am building up a MAME cabinet here around a Linux box, and haven't been able to decide between a pair of 49-way sticks or a pair of UltraStiks.  I'd e-mailed RandyT about Linux support for the GP-Wiz49 and he's indicated that a few users had problems getting it working properly, so I'm glad to see this support library for the UltraStik.

I'm, uh, presuming that you've actually tried your build on Linux, right?  ;)

2600

  • Trade Count: (+7)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1630
  • Last login:June 05, 2017, 10:20:56 am
  • I want my own arcade controls!
Re: Devs: Cross Platform Open Source Ultrastik Library
« Reply #2 on: March 15, 2007, 04:09:36 pm »
At one time I did, but can't recall if I did with the last build.  You should be able to run "setControls debug" and it will print some USB stuff out even if you don't have an Ultrastik.  If it gets that far, you are halfway there.

One thing I didn't test, is the actual Joystick functionality under Linux.  I was only looking to see if everything was mapping ok.  The good thing is that if there is a problem, the firmware is upgradeable.


I'm interested in any feedback if anyone gets a chance.  SDLMAME is getting to be pretty popular, so hopefully some will find this useful.  I also tried to test it briefly under OSX, but couldn't get my permissions correct.



Neverending Project

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 851
  • Last login:April 06, 2015, 10:07:43 pm
    • Arcade Fixer
Re: Devs: Cross Platform Open Source Ultrastik Library
« Reply #3 on: February 24, 2008, 12:32:04 am »
I thought I would dust off this thread, and see if anyone can help me get this class compiled and working with Mac OS X. I am not entirely sure where to start, so here is what I have tried:

I downloaded and installed the Mono framework (1.2.6.6). Not knowing what to try next, I tried moving the ICSharpCode.USBlib.dll from the Linux folder to the setControls folder. Then I tried "mono setControls.exe". It replied that it could not open the assembly setControl.exe. Assuming that something would need to be recompiled using Mono, I (unsuccessfully) tried to compile the .cs files in various folders (trying to get my feet wet here, you know?). Anyway, nothing would compile using "gmcs filename.cs", citing various parse errors.

So I apologize in advance, as I am neither a programmer, nor a Unix guru. But I know enough to fake my way around.I would love to get this simple setControl.exe command-line utility working. Anyone around that can help out?

bleargh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 359
  • Last login:Yesterday at 10:44:06 pm
  • ribbit...
Re: Devs: Cross Platform Open Source Ultrastik Library
« Reply #4 on: February 24, 2008, 12:51:48 am »
Not sure I can be much help with the Csharp stuff here, but I can tell you that I'm in the middle of doing up a set of Perl modules/scripts that do the same thing.  I'm (finally) getting my cabinet wrapped up and have to get my u360s working properly on my Linux box.

And, although I am a programmer, I'm not a Csharp/Mono guy, so although the code makes sense for me to read I'm totally at a loss for recompiling it.

Funny you should write too... I just started working on this earlier this afternoon...

2600

  • Trade Count: (+7)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1630
  • Last login:June 05, 2017, 10:20:56 am
  • I want my own arcade controls!
Re: Devs: Cross Platform Open Source Ultrastik Library
« Reply #5 on: February 24, 2008, 07:05:24 am »
1. You shouldn't need to recompile it.
B. You are correct in moving the dll over
D. You have a permissions issue.  There will be two of them. 1 with mono and 1 with accessing the USB bus.
Linux was pretty easy to fix, but I had to look up how to do it in OSX.  Haven't touched it in a while.

I imagine if you ran "su mono setcontrols.exe" it would spit out something.

Neverending Project

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 851
  • Last login:April 06, 2015, 10:07:43 pm
    • Arcade Fixer
Re: Devs: Cross Platform Open Source Ultrastik Library
« Reply #6 on: February 24, 2008, 11:17:50 pm »
1. You shouldn't need to recompile it.
B. You are correct in moving the dll over
D. You have a permissions issue.  There will be two of them. 1 with mono and 1 with accessing the USB bus.
Linux was pretty easy to fix, but I had to look up how to do it in OSX.  Haven't touched it in a while.

I imagine if you ran "su mono setcontrols.exe" it would spit out something.

Here are my results:

Running "sudo mono setControls.exe" does run, indicating that it works so far...
Code: [Select]
$ sudo mono setControls.exe
Password:
Enter a Programming Mode

Running "sudo mono setControl.exe debug" it hangs until I terminate it. This does look like a permission problem with accessing the USB port.
Code: [Select]
$ sudo mono setControls.exe debug
Running on UNIX

^C

Trying to load a hard-coded map with "sudo mono setControl.exe joy4way" I get the following...
Code: [Select]
$ sudo mono setControls.exe joy4way

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at (wrapper unknown) ICSharpCode.USBlib.Internal.usb_device:PtrToStructure (intptr,object)
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:PtrToStructure (intptr,System.Type)
  at ICSharpCode.USBlib.Internal.usb_bus.get_Devices () [0x00000]
  at ICSharpCode.USBlib.Bus..ctor (ICSharpCode.USBlib.Internal.usb_bus nativeBus) [0x00000]
  at ICSharpCode.USBlib.Bus.get_Busses () [0x00000]
  at Ultimarc.Ultrastik.Open () [0x00000]
  at setControls.Program.Main (System.String[] args) [0x00000]

So do you have more information in what permissions issue you had to correct to get it to work in Linux? Maybe it would point me in the right direction.

2600

  • Trade Count: (+7)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1630
  • Last login:June 05, 2017, 10:20:56 am
  • I want my own arcade controls!
Re: Devs: Cross Platform Open Source Ultrastik Library
« Reply #7 on: February 25, 2008, 08:34:10 am »
For linux 2.6, I believe I had to modify/create a rules file for /etc/udev.

For linux 2.4, you have to set the permissions for hotplug.

Google libusb linux udev permissions for examples.

bleargh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 359
  • Last login:Yesterday at 10:44:06 pm
  • ribbit...
Re: Devs: Cross Platform Open Source Ultrastik Library
« Reply #8 on: February 25, 2008, 02:49:34 pm »
1. You shouldn't need to recompile it.
B. You are correct in moving the dll over
D. You have a permissions issue.  There will be two of them. 1 with mono and 1 with accessing the USB bus.
Linux was pretty easy to fix, but I had to look up how to do it in OSX.  Haven't touched it in a while.

I imagine if you ran "su mono setcontrols.exe" it would spit out something.

Gee... that explains why I didn't get it working...

I saw ".exe" and immediately assumed that it was a Windows executable and that I'd need to recompile it in order to get it working on my Linux box...

2600

  • Trade Count: (+7)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1630
  • Last login:June 05, 2017, 10:20:56 am
  • I want my own arcade controls!
Re: Devs: Cross Platform Open Source Ultrastik Library
« Reply #9 on: February 25, 2008, 03:24:46 pm »
.Net doesn't work like that.  .Net is more like Java in that respect.  Obviously, you can do OS specific calls that break compatibility, but you don't have to.