Previous Thread
Next Thread
Print Thread
#80877 - 08/13/12 05:09 PM Flashing Keyboard LEDs?  
Joined: Mar 2009
Posts: 47
mochamame Offline
Member
mochamame  Offline
Member

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?

#80878 - 08/13/12 05:15 PM Re: Flashing Keyboard LEDs? [Re: mochamame]  
Joined: May 2008
Posts: 4,858
qmc2 Offline
qmc2  Offline

Very Senior Member

Joined: May 2008
Posts: 4,858
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!
#80879 - 08/13/12 06:40 PM Re: Flashing Keyboard LEDs? [Re: qmc2]  
Joined: Mar 2009
Posts: 47
mochamame Offline
Member
mochamame  Offline
Member

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??

#80880 - 08/13/12 06:51 PM Re: Flashing Keyboard LEDs? [Re: mochamame]  
Joined: May 2008
Posts: 4,858
qmc2 Offline
qmc2  Offline

Very Senior Member

Joined: May 2008
Posts: 4,858
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!
#80881 - 08/13/12 06:55 PM Re: Flashing Keyboard LEDs? [Re: qmc2]  
Joined: Mar 2009
Posts: 47
mochamame Offline
Member
mochamame  Offline
Member

Joined: Mar 2009
Posts: 47
Very cool. Looks like I should have just tried that before posting. I'll check it out tonight.

#80886 - 08/14/12 07:49 AM Re: Flashing Keyboard LEDs? [Re: mochamame]  
Joined: Mar 2009
Posts: 47
mochamame Offline
Member
mochamame  Offline
Member

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?

#80887 - 08/14/12 08:04 AM Re: Flashing Keyboard LEDs? [Re: mochamame]  
Joined: May 2008
Posts: 4,858
qmc2 Offline
qmc2  Offline

Very Senior Member

Joined: May 2008
Posts: 4,858
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!
#80888 - 08/14/12 08:17 AM Re: Flashing Keyboard LEDs? [Re: mochamame]  
Joined: May 2008
Posts: 4,858
qmc2 Offline
qmc2  Offline

Very Senior Member

Joined: May 2008
Posts: 4,858
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 (1 invisible), 23 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,456
Posts109,747
Members4,768
Most Online225
May 26th, 2014
Powered by UBB.threads™ PHP Forum Software 7.6.0
Page Time: 0.033s Queries: 14 (0.008s) Memory: 4.9869 MB (Peak: 5.2008 MB) Zlib enabled. Server Time: 2017-12-15 21:33:09 UTC