Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Page 1 of 2 1 2 >
Topic Options
#137069 - 24/01/2003 16:50 Hijack v303: exec=, exec_once=
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Okay, Hijack v303 is out.

New in v303/v302 are the following:

-- support for the new "PrevVisual" buttoncode from the recent Bug-Blat, and a new VisualSeek function which can be mapped to a real Rio Remote button as follows:

[ir_translate]
Visual.L=Visual.L
Visual=VisualSeek


Once the v2 final software is released, everyone will be able to use this new buttoncode. But the ir_trans stuff above will work NOW, but only for Next-Visual..

-- support for "exec=" and "exec_once=" software start-up directives in the [hijack] section of config.ini. These can be used to start third-party app's on boot at player startup ("exec_once="), and on ANY player startup ("exec=").

Syntax is something like this:

[hijack]
exec_once=/bin/imaginaryapp ghouls=5 pills=77 "quoted strings work too\n"
exec=dd if=/proc/sys/kernel/panic of=/proc/sys/kernel/ctrl-alt-del


Note that the latter example above is the one I used to test this functionality.. it should result in a "0" in /proc/sys/kernel/ctrl-alt-del afterwards (try it!).

If a command returns a non-zero exit status, this is noted on the serial console (but nowhere else currently).

Hopefully this will make software installation somewhat simpler. I will eventually include support for adding programs to menus with a similar mechanism.

Cheers


Edited by mlord (24/01/2003 16:52)

Top
#137070 - 24/01/2003 17:01 Re: Hijack v303: exec=, exec_once= [Re: mlord]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I've been obsoleted! Yay!
_________________________
Bitt Faulk

Top
#137071 - 24/01/2003 18:06 Re: Hijack v303: exec=, exec_once= [Re: mlord]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
These can be used to start third-party app's

Cool! So you must have worked through that executing from kernel space stuff.

ext3 enabled versions are now available.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#137072 - 24/01/2003 21:15 Re: Hijack v303: exec=, exec_once= [Re: mlord]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
My dream has been answered! Bravo! How'd you pull that off, Mark?

Now, on to converting the GPSapp installation over from Preinit to Mark's new method. Anyone have any tips? For example, can I now put GPSapp in any folder on /drive0 if I wanted, and would it work? What would the entry look like in config.ini for that?
_________________________
Tony Fabris

Top
#137073 - 25/01/2003 08:35 Re: Hijack v303: exec=, exec_once= [Re: mlord]
image
old hand

Registered: 28/04/2002
Posts: 770
Loc: Los Angeles, CA
does exec_once execute before or after the player executes... apps like gpsapp require to be run before, if i recall.

Top
#137074 - 25/01/2003 09:32 Re: Hijack v303: exec=, exec_once= [Re: image]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
At present, both "exec=" and "exec_once=" run during player startup: the player is paused when it reads config.ini, and Hijack takes over and does the "exec" things before allowing the player to continue.

-ml

Top
#137075 - 25/01/2003 09:46 Re: Hijack v303: exec=, exec_once= [Re: mlord]
image
old hand

Registered: 28/04/2002
Posts: 770
Loc: Los Angeles, CA
so the main thing is this.... does the player app already lock the com port before the "exec=" and "exec_once=" lines are executed?

Top
#137076 - 25/01/2003 10:09 Re: Hijack v303: exec=, exec_once= [Re: image]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Dunno. But the read of config.ini is one of the very first things it does at startup, so it might be fine. Try it and let us know!

Top
#137077 - 25/01/2003 11:56 Re: Hijack v303: exec=, exec_once= [Re: mlord]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Another thing I'd like to know is if I should do GPSapp as an "exec" or as an "exec_once".

When GPSApp messes up, I'd love to be able to restart it with a simple "quit" from the player's main menu. If I put GPSapp in the "exec" line, would it work that way?
_________________________
Tony Fabris

Top
#137078 - 25/01/2003 12:10 Re: Hijack v303: exec=, exec_once= [Re: mlord]
johnmcd3
enthusiast

