Unoffical empeg BBS

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

Topic Options
#245432 - 04/01/2005 06:28 /proc/empeg_notify delay when injecting buttons
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
For those who haven't been following this thread, a couple of us are trying to interface our empegs to our BMWs by emulating the BMW branded but Alpine built CD changer.

Basically we are injecting button codes into /proc/empeg_notify to simulate button presses. In my case I'm initially doing the 4 up, down, left, right buttons and also Mark Track as a special one.

My code consists of this (which I blatantly stole from an example or someone somewhere sorry can't remember where exactly):

Code:
int DoSerialCmd(const char* szCmd)
{
FILE *fs_EmpegNotify=NULL;
fs_EmpegNotify = fopen("/proc/empeg_notify", "a");

if(NULL==fs_EmpegNotify) {
perror("could not open empeg_notify to receive serial commands");
return 0;
}

fprintf(fs_EmpegNotify, "%s\n",szCmd);
fclose(fs_EmpegNotify);

return 1;
}



which I then simply call with something like this:

Code:
DoSerialCmd("BUTTON=PrevTrack");




The problem is that when the button code is injected it can take a good 5 seconds for it to take effect. It would seem that the empeg is waiting for the drive(s) to spin up. Something to do with /proc being a filesystem (even though it's a pseudo filesystem)?

I don't really want to have the drives spinning all the time if possible. It's particularly annoying when skipping a few tracks at a time. Even when the drives are spun up it's not nearly as responsive as pressing a front panel button.

I didn't pay too much attention to the above code, but perhaps opening and closing the file is slowing it down a little? I'll try that. I'm not running anything else extra but would keeping it open prevent other apps from working?

So for those who have injected button presses via this method, did you find a lot of lagginess?

Any suggestions that might get around this issue?

Thanks
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#245433 - 04/01/2005 21:05 Re: /proc/empeg_notify delay when injecting buttons [Re: Shonky]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Is that only for the first press of a sequence, or slow for the others, too?

Is it still slow if you feed one press, wait for drives to spindown, then feed another?

Perhaps it is paging libc (the C library), since you're using the high level stream I/O utils, rather than simply calling open(), write(), and close() directly (which map to kernel syscalls, and shouldn't cause any new libc activity).

???

Top
#245434 - 05/01/2005 15:28 Re: /proc/empeg_notify delay when injecting buttons [Re: mlord]
DJZorro
new poster

Registered: 19/12/2003
Posts: 22
Quote:
Perhaps it is paging libc (the C library), since you're using the high level stream I/O utils, rather than simply calling open(), write(), and close() directly (which map to kernel syscalls, and shouldn't cause any new libc activity).


Very interesting hint! I will try to rewrite that piece of code tonight..

Top