I just got my ServoStik in the mail (whoo hoo!), but am having trouble integrating it with Attract Mode under Ubuntu Linux.
I can control it using RGBCommander via it's daemon:
rgbcmdcon
set,stick,4
But the joystick doesn't switch when I run MAME (v.1888) ROMs from Attract Mode.
I'm not getting any new entries in the RGBCommander log when I run ROMs either. I have this line set in rbgcmdd.xml, which I gather is supposed to make the joystick automatically switch mode:
<joystick name="SERVOSTIK" on="1" hwthrottle="0"/>
And I added this line to mame.ini: "output network".
I've also tried running "rgbcmdcon set,rom,shinobi", which, if I understand things correctly, should make the joystick switch to 8-way when the ROM Shinobi is run, but so far no luck.
Can anyone confirm that RGBCommander works with Attract Mode? And if so, any hints as to what specific setup steps are needed?
Alternatively, if there was a commandline interface to RGBCommander, I'd be all set. In other words, if I could run something like "rgbcmdcon set,stick,4" or "rgbcmd stick=4", I could easily make an Attract Mode plugin that sets the joystick mode when I launch a ROM, but there doesn't appear to be a way of controlling RGBCommander like that for some reason. I've been trying to connect to it's socket directly via Python (see below) to make my own command line interface, but so far haven't had any luck with that either.
Or ideally I'd love to control the ServoStik from Python or a simple binary directly, since this approach seems overly complicated just to essentially flip a switch. It should be doable using pyusb, but there doesn't appear to be any notes on the ServoStik's protocol anywhere, that I can find at least.
Or I could change the ServoStik controller to "hardware mode" and use an external relay, but that's a permanent change and I'd rather not do that unless I really need to.
By the way here's my attempt at some Python code to send a command to RGBCommander's daemon. It doesn't currently work though. I have a feeling I'm missing a delimiter at the end? To test, send the joystick mode [4 or 8] via commandline.
#!/usr/bin/python
import socket, sys, time
# get the joystick mode [4 or 8] from command line
mode = sys.argv[1]
HOST = 'localhost'
PORT = 2724
#s = socket.socket()
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((HOST, PORT))
cmd = "set,stick,%s" % mode
n = s.send(cmd)
s.close()