Page 1 of 1

notification on core change?

Posted: Thu Jun 04, 2020 5:44 pm
by werpu
Hi, does MiSTer have some kind of state eventing system on the linux side.

My problem. I am working on a raspberry pi touch screen solution for various different system keyboards.
The main problem I face atm is. If I switch for instance from C64 to AtariXL how can I notify my external keyboard that such a switch has happened.
The switch side itself is easy probably the easiest is simply to send a network udp message or something similar which notifies the keygboard that the system was switched to Atari XL.
However I have now clue if there is some kind of hook where I can hook a shell script in so that some external conditions can be adjusted according to the state MiSTer is about to enter.

Re: notification on core change?

Posted: Thu Jun 04, 2020 6:55 pm
by bootsector
You could write a little "daemon" on MiSTer side that checks for changes inside /tmp/CORENAME (this file holds the name of the current loaded core).

Re: notification on core change?

Posted: Fri Jun 05, 2020 5:16 pm
by werpu
thx... I will check this out.

Re: notification on core change?

Posted: Mon Jan 11, 2021 7:16 am
by venice
Hi,
bootsector wrote: Thu Jun 04, 2020 6:55 pm You could write a little "daemon" on MiSTer side that checks for changes inside /tmp/CORENAME (this file holds the name of the current loaded core).
if I run a simple tail -f /tmp/CORENAME i get the following output

Code: Select all

/root# tail -f /tmp/CORENAME
MENUtail: /tmp/CORENAME: file truncated
ATARI2600tail: /tmp/CORENAME: file truncated
ATARI2600tail: /tmp/CORENAME: file truncated
ATARI5200tail: /tmp/CORENAME: file truncated
ATARI5200
If I run tail -f /tmp/CORENAME 2> /dev/null I get this shown

Code: Select all

/root# tail -f /tmp/CORENAME 2> /dev/null
ATARI2600ATARI5200ATARI5200NESNES
Any chance to get rid of "file truncate" and the doubled core name using console commands?
I like to send the output to an Arduino.

Thx

Re: notification on core change?

Posted: Wed Jan 13, 2021 7:20 am
by venice
I figured it out using

Code: Select all

while true do 
  newcore=$(cat /tmp/CORENAME)
  sleep 2
done

Re: notification on core change?

Posted: Wed Jan 13, 2021 2:41 pm
by Newsdee
werpu wrote: Thu Jun 04, 2020 5:44 pm I am working on a raspberry pi touch screen solution for various different system keyboards.
This sounds super interesting! Good luck and hope you can share details about it :mrgreen: