Unoffical empeg BBS

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

Topic Options
#48277 - 28/11/2001 14:53 Question on userland application
alex25
member

Registered: 30/06/1999
Posts: 179
Loc: Switzerland
I'm working on a userland application with the famous hijack kernel.
Everything is working by now. I can add my own menu entries and start my application.
Now my question: Is it possible to remove or replace some or all (own) userland menu entries? I don't see this functionality at the moment. Shouldn't the EMPEG_HIJACK_WAITMENU ioctl call replace the menuentries? (instead of just add the new ones)?
My application should dynamically change/add/remove menu entries.
Is this possible with the current hijack kernel or do I have to wait for one of the next releases?

Thanks

Top
#48278 - 28/11/2001 15:14 Re: Question on userland application [Re: alex25]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
I'm not sure what you're looking for here... You're correct in that you cannot change any menu entries but I'm not sure why you would want to do this. Right now it's designed to allow you to bind your application to the menu so you can call your app from that menu. If you want your own menus within your app, you have to do those yourself (as I have in my trivia game.)

What is it you want to do with your app? Mlord is flexible, if you give him a good reason you want to change menu entries, I think he might be receptive to it when he goes to work on it again.

BTW glad to hear someone besides me is working on a hijack user app!
_________________________
- Tony C
my empeg stuff

Top
#48279 - 29/11/2001 00:19 Re: Question on userland application [Re: tonyc]
alex25
member

Registered: 30/06/1999
Posts: 179
Loc: Switzerland
My plan is to implement a RDS TMC solution. This mean my application is collecting traffic messages in background and display it later. (Sorry but working in Switzerland only at the moment! Location code is country depended.)

So I think I need the following menu structure:
TMC: Turn service on (means start collecting messages)
TMC: Turn service off (replace the menu above)
TMC: Show messages (visible only if service is turned on)

Maybe I implement some kind of submenu like you did in your trivia game. Think this shouldn't be a big problem.

Top
#48280 - 29/11/2001 02:32 Re: Question on userland application [Re: alex25]
bobo
member

Registered: 13/08/1999
Posts: 116
I htought sampling from the tuner is only possible if the empeg is in tuner mode ?
so it will only work if we listen to the radio, right ?

bobo

Top
#48281 - 29/11/2001 02:36 Re: Question on userland application [Re: bobo]
alex25
member

Registered: 30/06/1999
Posts: 179
Loc: Switzerland
No, it should be possible to read the rds data even if the player is in mp3 mode. If not, I have to search for a workaround. :-)
It might be necesarry to tune in a station first.

Top
#48282 - 29/11/2001 09:34 Re: Question on userland application [Re: alex25]
altman
carpal tunnel

Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
RDS is still running when in other modes. Note though that we read all the data from the rds pipe (/dev/rds I think). If you want to read it too, you'll need to sit between the player and the rds device - much like people used to do with IR.

Hugo

Top
#48283 - 29/11/2001 13:06 Re: Question on userland application [Re: altman]
alex25
member

Registered: 30/06/1999
Posts: 179
Loc: Switzerland
I'm not a kernel developer, at least until now.
But, is there an easy way to add a second rds device (for example called /dev/rds2) from which I can read all the rds data, even if the player is running and consuming all the data from the main rds device? The data on this second device should be a raw copy of the main rds device. Don't know if this is possible?

Top
#48284 - 29/11/2001 17:46 Re: Question on userland application [Re: altman]
bobo
member

Registered: 13/08/1999
Posts: 116
ah, that's cool :-)

bobo

Top
#48285 - 30/11/2001 07:12 Re: Question on userland application [Re: alex25]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5914
Loc: Wivenhoe, Essex, UK
Take a look here. This example is intercepting the IR data, but I think it will be similar for the RDS data.
_________________________
Remind me to change my signature to something more interesting someday

Top
#48286 - 12/12/2001 23:16 Re: Question on userland application [Re: alex25]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14477
Loc: Canada
>Now my question: Is it possible to remove or replace some or all (own) userland menu entries?

Each call to EMPEG_HIJACK_WAITMENU "replaces" the previous definition with the newest one, but the menu labels remain the same..

So, in a word, no.

I am still not 100% happy with the interface, and may completely flip it around someday, such that it triggers an external program and WAITS for it to exit.

..someday..

Top
#48287 - 18/12/2001 06:09 Re: Question on userland application [Re: altman]
alex25
member

Registered: 30/06/1999
Posts: 179
Loc: Switzerland
I though I found a solution, but it seems it's not that easy.

What I have done:
- Renamed original /dev/rds0 to /dev/rds_org
- Created a new FIFO Device mkfifo /dev/rds0

The source looks like this:
{
ssize_t rts;
char rdscode[8];

fakeRDSfd = open(FAKE_RDS, O_WRONLY);
if(fakeRDSfd==-1) {
return -1;
}

realRDSfd = open(REAL_RDS, O_RDONLY&O_NDELAY&O_NONBLOCK);
if (realRDSfd==-1) {
close(fakeRDSfd);
return -1;
}

while(1) {
rts=read(realRDSfd, rdscode, 8);
if (rts>0) {
rts=write(fakeRDSfd, rdscode, rts);
}
}
}

If my userland application is running the player stops loading and displays "Starting RDS failed".
If my userland application is not running the player stops loading and displays "Starting RDS ..."

What does the message "Starting RDS failed" means? What is the player software expecting at startup? In which case does the player throws that message?

Thanks

Top
#48288 - 18/12/2001 06:42 Re: Question on userland application [Re: alex25]
altman
carpal tunnel

Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
One issue with your code is the open options for REAL_RDS; you should OR together flags ("|") not and them.

Actually, in this case you don't want to have O_NDELAY/O_NONBLOCK - this will just munch CPU. Data only ever turns up in 8-byte blocks, so your 8 byte read/write should be ok. Note also that errors return <0, not necessarily -1 in linux.

Do you see any message on the serial port when the player starts? The player just does an open("/dev/rds0",O_RDONLY) and prints that message if the open fails. This is no different to what it does when opening /dev/ir.

Hugo

Top
#48289 - 18/12/2001 06:58 Re: Question on userland application [Re: altman]
alex25
member

Registered: 30/06/1999
Posts: 179
Loc: Switzerland
>One issue with your code is the open options for REAL_RDS; you should OR
>together flags ("|") not and them.
Ok, changed

>Actually, in this case you don't want to have O_NDELAY/O_NONBLOCK - this
>will just munch CPU. Data only ever turns up in 8-byte blocks, so your 8 byte
>read/write should be ok. Note also that errors return <0, not necessarily -1 in
>linux.
Fixed

>Do you see any message on the serial port when the player starts? The player
>just does an open("/dev/rds0",O_RDONLY) and prints that message if the open
>fails. This is no different to what it does when opening /dev/ir.

As I can see there is no special console output:
empeg:/drive0/rene# player
empeg-car 2.00-beta3 2001/10/17.
3c1f5763 DHCP name = lo
3c1f5763 DHCP index = 1
3c1f5763 DHCP flags = 0x8
3c1f5763 DHCP addr = 0.0.0.0
3c1f5763 DHCP bcast = 0.0.0.0
3c1f5763 DHCP mask = 0.0.0.0
3c1f5763 DHCP name = eth0
3c1f5763 DHCP index = 2
3c1f5763 DHCP flags = 0x1043
3c1f5763 DHCP addr = 169.254.53.54
3c1f5763 DHCP bcast = 169.254.255.255
3c1f5763 DHCP mask = 255.255.0.0
3c1f5763 DHCP Our mac is 00:02:d7:22:06:dd
3c1f5763 DHCP Current IP address is 169.254.53.54
3c1f5763 DHCP Broadcast address is 169.254.255.255
3c1f5763 DHCP Adding interface eth0
3c1f5763 DHCP Sending DHCP discover (eth0)
3c1f5763 DHCP Extensions present: 61 53 55 57
RDS TMC initialised << userland application message
3c1f5768 DHCP Sending DHCP discover (eth0)
3c1f5768 DHCP Extensions present: 61 53 55 57
3c1f5772 DHCP Sending DHCP discover (eth0)
3c1f5772 DHCP Extensions present: 61 53 55 57

Searching for a way to solve this at the moment. I'll post if I find a solution.

Additional help welcome

Top
#48290 - 18/12/2001 07:02 Re: Question on userland application [Re: alex25]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4172
Loc: Cambridge, England
What does the message "Starting RDS failed" means? What is the player software expecting at startup?

The player calls an ioctl on the RDS fd and fails if the ioctl fails (which, of course, it will if the fd is a fifo as opposed to a real RDS device). This means that RDS (currently) can't be replaced in userland in the way that IR can.

Peter

Top
#48291 - 18/12/2001 09:27 Re: Question on userland application [Re: peter]
alex25
member

Registered: 30/06/1999
Posts: 179
Loc: Switzerland
Is it possible to create an own device (/dev/rds0 [RDS-FAKE], Major number 249 for example) with mknod and route all the requests from the player software to the original device? Sould be possible without kernel modification, shouldn't it?
What do I need to implement such a device? I think a good start point is the file empeg_rds.c from the kernel source, isn't it?
I hope we don't get a new beta of the player software with different implementation in the next few days. :-)

Top
#48292 - 19/12/2001 04:26 Re: Question on userland application [Re: peter]
number6
old hand

Registered: 30/04/2001
Posts: 745
Loc: In The Village or sometimes: A...
What chance then Peter of getting the player to 'echo'/broadcast the RDS packets it reads to a well-known UDP port (for example) so that Alex [or anyone elses] apps can also get their hands on the RDS packets being delivered to the player from the DSP?

It seems a real waste to have that valuable RDS data stream available in the empeg and yet have it locked away from the userland apps that really could make the best use of the data.

While its been a while since I did some unix socket programming I seem to recall a few mechanisms within Unix [and I suppose Linux too] whereby user level apps can 'share' in a fairly low-level resource wise way data via sockets such as Unix sockets or UDP broadcast sockets or similar.

In the best of all worlds, the player software would read [from config.ini?] a list of UDP ports to echo each RDS packet read from /dev/rds to and then each userland app [if more than one] could bind to a free UDP socket being sent the UPD packets.

In the worst case multiple userland apps could co-operate and rebroadcast amoungst themselves the RDs packets one of the them gets from the main UDP socket.

Either way Alexes problems would be solved as I don't think his application would mind a few milliseconds delay between the RDS packets arriving in the player and then being broadcast back out to his app.

Top
#48293 - 19/12/2001 09:16 Re: Question on userland application [Re: alex25]
alex25
member

Registered: 30/06/1999
Posts: 179
Loc: Switzerland
Got it to work!

But I did it the other way round now. I changed and compiled a new kernel. Now all the RDS datas are streamed to two independent devices (/dev/rds0 and /dev/rds1)
First I hoped I can do it without to modify the kernel. But now I think it was the easiest solution.

Disadvantage: Everytime time Mark Lord is releasing a new kernel I have to rebuild my own kernel. :-)

RDS data is now flushing trough /dev/rds1 device while the player is running!
Hope to release a preview version of my TMC software soon!

Top
#48294 - 20/12/2001 00:43 Re: Question on userland application [Re: alex25]
number6
old hand

Registered: 30/04/2001
Posts: 745
Loc: In The Village or sometimes: A...
alex why not forward your kernel changes to Mlord so he can include them with his latest kernels.
that way provided the user is running the mlord kernel your RDS app will work.


Top
#48295 - 20/12/2001 00:53 Re: Question on userland application [Re: number6]
alex25
member

Registered: 30/06/1999
Posts: 179
Loc: Switzerland
Don't know if Mark Lord is interested in including my changes.

There are a few restrictions at the moment:
- There are only data on /dev/rds1 if the player app is running. -> Should be no problem
- Don't know if I implemented it correct. However I had no crashes during my tests and the player still show the rds information.

Top
#48296 - 20/12/2001 14:10 Re: Question on userland application [Re: alex25]
schofiel
carpal tunnel

Registered: 25/06/1999
Posts: 2993
Loc: Wareham, Dorset, UK
Don't know if Mark Lord is interested in including my changes



He will be, trust me

_________________________
One of the few remaining Mk1 owners... #00015

Top
#48297 - 21/12/2001 14:05 Re: Question on userland application [Re: alex25]
shawn
stranger

