Previous Thread
Next Thread
Print Thread
Flashing Keyboard LEDs? #80877
08/13/12 05:09 PM
08/13/12 05:09 PM
Joined: Mar 2009
Posts: 47
M
mochamame Offline OP
Member
mochamame  Offline OP
Member
M
Joined: Mar 2009
Posts: 47
Just having a bit of nostalgia for Mame from a long time ago, and I remember that there was a time when the 3 standard US keyboard LEDs would react to coin-up, player start, etc.. Is there still anyway to do this in Mame? A patch perhaps?

Re: Flashing Keyboard LEDs? [Re: mochamame] #80878
08/13/12 05:15 PM
08/13/12 05:15 PM
Joined: May 2008
Posts: 4,892
Germany
Q
qmc2 Offline
Very Senior Member
qmc2  Offline
Very Senior Member
Q
Joined: May 2008
Posts: 4,892
Germany
Yes, see src/osd/sdl/ledutil.sh (UNIX / Linux) or src/osd/windows/ledutil.c (Windows).


A mind is like a parachute. It doesn't work unless it's open. [Frank Zappa]

We're searching for QMC2 translators and support for existing translations. Interested? See here!
Re: Flashing Keyboard LEDs? [Re: qmc2] #80879
08/13/12 06:40 PM
08/13/12 06:40 PM
Joined: Mar 2009
Posts: 47
M
mochamame Offline OP
Member
mochamame  Offline OP
Member
M
Joined: Mar 2009
Posts: 47
I acutally did notice that script, but what exactly do you do with it? Is it supposed to be executed prior to running mame and then automatically knows what to do with each game??

Re: Flashing Keyboard LEDs? [Re: mochamame] #80880
08/13/12 06:51 PM
08/13/12 06:51 PM
Joined: May 2008
Posts: 4,892
Germany
Q
qmc2 Offline
Very Senior Member
qmc2  Offline
Very Senior Member
Q
Joined: May 2008
Posts: 4,892
Germany
Yes, the script will create a FIFO (I guess it was /tmp/sdlmame-output or so) and "listen" on it... when MAME is started and sees this FIFO, it will open it and write "notifier output" to it, which the script will then translate into "xset" commands.

BTW, QMC2 also makes use of MAME notifiers, but this currently only works on Linux/UNIX (and Mac OS X). However, it doesn't control the keyboard LEDs.


A mind is like a parachute. It doesn't work unless it's open. [Frank Zappa]

We're searching for QMC2 translators and support for existing translations. Interested? See here!
Re: Flashing Keyboard LEDs? [Re: qmc2] #80881
08/13/12 06:55 PM
08/13/12 06:55 PM
Joined: Mar 2009
Posts: 47
M
mochamame Offline OP
Member
mochamame  Offline OP
Member
M
Joined: Mar 2009
Posts: 47
Very cool. Looks like I should have just tried that before posting. I'll check it out tonight.

Re: Flashing Keyboard LEDs? [Re: mochamame] #80886
08/14/12 07:49 AM
08/14/12 07:49 AM
Joined: Mar 2009
Posts: 47
M
mochamame Offline OP
Member
mochamame  Offline OP
Member
M
Joined: Mar 2009
Posts: 47
So I tried it and it doesn't work. Some poking around seems to indicate that my USB keyboard is the problem. I was able to get it to work by changing the xset commands to setleds like this:

Code:
if [ "$class" = "OUT" ]; then
			case "$what" in
				led0)
					[ "$state" = 1 ] && beep
					[ "$state" = 1 ] && setleds -D +num < /dev/tty7
					[ "$state" = 0 ] && setleds -D -num < /dev/tty7
					;;
				led1)
					[ "$state" = 1 ] && setleds -D +caps < /dev/tty7
					[ "$state" = 0 ] && setleds -D -caps < /dev/tty7
					;;
				led2)
					[ "$state" = 1 ] && setleds -D +scroll < /dev/tty7
					[ "$state" = 0 ] && setleds -D -scroll < /dev/tty7
					;;
				pause)
					paused=$state
					echo Pause $paused!
					;;
			esac
		fi


Bad part about this however is that you have to run it as root. Any suggestions?

Re: Flashing Keyboard LEDs? [Re: mochamame] #80887
08/14/12 08:04 AM
08/14/12 08:04 AM
Joined: May 2008
Posts: 4,892
Germany
Q
qmc2 Offline
Very Senior Member
qmc2  Offline
Very Senior Member
Q
Joined: May 2008
Posts: 4,892
Germany
Originally Posted By mochamame
Bad part about this however is that you have to run it as root. Any suggestions?

Well, that's because of the permissions to /dev/tty7 (you can change those, but it imposes a security risk in case you care smile ). xset doesn't require this.


A mind is like a parachute. It doesn't work unless it's open. [Frank Zappa]

We're searching for QMC2 translators and support for existing translations. Interested? See here!
Re: Flashing Keyboard LEDs? [Re: mochamame] #80888
08/14/12 08:17 AM
08/14/12 08:17 AM
Joined: May 2008
Posts: 4,892
Germany
Q
qmc2 Offline
Very Senior Member
qmc2  Offline
Very Senior Member
Q
Joined: May 2008
Posts: 4,892
Germany
Looks like adding your user to the group 'tty' and running "chmod g+r /dev/tty7" should actually be enough (this is how openSUSE sets the permissions at least):

Code:
rene@thunder:~/src/qmc2> ls -al /dev/tty7
crw--w---- 1 root tty 4, 7 Aug 13 23:50 /dev/tty7


A mind is like a parachute. It doesn't work unless it's open. [Frank Zappa]

We're searching for QMC2 translators and support for existing translations. Interested? See here!

Moderated by  R. Belmont 

Who's Online Now
1 registered members (Pernod), 28 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,555
Posts111,753
Members4,801
Most Online225
May 26th, 2014
Powered by UBB.threads™ PHP Forum Software 7.6.1.1
(Release build 20180111)
Page Time: 0.025s Queries: 14 (0.008s) Memory: 5.6434 MB (Peak: 5.8486 MB) Zlib enabled. Server Time: 2018-07-21 02:00:17 UTC