Re: Unix Device File Emulation

2008-04-25 Thread blaine
On Apr 24, 3:38 am, A.T.Hofkamp [EMAIL PROTECTED] wrote: On 2008-04-23, blaine [EMAIL PROTECTED] wrote: On Apr 23, 2:01 pm, Martin Blume [EMAIL PROTECTED] wrote: blaine schrieb No, while 1: r = self.fifodev.readline() if r: print r else: time.sleep(0.1) is ok

Re: Unix Device File Emulation

2008-04-24 Thread A.T.Hofkamp
On 2008-04-23, blaine [EMAIL PROTECTED] wrote: On Apr 23, 2:01 pm, Martin Blume [EMAIL PROTECTED] wrote: blaine schrieb No, while 1: r = self.fifodev.readline() if r: print r else: time.sleep(0.1) is ok (note the if r: clause). Martin Beautiful! Thanks Martin!

Unix Device File Emulation

2008-04-23 Thread blaine
Hey everyone, So I've got a quick query for advice. We have an embedded device in which we are displaying to an LCD device that sits at /dev/screen. This device is not readily available all the time, so I am needing to write an emulator. This will basically just monitor a file, /dev/screen

Re: Unix Device File Emulation

2008-04-23 Thread Helmut Jarausch
blaine wrote: Hey everyone, So I've got a quick query for advice. We have an embedded device in which we are displaying to an LCD device that sits at /dev/screen. This device is not readily available all the time, so I am needing to write an emulator. This will basically just monitor a

Re: Unix Device File Emulation

2008-04-23 Thread Ville M. Vainio
blaine wrote: example usage: echo 'line 0 0 10 10' /dev/screen On the actual embedded device this is handled by a kernel module. We can spit commands into it as fast as we can and the kernel module can keep up. This is typical unix device file behavior. Any suggestions or advice would be

Re: Unix Device File Emulation

2008-04-23 Thread Dan Upton
(let's try this again, and actually send it to the list this time) On Wed, Apr 23, 2008 at 11:02 AM, blaine [EMAIL PROTECTED] wrote: Hey everyone, So I've got a quick query for advice. We have an embedded device in which we are displaying to an LCD device that sits at /dev/screen. This

Re: Unix Device File Emulation

2008-04-23 Thread blaine
On Apr 23, 11:17 am, Ville M. Vainio [EMAIL PROTECTED] wrote: blaine wrote: example usage: echo 'line 0 0 10 10' /dev/screen On the actual embedded device this is handled by a kernel module. We can spit commands into it as fast as we can and the kernel module can keep up. This is

Re: Unix Device File Emulation

2008-04-23 Thread Martin Blume
blaine schrieb # Fake Nokia Screen Emulator import sys, os class nokia_fkscrn: def __init__(self, file): if not os.path.exists(file): os.mkfifo(file) self.fifodev = open(file, 'r') def read(self): while 1: r = self.fifodev.readline() print r

Re: Unix Device File Emulation

2008-04-23 Thread blaine
On Apr 23, 12:27 pm, Martin Blume [EMAIL PROTECTED] wrote: blaine schrieb # Fake Nokia Screen Emulator import sys, os class nokia_fkscrn: def __init__(self, file): if not os.path.exists(file): os.mkfifo(file) self.fifodev = open(file, 'r') def read(self):

Re: Unix Device File Emulation

2008-04-23 Thread Martin Blume
blaine schrieb while 1: r = self.fifodev.readline() if r: print r According to my docs, readline() returns an empty string at the end of the file. Also, you might want to sleep() between reads a little bit. Oh ok, that makes sense. Hmm. So do I not want to use

Re: Unix Device File Emulation

2008-04-23 Thread blaine
On Apr 23, 2:01 pm, Martin Blume [EMAIL PROTECTED] wrote: blaine schrieb while 1: r = self.fifodev.readline() if r: print r According to my docs, readline() returns an empty string at the end of the file. Also, you might want to sleep() between reads a little bit. Oh