Registered: 15/11/2001
Posts: 47
Loc: Silicon Valley
Couldn't this same technique be used for getting FIDs from the serial port (/dev/ttyS0?) with the timecodes=1 option in config.ini?

I think _yn0t was trying to get that info for a lyrics scroller, and I'm sure other people would be interested for other uses.

Top
#48298 - 21/12/2001 14:32 Re: Question on userland application [Re: shawn]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Couldn't this same technique be used for getting FIDs from the serial port (/dev/ttyS0?) with the timecodes=1 option in config.ini?

I think it's notify=1 instead of timecodes=1. Yeah I'm very interested in any easy and non-invasive way of getting the FID of the current song. Timecode also, but I already have a method to get that. When I asked about it, Mike @ Empeg didn't seem enthused enough about the idea to provide a /proc entry or anything like that. He suggested the notify=1 idea.

So I guess what you're saying is we would create a fake serial device which the player would be able read and then pass on to the real serial device... Interesting...



_________________________
- Tony C
my empeg stuff

Top
#48299 - 21/12/2001 14:49 Re: Question on userland application [Re: shawn]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14477
Loc: Canada
>Couldn't this same technique be used for getting FIDs from the serial port (/dev/ttyS0?)
>with the timecodes=1 option in config.ini?

Now there's a clever idea! I could have hijack internally enable "notify=1", and just strip them off as they arrive at the ttyS0 driver -- only allowing them out the serial line if "notify=1" was actually specified in config.ini. Meanwhile, they could be placed under /proc, or made available by other means.

Mmm.. looks relatively simple to do, too..
Anyone want to send me a patch for it?

Otherwise it will wait until I get the ftp server working inside hijack.

-ml


Edited by mlord (21/12/2001 14:58)

Top
#48300 - 21/12/2001 14:57 Re: Question on userland application [Re: mlord]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31565
Loc: Seattle, WA
Don't internally activate the timecodes=1 (or whatever the setting is really called). Only pull the stunt if it's really activated in config.ini. There is an associated slowdown with sending characters to the serial port that some people might not want. At least that's the way I remember it working.

Plus, every once in a while the empeg team introduces a bug into that feature that isn't necessarily noticed right away (happened once during 2.0 if I recall), so it's best to leave it alone unless someone really needs it.
_________________________
Tony Fabris

Top
#48301 - 21/12/2001 15:00 Re: Question on userland application [Re: tfabris]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14477
Loc: Canada
>an associated slowdown with sending characters to the serial port

The slowdown ought to only happen if the chars are actually passed out the serial hardware.

I propose intercepting them before they get that far, allowing them to flow out only if "notify=1" is truly set. And having a feature that uses them like this is a good way to ensure that future bugs are noticed much earlier.

-ml

Top
#48302 - 21/12/2001 15:02 Re: Question on userland application [Re: mlord]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31565
Loc: Seattle, WA
Your logic is compelling.
_________________________
Tony Fabris

Top
#48303 - 21/12/2001 15:08 Re: Question on userland application [Re: mlord]
Dearing
addict

Registered: 22/07/1999
Posts: 453
Loc: Florida
It's a great idea, but Tony's right about 2.0b3. The player app crashes if the machine boots into an empty playlist with timecodes active. My guess is it doesn't fault outputting to the port device, but rather generating the timecode.
Worth a try, either way.
_________________________
_~= Dearing =~_
Gettin' back into it thanks to slimrio!

Top
#48304 - 21/12/2001 15:37 Re: Question on userland application [Re: mlord]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Mark, if you got the notify=1 info onto the /proc filesystem you would officially be my hero.

I just toyed with the config.ini and it appears that (as promised) timecodes=1 has been removed and replaced by notify=1. For 2.0b3 that is.


Edited by yn0t_ (21/12/2001 15:40)
_________________________
- Tony C
my empeg stuff

Top
#48305 - 22/12/2001 10:00 Re: Question on userland application [Re: mlord]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
I propose intercepting them before they get that far, allowing them to flow out only if "notify=1" is truly set. And having a feature that uses them like this is a good way to ensure that future bugs are noticed much earlier.

Wouldn't that interfere with other output the player might generate or with the output of kernel messages? Or even with the shell if the player executable is terminated?

cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top