Serial Port access from Squeak
Todd Coram
tcoram at BLaCKSMITH.com
Mon Jan 12 20:36:29 UTC 1998
Ian Piumarta wrote:
> Todd,
>
> > I am interested in getting Squeak to control my Kodak DC20 digital
> > camera (This camera is cheap <$200 and fun to play with).
> >
> > The problem: Squeak doesn't support serial port access (or does it?).
> >
>
> If you're running on Unix (and probably Win32 too, but I don't know
> much about it) then you can treat a serial line just like a regular
> file. On Linux, for example:
>
> serial _ FileStream oldFileNamed: '/dev/ttyS0'.
> serial nextPutAll: 'Hello, serial device!; cr.
>
Thanks for the suggestion Ian, I am working under Windoze and was already
pursuing something like above mentioned line of attack, but I ran into a
couple of problems:
1. I need to set/change the baud rate, parity, bits, etc (the DC20 expects
to start at 9600 and I need to tell it to go to a higher rate for more
efficient picture transfer).
2. I need to treat the I/O more like a device (e.g. sockets) than a file.
This is so I can be signalled (Semaphores?) when presses a button on the
camera.
3. I need to treat the port as a "raw" device (binary and byte oriented
with no buffering).
I could hack 2 & 3 directly in Squeak... but I eventually want to treat the
DC20 (and perhaps any other thing connected to a serial port) as a "device".
> Anyway, on Unix (and maybe Win32) using the above technique would let
> you concentrate on making the Smalltalk stuff work, while some other
> kindhearted soul volunteers to do the VM hacking to support
> platform-independent streams for serial lines.
>
I would love to concentrate on the Smalltalk stuff (parsing the DC20 picture
format; displaying the pictures; etc), but I was hoping I could tackle the
easy part first (initializing the camera, telling it to take a picture, get
status, etc)!
My experience with Windoze hacking is pretty minimal. I have a good idea what
I need for a platform independent interface. What I need is a kindhearted
soul to give me some primitives...
My current plan of attack is to develop the Smalltalk code for serial "device"
support (and the DC20 support) and see how far I can get before I really need
the primitives. If I haven't found any code by then... I will have to roll up
my sleeves and get my hands dirty.
--
Todd Coram (Maroc Ddot)
tcoram at BLaCKSMITH.com | tcoram at pobox.com
Sardonic slaughterer of sacred cows.
More information about the Squeak-dev
mailing list
|