Registered: 19/04/2001
Posts: 369
Loc: Seattle, WA (formerly Houston,...
I'm curious about how you dealt with your original reservations about starting programs in kernel space. I'll probably try to sort through your new code when I get a chance, but a quick summary would be interesting...

John
_________________________
1998 BMW ///M3 30 GB Mk2a, Tuner, and 10 GB backup

Top
#137079 - 25/01/2003 12:36 Re: Hijack v303: exec=, exec_once= [Re: johnmcd3]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
I don't think I've had any reservations about starting programs from kernel space like this.. It's more a case of not previously knowing exactly how to do it.

I gave it a shot during Christmas 2001, but couldn't figure it out quickly enough then, and so wrote the web/ftp servers instead, and posted a plea for somebody else to tackle it.

Somebody else did give it a go, and I took their last work, simplified it a bit, and fixed a bug or three: thus what we have today!

Cheers

Top
#137080 - 25/01/2003 12:37 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
There is nothing in Hijack to kill off previously started programs, so I suspect GPSapp needs to be "exec_once=", as would just about any other program that uses this mechanism.

Cheers

Top
#137081 - 25/01/2003 12:42 Re: Hijack v303: exec=, exec_once= [Re: mlord]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA

Okay, thanks!

Another GPSApp question...

Included in the GPSApp distro is the program "INCAR", as well as a little file called M50GPSAPP that's used by preinit to do an "If Incar then run GPSAPP". Question is: That little file, is that an ordinary shell script? And if so, can Hijack's "exec_once" command run it?

_________________________
Tony Fabris

Top
#137082 - 25/01/2003 13:09 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
And another question.

GPSApp seems to run OK from the Hijack method, but the following appears on the serial port:

hijack_exec("/drive0/var/gpsapp/gpsapp"), rc=255 (ERROR)

Does that really indicate an error? Because it seems to run fine.
_________________________
Tony Fabris

Top
#137083 - 25/01/2003 13:17 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
If the "INCAR" thing is just checking for DC_POWER, then you can replace it completely with a config.ini hijack macro:

;@DC exec_once=/drive0/var/gpsapp/gpsapp

Top
#137084 - 25/01/2003 13:18 Re: Hijack v303: exec=, exec_once= [Re: mlord]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Yup, that's brilliant. Of couse! (/me smacks self in forehead)
_________________________
Tony Fabris

Top
#137085 - 25/01/2003 13:19 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
The '255' is the exit status returned by the GPS app, which in reality was probably "-1". I suppose one could look at the source code for GPSapp to see what it normally returns (or "exit()"s) after it starts up and spawns a daemon.

Cheers

Top
#137086 - 25/01/2003 13:25 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Yup, gotta love that incredibly simple little "macro" feature!

Well, back to work on the fan controller support now.. got one yet?

-ml

Top
#137087 - 25/01/2003 13:32 Re: Hijack v303: exec=, exec_once= [Re: mlord]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Well, back to work on the fan controller support now.. got one yet?

Nope, haven't done an internal fan.
_________________________
Tony Fabris

Top
#137088 - 25/01/2003 13:38 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Ahh.. well, I'm hacking in support for the Empeg fan kit on this page: http://www.benjammin.net/www/pages/projects/

As a bonus, it has a software readable temperature register, which could make up for the broken "stock" one.

Cheers

Top
#137089 - 25/01/2003 14:37 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
I suspect that you could use a shell script to do what you want with restarting GPSapp everytime the player starts. I'm not sure if gpsapp traps any signals to 'nicely' stop, or whether the brute force approach below is the only way.

config.ini:

[hijack]
;@DC exec=/path/to/gpsapp.sh


/path/to/gpsapp.sh:

#!/bin/bash
$pid = pidof gpsapp
if [ -n $pid]; then
kill -9 $pid
usleep 10000
fi

if [ -x /path/to/gpsapp ] ; then
/path/to/gpsapp NMEA
fi

exit 0


The usleep is there to give gpsapp a chance to disappear cleanly before we restart it. The value may need to be tweaked - I have no idea. (In fact I have no idea what would happen if the second incarnation of gpsapp happened before the first disappeared anyway.)

Edit: Appended NMEA to gpsapp start line - Not sure if it's necessary anymore.



Edited by genixia (25/01/2003 14:55)
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#137090 - 25/01/2003 14:41 Re: Hijack v303: exec=, exec_once= [Re: genixia]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Well, before I even get that far, I need to figure out why GPSapp isn't working in the car at all now.

When I said before that GPSapp seemed to work, it was when I ran it in home mode without a GPS unit actually connected (still haven't done @DC= as I'm testing it). When I put the player in the car where there actually was a GPS unit, it doesn't work. First try: Blank screen followed by player reboot, second try: blank screen.

Interestingly, it all works in the house, even when I do "force DC/Car power".

Wonder if it has to do with the serial port?

(PS: And besides, the only reason I would want GPSApp to get restarted is because it sometimes locks up because of bugs. The right way to do it is to just fix the bugs. )
_________________________
Tony Fabris

Top
#137091 - 25/01/2003 14:48 Re: Hijack v303: exec=, exec_once= [Re: mlord]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Now here's an interesting question...

What if I want to run more than one exec_once or exec?

The INI file format doesn't allow this:

exec_once=program1
exec_once=program2
exec_once=program3

The things to the left of the equals sign have to be different each time. Even if Hijack is smart enough to parse that above, when you edit config.ini in emplode, it doesn't allow double-entries like that (it saves the first one only).

For now, I've got exec_once running GPSapp and exec running empacman, but now I'm full up.
_________________________
Tony Fabris

Top
#137092 - 25/01/2003 14:53 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
Hmm...maybe. DId you replace the /bin/init with the hacked one after upgrading to alpha14?
AFAIK, the stock init will still try to make the player use the serial port.

Another thing to check - IIRC, gpsapp defaults to NMEA mode anyway, but I could be wrong. It might be an idea to append NMEA to your exec line anyway. I'll update the above script to reflect that.
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#137093 - 25/01/2003 14:57 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
I wonder if the exec= line would accept multiple arguments;

exec=app1; app2; app3
exec_once=app4; app5

I haven't looked at the source to hijack. I'm sure Mark knows the answer
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#137094 - 25/01/2003 15:03 Re: Hijack v303: exec=, exec_once= [Re: genixia]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
DId you replace the /bin/init with the hacked one after upgrading to alpha14?

Ah, that must have been it. I'll try to find that hack_init program and use it again.

Pity if that's the case. We're this close to having a system where software upgrades don't kill third-party app installations.

Actually, we're all the way there, it's only GPSapp's need for the serial port that's at issue here. Wish there was a config.ini option to tell the player not to use the serial port, rather than hacking the init.
_________________________
Tony Fabris

Top
#137095 - 25/01/2003 15:15 Re: Hijack v303: exec=, exec_once= [Re: genixia]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
The exec lines take a single command per line.

To get multiple exec lines, just use an editor that permits it for now.. kinda suprising that Emplode mucks about with it, being none of Emplode's business to do so!

I guess I'll have to hack the syntax in Hijack, maybe do it this way:

;@DC ;@EXEC_ONCE /usr/sbin/gpsapp
;@EXEC_ONCE /usr/sbin/emppacman
...

Whatchathink?

Top
#137096 - 25/01/2003 15:16 Re: Hijack v303: exec=, exec_once= [Re: tfabris]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
Has anyone explicitly 'wished' for that before?

I wonder if we could persuade the empeg guys to implement that now. I'm guessing that once 2.0final is out we're going to wait a while before the next version is in beta. (Maybe I'm wrong..???)
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#137097 - 25/01/2003 15:28 Re: Hijack v303: exec=, exec_once= [Re: genixia]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Okay, I'll make that wish official now (using internal alpha team mail). Because running hack_init fixed it and GPSapp worked in my car just now.

Seems to me kind of odd that they deliberately made the player go to 4800bps in the car specifically so that it could talk to GPS units, but then prevent a third party GPS application from talking on the serial port.
_________________________
Tony Fabris

Top
#137098 - 25/01/2003 15:59 Re: Hijack v303: exec=, exec_once= [Re: mlord]
johnmcd3
enthusiast

Registered: 19/04/2001
Posts: 369
Loc: Seattle, WA (formerly Houston,...
would it be cleaner to do something like:

[hijack]
exec1=app1
exec2=app2
exec_once1=app3

and hijack just ignored the numbers? seems like that might look cleaner than the ;@EXEC_ONCE.

if there's a parsing issue there, maybe a second choice might be:

[hijack]
n_exec=2
exec1=app1
exec2=app2
n_exec_once=1
exec_once1=app3

but it's questionable whether the extra lines are neccessary.
_________________________
1998 BMW ///M3 30 GB Mk2a, Tuner, and 10 GB backup

Top
#137099 - 25/01/2003 16:03 Re: Hijack v303: exec=, exec_once= [Re: johnmcd3]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
I thought of that idea originally, but decided against it for two reasons:

(1) it'll confuse the heck out of people, and I'll get flooded with emails;

(2) Since the "exec" lines can contain ANYTHING, we really want to ensure that Emplode doesn't get p'offed by anything else that happens to be on such a line, so it is probably best to just have emplode ignore the whole line (by commenting it out).

Ugh, but that's life here

Top
#137100 - 27/01/2003 08:31 Re: Hijack v303: exec=, exec_once= [Re: mlord]
JBjorgen
carpal tunnel

Registered: 19/01/2002
Posts: 3584
Loc: Columbus, OH
mirror updated to v309
_________________________
~ John

Top
#137101 - 28/01/2003 11:37 Re: Hijack v303: exec=, exec_once= [Re: mlord]
kimbotha
member

Registered: 30/08/2000
Posts: 157
Loc: London, UK
Thanks Mark... it is great to see the kernel exec thing working properly...

I am sorry I had to leave the version I was working on for so long...

Did you manage to get it working from the ftp daemon as well...? This is where I really got stuck trying to return the output. Would make installing software much easier to script from the PC side...

Hopefully sometime soon I will get a chance to come back and do some coding with my empeg. *sigh*

Cheers again,

Kim

Top
#137102 - 28/01/2003 11:48 Re: Hijack v303: exec=, exec_once= [Re: kimbotha]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Ah.. I was wondering who to give credit to here -- I'd forgotten whose code I picked up and worked on!

I've left much of the pipe stuff in the source, #ifdef'd out for now, because it has a remaining problem in that we cannot simultaneously wait4() for the child, and wait/grab pipe output for display. Solving this usually means yet another thread to mind the user command.

Later, much later..

Cheers! (and Thanks for doing much of the initial work!)

Top
Page 1 of 2 1 2 >