Unoffical empeg BBS

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

Topic Options
#105387 - 16/07/2002 13:41 Serial port access from Linux...
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3996
Loc: Manchester UK
Hello,

Could someone point me in the direction of some simple code that would allow me to read data from the docked serial port whilst the player app is running. I don't actually need full read/write access, simply to be able to listen to the data coming out of my GPS reciever.
_________________________
Cheers,

Andy M

Top
#105388 - 16/07/2002 13:56 Re: Serial port access from Linux... [Re: andym]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Ahh, the always popular world of Unix serial programming. While I've not done it on the empeg, (and it might be different since there's otehr stuff happening on the serial port), the following guides I've always found to be useful:

http://www.easysw.com/~mike/serial/serial.html
http://www.stokely.com/unix.serial.port.resources/serial.card.code.html#code.link (toward the bottom)
http://astronomy.swin.edu.au/~pbourke/other/serial/

I'm sure you can find more by searching for ``Unix Serial Programming'' on your favorite search engine.
_________________________
Bitt Faulk

Top
#105389 - 16/07/2002 14:21 Re: Serial port access from Linux... [Re: wfaulk]
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3996
Loc: Manchester UK
Thanks, I'm sure that'll do the trick. Do you think there could be a problem trying to listen to the com port while the player app is running. From looking at the code it looks like I'm just opening a file and reading the contents.

Now, next problem is to try and get a polling loop inside my Hijack userland program to work. At the moment it looks like the program waits until a button has been pressed and then continues execution, any way around this?
_________________________
Cheers,

Andy M

Top
#105390 - 16/07/2002 14:43 Re: Serial port access from Linux... [Re: andym]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
There might be a problem with getting your code and the player to work with the serial port at the same time. I'm not sure if the player will prevent reads. I'm pretty sure there's an option you can give the player software to get it to stop dealing with the serial port, but I forget what it is right now. Maybe it's in the developer section of riocar.org?

And what do you mean with your ``polling loop'' question? You mean that your read is blocking for input (that is, not progressing any further unless the read() has something to return)? You might want to look at the select() function call. You can also apply timeouts to certain things; maybe an ioctl()? I think one of those documents talks about it at least a little.
_________________________
Bitt Faulk

Top
#105391 - 16/07/2002 15:37 Re: Serial port access from Linux... [Re: andym]
kirkis
new poster

Registered: 17/03/2002
Posts: 21
In reply to:

Now, next problem is to try and get a polling loop inside my Hijack userland program to work. At the moment it looks like the program waits until a button has been pressed and then continues execution, any way around this?




I had the same problem. You can get around this with the ioctl EMPEG_HIJACK_POLLBUTTONS.

It is briefly discussed in this thread:

http://empeg.comms.net/php/showthreaded.php?Cat=&Board=hackers_prog&Number=43891&page=&view=&sb=&o=

I couldn't find much in the way of documentation, but with a bit of experimentation I got it to work properly. I'm hoping to release code within a few weeks that will demonstrate its use.

Top