notification on core change?

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
werpu
Posts: 89
Joined: Sun May 24, 2020 7:37 pm
Has thanked: 12 times
Been thanked: 16 times

notification on core change?

Unread post 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.
User avatar
bootsector
Posts: 170
Joined: Sun May 24, 2020 6:58 pm
Has thanked: 4 times
Been thanked: 30 times

Re: notification on core change?

Unread post 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).
werpu
Posts: 89
Joined: Sun May 24, 2020 7:37 pm
Has thanked: 12 times
Been thanked: 16 times

Re: notification on core change?

Unread post by werpu »

thx... I will check this out.
User avatar
venice
Top Contributor
Posts: 788
Joined: Tue Jun 16, 2020 9:29 am
Location: Germany
Has thanked: 278 times
Been thanked: 278 times

Re: notification on core change?

Unread post 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

My MiSTer Add-On-Projects tty2oled, i2c2oled, SNAC2IEC
You can donate by sending a Postcard (Cardwarez) to me.

User avatar
venice
Top Contributor
Posts: 788
Joined: Tue Jun 16, 2020 9:29 am
Location: Germany
Has thanked: 278 times
Been thanked: 278 times

Re: notification on core change?

Unread post by venice »

I figured it out using

Code: Select all

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

My MiSTer Add-On-Projects tty2oled, i2c2oled, SNAC2IEC
You can donate by sending a Postcard (Cardwarez) to me.

User avatar
Newsdee
Top Contributor
Posts: 873
Joined: Mon May 25, 2020 1:07 am
Has thanked: 104 times
Been thanked: 239 times

Re: notification on core change?

Unread post 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:
Post Reply