Unoffical empeg BBS

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

Topic Options
#232558 - 04/09/2004 01:47 Inserting large quantities of fids in /proc/empeg_notify
cushman
veteran

Registered: 21/01/2002
Posts: 1380
Loc: Erie, CO
I'm using /proc/empeg_notify to insert tunes into the playlist programatically from Empire.

What I've found is that when inserting many songs at the same time , the player may crash (I guess it does, it just exits to the shell). Here is the end of the serial output when attempting to enqueue 66 songs:

<61 fids before this point>
#0000052F0-
#00000CBF0-
#00000CC00-
#00000CC10-
#00000CC20-
Restored terminal settings
Remounting first music partition read-only
Remounting second music partition read-only
Player exited normally: 1
Switching to shell-player loop
Starting bash.
empeg:/empeg/bin#


Here is the relevant code I'm using to write to /proc/empeg_notify:

Code:

// uint8_t_body is the OBEX object, which is a string of 8 digit fids
// with no delimiter, I just copy the next 8 characters
// notify_fd is a file handle for /proc/empeg_notify

for(i = 0; i <= body_len - 8; i += 8) {
strcpy(fid, "#XXXXXXXX0-");
memcpy(fid + 1, (uint8_t_body + i), 8);
fid_command(fid, notify_fd);
}

void fid_command(const uint8_t *fid, int notify_fd) {
char *serial_cmd;
serial_cmd = malloc(strlen(fid) + 9);
snprintf(serial_cmd, strlen(fid) + 9, "SERIAL=%s\n", fid);
empeg_command(serial_cmd, notify_fd);
free(serial_cmd);
}

void empeg_command(char *serial_cmd, int notify_fd) {
write(notify_fd, serial_cmd, strlen(serial_cmd));
}


The enqueue action fails around 66 songs. I can enqueue 65 at once ok, but more than that it exits to the shell as above. I do not think this is a constant number though, because I seem to remember being able to enqueue more earlier. Any insight as to why this would happen would be greatly appreciated. Full source to my test version of empire is attached.


Attachments
231633-empire.c (201 downloads)

_________________________
Mark Cushman

Top
#232559 - 04/09/2004 10:45 Re: Inserting large quantities of fids in /proc/empeg_notify [Re: cushman]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Could be the same thing that causes it to crash when simply hitting the "Next Track" button (remote or front panel) a few gadzillion times in a row, as well.

Cheers

Top
#232560 - 06/09/2004 16:43 Re: Inserting large quantities of fids in /proc/empeg_notify [Re: mlord]
cushman
veteran

Registered: 21/01/2002
Posts: 1380
Loc: Erie, CO
Thanks, Mark. I think as a workaround I will just insert a delay after x number of serial commands to allow the player to "catch up". I can see when I insert a lot of songs the playlist size slowly increments over a matter of 5 or so seconds to match the amount of songs actually inserted. It should not be a problem for someone who is inserting/enqueueing 50+ songs to have to wait an additional 5-10 seconds for the entire playlist to be up on the player. The first track will be sent immediately, so no wait there.

Unless this is something that can be fixed in the player software for a later release.
_________________________
Mark Cushman

Top
#232561 - 06/09/2004 16:48 Re: Inserting large quantities of fids in /proc/empeg_notify [Re: cushman]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
Which player version?
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#232562 - 06/09/2004 17:55 Re: Inserting large quantities of fids in /proc/empeg_notify [Re: genixia]
cushman
veteran

Registered: 21/01/2002
Posts: 1380
Loc: Erie, CO
2.00

Edit: Just in case anyone who has the power to fix the player software is reading this, please also fix the bug where inserting or enqueueing to an empty playlist (like after an upgrade or crash) crashes the player. This exists also in 2.00 final.


Edited by cushman (06/09/2004 17:57)
_________________________
Mark Cushman

Top
#232563 - 07/09/2004 09:12 Re: Inserting large quantities of fids in /proc/empeg_notify [Re: cushman]
tms13
old hand

Registered: 30/07/2001
Posts: 1115
Loc: Lochcarron and Edinburgh
That number 66 looks suspicious. Assuming that the player gets around to acting on the first FID you send, that's 64 that work, and then the 66th fails. 64 looks suspiciously like it might be the size of some buffer in the code...
_________________________
Toby Speight
030103016 (80GB Mk2a, blue)
030102806 (0GB Mk2a, blue)

Top
#232564 - 07/09/2004 15:08 Re: Inserting large quantities of fids in /proc/empeg_notify [Re: cushman]
cushman
veteran

Registered: 21/01/2002
Posts: 1380
Loc: Erie, CO
Ok, workaround complete. Here was my stress test:



Attachments
231890-enqueue.gif (159 downloads)



Edited by cushman (07/09/2004 15:09)
_________________________
Mark Cushman

Top
#232565 - 07/09/2004 21:04 Re: Inserting large quantities of fids in /proc/empeg_notify [Re: cushman]
SE_Sport_Driver
carpal tunnel

Registered: 05/01/2001
Posts: 4903
Loc: Detroit, MI USA
Sweet!

Is this empire (version 0.25)?


Edited by SE_Sport_Driver (07/09/2004 21:06)
_________________________
Brad B.

Top
#232566 - 07/09/2004 21:11 Re: Inserting large quantities of fids in /proc/empeg_notify [Re: SE_Sport_Driver]
cushman
veteran

Registered: 21/01/2002
Posts: 1380
Loc: Erie, CO
Most definately not! It was the reason I had to code the workaround. Empire 0.25 probably only handles ~65 or so tunes. I'm busy packaging a new version that should be out later tonight or tomorrow. I would like to include an install script this time around, so I'm stealing some of Tony C's work in that area. The install should be very simple by the time I'm done.
_________________________
Mark Cushman

Top
#232567 - 07/09/2004 21:14 Re: Inserting large quantities of fids in /proc/empeg_notify [Re: cushman]
SE_Sport_Driver
carpal tunnel

Registered: 05/01/2001
Posts: 4903
Loc: Detroit, MI USA
Oh nice! I thought the fix would have to be on the Palm side but didn't notice a newer version number. The latest empire version I had in my saved folder was .20, but I wasn't sure if the version you cooked up for me was in that same folder or not...

I'm willing to test your script on my player that already has empire on it if you need..
_________________________
Brad B.

Top