Resetting playlist via Hijack menu?

Posted by: Roger

Resetting playlist via Hijack menu? - 18/01/2005 11:11

I was driving to work this morning, and my empeg rebooted. It looks like a bad track -- 'cos every time I turn it on, it reboots. I don't get a chance to skip the track.

Is there a way (using the Hijack knob-press menu) to clear the player's playlist, so that I can listen to some music on the way home.

(Alternatively, is there anyone on the BBS who's working at Microsoft UK in Reading today who has an empeg PSU and serial cable with them? )
Posted by: JBjorgen

Re: Resetting playlist via Hijack menu? - 18/01/2005 13:45

Sometimes on bootup you can really quickly skip to the next track...you may want to try that a couple times. I've done that several times when on the road with a bad track. Sometimes it take a couple tries to hit it at just the right second.
Posted by: mlord

Re: Resetting playlist via Hijack menu? - 18/01/2005 19:20

Switch it to tuner/Aux mode if possible, then use a web browser to connect to Hijack's httpd server, and hit "play" on one of the playlists.

No way from the front panel that I can think of.

Cheers
Posted by: tfabris

Re: Resetting playlist via Hijack menu? - 18/01/2005 22:02

Wouldn't that be a cool hijack feature, though? Reset the playlist from the hijack menu. It could simply stop the player app and restart it with the -i command line.

Unless a bad track means that the kernel reboots and even the hijack menu can't be called up...
Posted by: mlord

Re: Resetting playlist via Hijack menu? - 18/01/2005 22:25

Implement it yourselves in config.ini using ;@MENUEXEC

Cheers
Posted by: tfabris

Re: Resetting playlist via Hijack menu? - 18/01/2005 22:26

Ooh good point.
Posted by: RobotCaleb

Re: Resetting playlist via Hijack menu? - 18/01/2005 22:55

owned
Posted by: mlord

Re: Resetting playlist via Hijack menu? - 18/01/2005 22:58

Mmm.. perhaps not so simple.. I just tried this one line script to kill the existing player threads:
Code:

;@MENUEXEC Restart_Player for y in /proc/[0-9]* ; do if ( grep -l 'player' $y/cmdline &>/dev/null ); then kill ${y:6}; fi; done; player -i &


Problem is, the Empeg's custom init process immediately restarts the player whenever it dies, giving no chance for my script to succeed with "player -i".

Mmm..
Posted by: mlord

Re: Resetting playlist via Hijack menu? - 19/01/2005 01:11

Roger, how about a Hijack menu option to simply blank the flash savearea and then restart the player. This could cure all sorts of ills.

But I suppose the only important thing would be to clear the current playlist. It might even be nice if Hijack would detect the player crashing repeatedly and then implement that strategy autonomously.. or would it?

Cheers
Posted by: Roger

Re: Resetting playlist via Hijack menu? - 19/01/2005 06:39

Quote:
be nice if Hijack would detect the player crashing repeatedly and then implement that strategy autonomously.. or would it?


Yeah, that'd be cool. I was thinking that Hijack could hook init, and if it attempted to start the player more than, say, 3 times in a minute, the 4th time it could frob the command line to add the -i.

As it turns out, though, it was a loose hard disk cable -- I still haven't hot-glued it onto the disk drives. Or at least, by the time I got home and plugged it into a serial cable, it had come loose...
Posted by: Roger

Re: Resetting playlist via Hijack menu? - 19/01/2005 06:41

Quote:
...use a web browser to connect to Hijack's httpd server...


I didn't bring the power supply in with me, unfortunately. I've got a spare PSU somewhere, so if I can find that, I'll just stuff it in the bag for the future.
Posted by: genixia

Re: Resetting playlist via Hijack menu? - 19/01/2005 11:35

Yeah, if that stategy succeeded it would be sweet.

I'm wondering how clever the custom init is. If you killed init first, and then restarted the player with the -i flag, could your then restart init without it trying to start another player instance? Or would you need to kill the player first?
Posted by: mlord

Re: Resetting playlist via Hijack menu? - 19/01/2005 13:00

Mm.. yes, we already hook into the exec*("player") call for the serial port parameter, so simply counting those over a short interval would detect crash-loops, and sticking in the "-i" should be simple.

I'll put it on my TO-DO list, behind PASV ftp support -- yesterday I wrote a simple FTP server from scratch (userspace), and discovered that PASV is much simpler to implement than previously thought. But my brief attempt to then add it to Hijack just plain failed with core dumps. I need to tidy up the existing code some first, I guess.

Maybe in February, after the crunch is over (still busy writing material for Embedded Linux course that starts on Monday..)

Cheers
Posted by: wfaulk

Re: Resetting playlist via Hijack menu? - 19/01/2005 14:30

Kill it with signal 2. That'll stop it and it won't restart because it thinks it's received Ctrl-C.
Posted by: Roger

Re: Resetting playlist via Hijack menu? - 19/01/2005 17:04

Quote:
Kill it with signal 2. That'll stop it and it won't restart because it thinks it's received Ctrl-C.


But then init will attempt to run bash. If that exists, it'll leave you at a shell prompt in the car with no way to talk to it. The code for init looks something like this:

Code:

for (;;)
{
int rc = try_run_player();
if (rc == REBOOT_EMPEG)
shutdown_and_reboot();
else if (rc != RESTART_PLAYER)
try_run_bash();
}



Obviously, that could be refactored a little, but I hope you get the idea.

If bash doesn't exist, init will restart the player, and then you'll have two copies running.

I think the only sensible way to do it is to hook the exec() call in init.
Posted by: wfaulk

Re: Resetting playlist via Hijack menu? - 19/01/2005 17:20

Ah, good point. Even in the best-case scenario, you'd have an extraneous bash process lying around with nowhere to swap it to.